I want to host my website on EC2 and my mail servers on Google Apps. This would seem to be simple but I can't get the receiving of Mail to work due to a DNS issue. I have changed the MX records as required for my host but they aren't being picked up because my CNAME which is required for EC2 makes the DNS search for the MX on Amazon which is not what I want.


There are a couple of folks having similar mail issues which they solve by using A records not CNAMEs e.g. https://stackoverflow.com/questions/6493076/setting-up-cname-at-directnic-com-caused-gmail-in-google-apps-for-businesses-to-s "For compatibility reasons, you can't put a CNAME in the root domain; doing so will break email. Use an A record instead. "

But you can't use an A record with EC2 - you have to use a CNAME as the IP changes.

Are these services just incompatible and I have to move the sites web hosting to somewhere I can add an A record to an IP?

This is a bit of a pain so I thought I'd ask here if anyone has an alternative before I wade in.


  • It's not clear what you're trying to point at. If it's an EC2 instance, you can associate an Elastic IP address with it, and use that for your A record. What you can't do is point an A record at an Elastic Load Balancer instance. This limitation is a PITA when you want foo.com (as opposed to www.foo.com) to resolve to the ELB. As @Eric rightly points out, the only known solution for that problem is to use Amazon's DNS service. And that is a problem if you're hosting a site for someone but not managing their DNS too.
    – Jeff
    Oct 29 '11 at 20:00

You cannot use a CNAME on the bare domain name (what you are calling the "root domain"). This is a known limitation of ELB (elastic load balancer) on EC2.

The solution, released recently by Amazon, is to use Amazon Route53 to host your DNS. This integrates with ELB to handle bare domains without CNAME. Your MX records can still be pointed at Google with Route53.

  • Thanks @Eric. As Route53 is not free it is cheaper for me to simply move the whole site to a server out of the cloud. Good to know how to approach this if I do a project where EC2 is a requirement. Best, Rob Sep 26 '11 at 13:10
  • I'd be interested to know how much Route53 would cost for you. It seems pretty cheap to me unless you have hundreds of domains that don't get traffic: aws.amazon.com/route53/pricing Sep 26 '11 at 17:42
  • Probably very little for Route53 but the cost for me personally is related the the otherwise unused EC2 instance ECU's not the Route53 cost. Others may find that the way to go. Thanks for your time. Oct 5 '11 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.