Soon after I moved my site from Drupal to a Hugo generated static site hosted on Amazon S3 my Google Apps email stopped working. In this post I share how I set up my DNS for my site and kept my email working. If you use Amazon Route 53 for your DNS you will not have this problem. Transferring you domain to Route 53 is the quick solution. If you want to stay with your current DNS provider then read on.
The problem
A naked CNAME entry pointing to your S3 bucket example.com will override all MX records for your domain. The result is your email is sent to the wrong domain.
The solution
Don’t follow all the instructions from Amazon AWS S3 on how to host your static site on S3. These are the steps you should follow when creating your buckets:
- DO NOT create a bucket called example.com
- Only create a bucket called www.example.com
- Create an A record that points to 174.129.25.170. This is a free service provided by Wwwizer that will redirect example.com to www.example.com.
My solution introduces a dependency on Wwwizer. This is a risk I am willing to take. I don’t have any affiliation to Wwwizer whose main business appears to be “providing SSL for the cloud”. I have some domains with my current provider and didn’t want to move one to Route 53. I haven’t had any problems with my email since making this configuration.