Menu
Amazon Simple Email Service
Developer Guide

Part 6: Create an AWS Lambda Function

Now that all of the components are in place, you can create a Lambda function. The function creates an HTML dashboard and notifies you by email when that dashboard is updated.

To create a new AWS Lambda function

  1. Download sesreport.zip from https://github.com/awslabs/aws-support-tools/raw/master/SES/SESReports/sesreport.zip.

  2. Open the AWS Lambda console at https://console.aws.amazon.com/lambda/.

  3. In the navigation bar, choose Functions.

  4. Choose Create function.

  5. Choose Author from scratch.

  6. Under Author from scratch page, complete the following steps:

    Choose Create function.

  7. Under Function code, for Code entry type, choose Upload a .ZIP file.

  8. Choose Upload. Upload sesreport.zip.

  9. Under Environment variables, add the following keys and values:

    Keys and Values

    Key Value Sample Value
    QueueURL The URL of the Amazon SQS queue you created in Part 2: Create a Queue in Amazon Simple Queue Service. https://sqs.us-east-1.amazonaws.com/999623213###/sample-queue-name
    Region The AWS Region in which you created the Amazon SNS topic in Part 1: Create a Topic in Amazon Simple Notification Service. us-east-1
    ToAddr The email address that will receive the bounce and complaint report. robert@example.com
    SrcAddr The email address that will send the bounce and complaint report. reports@example.com
    BucketName The name of the Amazon S3 bucket you created in Part 3: Create an Amazon Simple Storage Service Bucket. sample-s3-bucket
    BucketPrefix [Optional] If you want to save the dashboards in a folder in the Amazon S3 bucket, specify the path here. The path you specify must end with a forward slash (/). SES/reports/
  10. Under Basic settings, make the following selections:

    • For Memory (MB), choose 512 MB.

      Note

      If you think you will receive more than 5,000 bounces and complaints per day, increase the value in the Memory field to at least 1024 MB. If you think you will receive more than 10,000 bounces and complaints per day, increase the value in the Memory field to at least 1536 MB.

    • For Timeout, select 5 min.

  11. Choose Test.

  12. On the Configure test event window, for Event name, type a name, and then choose Create.

  13. In the notification bar at the top of the page, confirm that the function ran successfully. If it did not, ensure that you entered the correct values for the environment variables in step 9.

  14. Proceed to Part 7: Test the AWS Lambda Function.