Part 6: Create an AWS Lambda Function - connect-group/terraform-aws-ses-dashboard GitHub Wiki

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

  • QueueURL

  • Region

    • The AWS Region in which you created the Amazon SNS topic in Part 1: Create a Topic in Amazon Simple Notification Service.
    • Example: us-east-1
  • ToAddr

    • [Optional] The email address that will receive the bounce and complaint report.
    • Example: [email protected]
  • SrcAddr

    • [Optional] The email address that will send the bounce and complaint report.
    • Example: [email protected]
  • BucketName

    • The name of the Amazon S3 bucket you created in Part 3: Create an Amazon Simple Storage Service Bucket.
    • Example: 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 (/).
    • Example: SES/reports/
  1. 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.
  2. Choose Save and test.

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

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