Implements a lambda function that handles SES email bounces via SNS.
An IAM role with the following policy is required as the execution role for the lambda function
(ses-bounces
refers to the AWS bucket name)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],
"Resource": "arn:aws:logs:*:*:*"
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::ses-bounces/*"
]
}
]
}
- Setup a SNS topic to receive bounce notifications
- Setup a lambda function triggered by this SNS topic
-
Run
npm install
-
Zip the contents (including
node_modules
) of this repo and upload it (see Function package in image)
-
Set the
AWS_BUCKET
environment varaiable to the AWS bucket you want to save bounce logs to -
Set the handler to
index.sesBounceHandler
-
Create a new IAM role or select one with the policy shown above (Prerequisites (IAM))
- To ensure sufficient time to execute (save to S3) increase the timeout to 30s
- You are good to go