Domain – Naked domain map + Gmail MX Records

domaindomain-name-system

I want to map a naked domain (i.e., example.com instead of www.example.com) to my EC2 server. I also have gmail setup on my example.com domain.

A few weeks ago I attempted to map this together using CNAME to map to my EC2 URL. My email stopped working and it took some time to get back online; thus, I want to be extra careful to ensure I don't have an error if I try this again.

I have a static IP mapping to my EC2 server now. Thus, it is my understanding that the following host records will work:

-A record to @ host name (example.com) which points to my static IP address on AWS.
-Maintain my gmail MX record settings.

Can anyone confirm that this is the right way to set my domain settings and that email will continue to be correctly routed?

Thanks!

Best Answer

The rule about CNAME records is that they don't mean what you think they mean. They mean that the specified name is an alias of the target name for all record types, not just A records. So by CNAMEing example.com to ec2.example.net, you are saying that the MX record of example.com is the same as the MX record of ec2.example.net, which is not what you want. Because of this, names with a CNAME record cannot have any other record types assigned to it. Since the root of a delegated zone must have an SOA record, you cannot have a CNAME record at the root of a zone. Therefore you can CNAME www.example.com to your EC2 server, but you must use an A record for example.com.

Related Topic