Launch a CloudFormation template to set up a stack of AWS resources to fill
a simple need: Supporting Gmail addresses with “-” instead of “+”
separating the user name from the arbitrary tag strings.
The CloudFormation stack launched by the template consists of:
- ELB (Elastic Load Balancer)
- Auto Scaling Group
- EC2 instance(s) running Postfix on Ubuntu set up by a user-data script
- Security Group allowing ELB to connect to the instances
- CloudWatch CPU high/low alarms
- Auto Scaling scale up/down policies.
- SNS (Simple Notification Service) topic for notification of Auto
Scaling events - Route53 Record Set
This basic stack structure can be used as a solution for a large
number of different needs, but in this example it is set up as an SMTP
email relay that filters and translates email addresses for Google
Apps for Business customers.
Because it uses Auto Scaling, ELB, and Route53, it is scalable and able
to recover from various types of failures.
If you’re in a rush to see code, you can look at the CloudFormation
template and the initialization script run from
the user-data script.
Now, let’s look a bit more in depth at the problem this is solving and
how to set up the solution.
Background
If you have a Gmail address of user@example.com, then email messages
sent to addresses of the form user+ANYTHING@example.com will also be
delivered to you. You can use any email address string after the plus
sign.
Google describes this feature in a blog post:
Append a plus (“+”) sign and any combination of words or numbers
after your email address. For example, if your name was
hikingfan@gmail.com, you could send mail to
hikingfan+friends@gmail.comorhikingfan+mailinglists@gmail.com
This is is useful for tracking where you have entered your email
address and findingout which services allow it to be used for spam.
If an email variation starts getting abused, you can automatically
filter it out in Gmail.
The Problem
Unfortunately, many web sites do not allow an email address with a “+”
when registering and will reject any attempts to use this. I don’t
know if they are trying to prevent people from using unique tracking
addresses or if they just don’t know the specification for a valid
email address, but the end result is the same.
If we could just use a dash (-) instead of a plus, we could enter
unique tracking email addresses in each site registration.
Another example for why plus can be bad: My son added “+psat” to his
email address when filling out the written PSAT so he could track who
they sold his email address to (apparently every college out
there). The data entry person typed a “t” instead of a “+”, so
colleges started sending emails to the wrong address.
Prerequisites
The approach presented here works with custom domains set up with
Google Apps for Business. You can’t use it for individual, free
“@gmail.com” addresses without some additional work and a separate
domain name registration.
As currently written, the CloudFormation stack requires that you
already have your domain DNS handled by Route53, as the template will
insert a new DNS entry for the email relay. This functionality could
be removed from the template if you don’t use Route53.
The Solution
This CloudFormation template sets up a stack that will translate email
addresses when Gmail forwards …read more
Source: FULL ARTICLE at Planet Ubuntu






Stephen Sauer