Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question

migrated from stackoverflow.com Apr 26 '11 at 16:22

This question came from our site for professional and enthusiast programmers.

3 Answers 3

Yes, I can confirm that using an A record for the naked domain will allow your MX records to work correctly.

Here's a very helpful error message my dns provider gave me when I tried to use a CNAME for a naked domain. It helps explain why email stopped working when using a CNAME:

You may not assign a Mail Server to a domain name that was defined using a CNAME. This MX record would never be used by e-mail clients. A proper e-mail client will look for an MX record for 'example.com.s3-website-us-east-1.amazonaws.com' and use that. WARNING: Not all email clients understand how to do even this correctly. Therefore, you may receive only limited support if you choose to define 'example.com' using a CNAME, and then try to send email to 'username@example.com.

share|improve this 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.

share|improve this answer

The setup that you have mentioned for the DNS Zone is correct, the @ A record pointing to your EC2 server IP leaving the Google MX records pointing to the correct Google email server hostnames.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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