Setup serverless email using SES S3 & Lambda with you personal domain- 3 mins
Let’s assume you have a personal domain (mydomain.com). You want to create an email address with you personal domain on it, for example email@example.com, and forward all the email that send to firstname.lastname@example.org to your personal email address (email@example.com). This tutorial suits you best.
Setup the domains in SES management console
- Verify your domain according to the link.
- Set up a receipt rule according to the link.
Take a note of the Bucket Name in section 5 for later usage.
- Login SES console.
Email addresseson the left panel.
Verify a New Email Address.
- Type in the email address that you want to forward to (in my case is
- Go through all the steps and verify your email.
Set the Lambda action for SES
- Download the file index.js.
- Modify the values in the
defaultConfigto specify the S3 buckget and object prefix for locating emails stored by SES In my case:
- Login AWS Lambda.
- Cretae a new function.
Author from scratch.
- Name the function
SesForwarderand optionally give it a description. Ensure Runtime is set to Node.js 4.3 or 6.10.
- For the Lambda function code, either copy and paste the contents of
index.jsinto the inline code editor or zip the contents of the repository and upload them directly or via S3.
- Ensure Handler is set to
- For Execution role, choose
Create a custom role. In the popup, give the role a name (e.g., LambdaSesForwarder). Configure the role policy to the following, change the
- Memory can be left at 128 MB, but set Timeout to 10 seconds to be safe. The task usually takes about 30 MB and a few seconds. After testing the task, you may be able to reduce the Timeout limit.
S3 bucket policy settings
Login S3 and choose the bucket you just created.
- Click the
Permissionson the top menu.
- Make sure your policy is like following: