I’ve been setting up Amazon SES on a website and wanted to make a post with notes so that it’s easier next time. This is a “wiki post” that anyone can edit. Feel free to add resources and make corrections.
I’ll keep adding links here as I close my tabs.
Descriptions of the Relevant Services
I hadn’t used AWS before, so I had to figure out what all the various services were and how they fit together. Here’s a quick summary.
- SES — sends emails but doesn’t log things or do much else by itself
- SNS — creates “topics” (channels of messages) that “subscribers” can receive. There are different kinds of subscribers: HTTP, email, email-JSON, SMS, AWS Lambda function, etc.
- IAM — identity and access management. This is where you create users (humans and programs) in your AWS account and give them permissions to perform tasks. For security purposes, you don’t want your email sending program to have access to deploy servers that mine bitcoins, so you can create an IAM user for your program that only has access to the SES part of your AWS account. There’s a guide to setting it up in the free preview videos for this Udemy course. (Tip: don’t pay more than $10-12 for courses on Udemy because they go on sale regularly.)
- Cloudwatch — a logging service
- Cloudfront — a CDN that you can use for click event tracking
- Lambda — small bits of code that run based on triggers (HTTP requests, Cloudwatch events, and more). You can use Node, Python, Go, Java, C#, Ruby or another language.
- S3 — file storage
- Route 53 — Amazon’s domain name system (I’m using Cloudflare for DNS, so I didn’t look at Route 53.)
I started with this post, but it didn’t have enough information to finish the project, which is why I started making this wiki post.
- Simple Email Service (SES) Tutorial NodeJS + AWS SDK
- Simple Notification Service (SNS) Email Setup And CloudWatch Alarm
Normally, you can send the emails with credentials from an IAM user that only has access to SES, but there is also a way to use SMTP if needed.
- How can I monitor the opens, clicks, and bounces from emails that I send using Amazon SES?
- Retrieving Amazon SES event data from CloudWatch
- Amazon SES email sending metrics FAQs
- Set up a CloudWatch event destination for event publishing
- Logging Amazon SES API calls with AWS CloudTrail
- Analyzing Log Data with CloudWatch Logs Insights
There’s also a page on Creating a Daily Dashboard to Track Bounces and Complaints, but it says that it’s outdated as of 2019.
TODO: add information on how to download logs and trigger Lambda functions based on SES-related events (bounces, complaints, etc.).
Blocking Incoming Emails
- How can I block emails from specific domains or email addresses in Amazon SES? — this method runs your incoming email through an AWS Lambda function and logs to Cloudwatch.