Skip to content

Terraform that builds out a serverless mailbox/email forwarder in AWS

License

Notifications You must be signed in to change notification settings

wahlfeld/ses-forwarder-terraform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SES Forwarder Terraform

Architecture

alt text

Source: https://aws.amazon.com/blogs/messaging-and-targeting/forward-incoming-email-to-an-external-destination/

alt text

Source: https://medium.com/@ashan.fernando/forwarding-emails-to-your-inbox-using-amazon-ses-2d261d60e417

Prerequisites

  • You have a domain in AWS
  • You have a verified your domain in AWS SES (including DKIM)
  • If you have not configured inbound email handling, create a new Rule Set. Otherwise, you can use an existing one.
  • You have configured the DNS MX record for your domain to point to the email receiving SES endpoint e.g. inbound-smtp.us-west-2.amazonaws.com
  • Know what Terraform is
  • Know what all the components are in the diagrams above (ish)

How to Use

  1. Create a Terraform backend S3 bucket to store your state files
  2. Copy and paste the example folder somewhere on your computer
  3. Configure backend.tf to point at the S3 bucket you just created
  4. Configure terraform.tfvars as per the input descriptions in inputs.tf
  5. Run terraform init && terraform apply
  • The steps above will set up a serverless mailbox for one email. You can copy and paste the example folder and repeat the steps to create multiple mailboxes (make sure your change the Terraform backend key).
  • The sns_email_address variable is the email where error notifications will be sent to, so if you're administering several mailboxes you would keep this address the same for each one.
  • You will need to confirm SNS subscription notifications will work.

Tests

Currently using terraform validate + terraform-compliance:

./test/test.sh

Requirements

Name Version
aws ~> 3.0

Inputs

Name Description Type Default Required
account_id The AWS account ID string n/a yes
bucket_name The name of the S3 bucket where emails will be stored string n/a yes
cloudwatch_alarm The name of the CloudWatch alarm monitoring the Lambda function string n/a yes
cloudwatch_metric The name of the metric used for detecting Lambda runtime errors string n/a yes
lambda_name The name of the Lambda function string n/a yes
lambda_recipient Where the Lambda function will send/forward the sent mail to string n/a yes
lambda_role_name The name of the IAM role used by the Lambda function string n/a yes
mail_s3_prefix Folder prefix where emails will be stored e.g. /mail string n/a yes
region Must be either us-west-2, us-east-1 or eu-west-1 (where SES receiving is) string "us-west-2" no
ses_mail_recipient The email address that the sender used string n/a yes
ses_rule_name The name of the SES rule that invokes the Lambda function string n/a yes
ses_set_name The name of the active Rule Set in SES which you have already configured string n/a yes
sns_display_name The friendly name of the SNS topic string n/a yes
sns_email_address The email address used to send error notifications to string n/a yes
sns_protocol The SNS protocol string "email" no

Limitations

Source: https://github.com/arithmetric/aws-lambda-ses-forwarder

Other Documentation

About

Terraform that builds out a serverless mailbox/email forwarder in AWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published