英文:
Access AWS SES from a lambda function that is inside a VPC
问题
我已经按照这里所述设置了必要的VPC端点。
然而,在我的Lambda函数内部(使用Node.js),我执行以下操作:
const sesClient = new SESClient({ });
...
await sesClient.send(sendEmailCommand);
在5分钟后它超时了。
在初始化SES客户端时是否应指定特定的端点?
英文:
I have already set up the necessary VPC endpoints as stated here.
However, when inside of my Lambda function (using Node.js) I do:
const sesClient = new SESClient({ });
...
await sesClient.send(sendEmailCommand);
it times out after 5 minutes.
Should a specific endpoint be specified when initializing the SES Client?
答案1
得分: 2
请检查相应的CloudTrail中的SES API日志,确保SES API调用正常通过您的VPC端点进行。我很有把握认为SDK正在连接到API,而SES的VPC端点是用于SMTP的。要解决您的问题,请使用SMTP接口或者在您的VPC中引入一个NAT网关(如果您的用例允许的话)。
英文:
Please check the corresponding SES API logs from CloudTrail to make sure that the SES API calls are going through your VPC endpoint properly. I have a strong hunch that the SDK is connecting to the API and VPC endpoints for SES are meant for SMTP. To solve your problem, please use SMTP interface or introduce a NAT Gateway to your VPC if your use-case allows it.
答案2
得分: 1
根据Allan Chua的建议,使用像nodemailer这样的工具与SES SMTP接口一起使用是有效的。
nodemailer.createTransport({
port: 587,
host: `email-smtp.${region}.amazonaws.com`,
auth: {
user: smtpUsername,
pass: smtpPassword
}
});
英文:
As Allan Chua suggested, using the SES SMTP interface with a tool like nodemailer works.
nodemailer.createTransport({
port: 587,
host: `email-smtp.${region}.amazonaws.com`,
auth: {
user: smtpUsername,
pass: smtpPassword
}
});
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论