The entire documentation about this project is presented in my blog post.
AWS offers a generous free tier for the services we use:
Parameter Store
: Standard parameters are free. The interaction (retrieve/update value) with the parameter costs$0.05
per 10,000 interactions.EventBridge Rule
: Free for our use case.SNS
: 1,000 notifications are free, after that $2 per 100,000 notifications.Lambda
: This varies based on the memory and execution time of the Lambda. Using a Lambda of 512MB and 5s for each execution and running every 1 minute we will use around110,000GB-s/month
. The free tier is 1 million invocations per month and 400,000Gb-s of compute time. So for us, this will be free.
So this is very likely to be free for you!
To make it more user-friendly I will do a step-by-step guide to help you setup all of this. Follow this in order!
The first thing we need to do is to access your Gmail settings and make sure the IMAP
is enabled (check the Forwarding and POP/IMAP
tab).
After that let's create a new App Password for us to use with the IMAP.
- Access Google Settings
- Search for
App Passwords
- Create a new app password and copy the password value after creation
Make sure to do all these steps in the email accounts you want to secure, in my case I have two (so I did this for both accounts).
To make the development live easier I set up DevBox in the project. So you only need to have DevBox installed and run devbox shell
to install all the dependencies of the project (NodeJS, Yarn...).
- Install the dependencies
devbox shell
- Move to the
infrastructure
folder
cd infrastructure
- Install NodeJS dependencies
yarn
-
Modify the
config.ts
file accordingly -
Deploy the infrastructure
yarn cdk deploy
Make you have AWS credentials setup in place and that your account-region is already CDK bootstraped.
- Check the receiver email and accept the subscribe email from Amazon SNS
- Go to the AWS console and update the parameter(s) that contain your password (e.g.
/email/gmail.com/<YOUR_EMAIL>/password
) to used the app password you copied.
Finally! Now we are receiving our forwarded emails as expected!