Amazon API Gateway REST API to AWS Lambda to Amazon SES

Amazon API Gateway → AWS Lambda → Amazon SES

Send an email with Amazon SES from an AWS Lambda function behind an Amazon API Gateway REST API.

This pattern deploys an Amazon API Gateway REST API with a GET method that invokes an AWS Lambda function. The function uses the AWS SDK for Python (Boto3) to send an HTML email with Amazon SES, using an SES configuration set that the template also creates.
Before you deploy, verify a sender identity in Amazon SES and set the sender and recipient addresses in email-lambda/email-lambda.py. In the SES sandbox, the recipient address must be verified too.

< Back to all patterns

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-lambda-ses

Deploy

sam buildsam deploy --guided


Testing

Call the apiGatewayInvokeURL stack output, for example curl https://{api-id}.execute-api.{region}.amazonaws.com/sendEmail, then check the recipient's inbox.

Cleanup

Delete the stack: sam delete.

Created by:

Surya Dulla

Surya Dulla

DevOps Engineer at AWS, Advocate for Cloud technology