Setting up email with Amazon S3

TL;DR: If you’re using Route53 DNS and serving your site from your root domain bucket in S3, just jump into the Route53 console and update your MX, TXT and CNAME records provided by your email service provider.

Last night I decided I’d finally get around to setting up email at my domain in preparation for a mailchimp sign-up form and some other things I’m working on.

This site is served up via Amazon S3, so it’s effectively just being hosted on a file server and not a typical web server, so I was initially worried it might be difficult to get email running at my domain.

I jumped onto the web and did some searching and at first I thought I was right. There’s a bunch of forum responses and blog posts saying that it isn’t possible, mostly because at one stage, sites hosted on S3 weren’t able to be served from the root domain, only at the www sub-domain — and providers like Google Apps don’t like serving email to a CNAME.

The good news is that it is possible, as earlier this year Amazon made some updates that meant sites could be served straight from the root domain using the Route53 DNS service.

So, if you’ve arrived here wanting to know how to get email going at your domain with a website hosted on Amazon S3, here’s how to do it. I’ll assume if you’re still reading, you already have a website served out of S3 with Route53 providing DNS, if not read here.

You’ll first need a third party email service that allows mail through your own domain, such as Google Apps, FastMail, or if you have your domain with Name Cheap they’ve partnered with Open-Xchange to provide a Microsoft Exchange alternative. I happened to choose Open-Xchange since they have a deal to receive a year for free, but if you plan on using the web interface I’d think carefully about it because it’s super ugly and clunky.

During setup with your mail service, make sure to enter the domain being served via Route53. Once you’ve got that up and running, you’ll be provided with the following information: a CNAME, a TXT record, and most likely two MX records.

Once you’ve got your information ready, jump into the AWS console, and head over to Route53. Click on Hosted Zones on the left and double-click on the Hosted Zone (your domain) you wish to edit.

Just as before, when you entered in your record sets for A records and name servers here for your site, this is where you’ll pop in the records for email. Click “Create Record Set”, and enter the details for each record you have. You’ll need to do them one-by-one, except for the MX records where both values can be inputted in the same field, seperated by a line break.

My Route53 Record Set configuration

Once done, it should only take about a minute for everything to update but otherwise you’re ready to go. Navigate to the address given to you for reaching your new email service and login. Once you’ve logged in you should be able to grab IMAP details or similar and get your email running on your desktop and mobile client, otherwise your mail provider may have already supplied these for you.

A couple of things to note:

  1. The CNAME record will be the only time you need to input text before the domain name when you are creating the record set. It will likely be mail.yourdomain.com, but could differ.
  2. Your TXT record will need to wrapped in double quotation marks regardless of how it’s presented from your email provider.
  3. You’ll need to wait at least as long as your CNAME TTL value for the web mail address to resolve.

That’s it!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.