Search code examples
amazon-web-servicesaws-lambdaamazon-vpcamazon-ses

Access AWS SES from a lambda function that is inside a VPC


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?


Solution

  • 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
      }
    });