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. Sign in to the AWS Management Console and open the AWS Lambda console at https://console.aws.amazon.com/lambda/.

  3. Choose Create function.

  4. Choose Author from scratch.

  5. On the Basic information page, make the following selections:

    Choose Create function.

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

  7. Under Function package, choose Upload. Upload sesreport.zip.

  8. Under Environment variables, specify 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 [Optional] The email address that will receive the bounce and complaint report. robert@example.com
    SrcAddr [Optional] 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/
  9. Under Basic settings, make the following selections:

    • For Memory (MB), choose 512.

      Note

      If you think you will receive more than 5,000 bounces and complaints per day, specify a Memory value of 1024 MB or greater. If you think you will receive more than 10,000 bounces and complaints per day, specify a Memory value of 1536 MB or greater.

    • For Timeout, select 5 minutes.

  10. Choose Save and test.

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

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