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. Under Select blueprint, choose Blank Function.

  4. On the Configure triggers window, choose Next. You will configure the triggers in a later step.

  5. Under Configure function, for Name, type a name for the function. For Runtime, choose Node.js 4.3.

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

  7. Next to Function package, choose Upload. Upload sesreport.zip.

  8. Under Lambda function code, for 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 Lambda function handler and role, for Role, choose Choose an existing role. Then, for Existing role, choose the IAM role you created in Part 4: Create AWS Identity and Access Management Policies and Roles.

  10. Under Advanced settings, 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.

  11. For Timeout, select 5 minutes. Choose Next.

  12. On the Review page, choose Create function.

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