DNS: Google Apps Mail MX record issue caused by CNAME from EC2

amazon ec2domain-name-systememailg-suitemx-record

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.

http://www.dnsstuff.com/tools/legacy/?formaction=DNSLOOKUP&ToolFormName=customlookup&name=kodental.co.uk&detail=0&type=MX

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.

Thanks

Best Answer

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.

Related Topic