3

I'm considering changing the DNS www records of a domain name from an A record to a CNAME. Various questions and answers on serverfault are not as clear cut as I'd hoped. Also, many DNS checking tools like DNSsy or intoDNS have as a check the fact that the www record is not a CNAME, is an A record, pointing to a public IP address.

In my case, I want to point my domain's www record to an Amazon Web Services load balancer which I can only do with a CNAME. What would be the best way to achieve that?

3 Answers 3

5

If you are concerned about this issue, you can use Route 53 and ELB together to get what you want. Create the www record as an A record, then select the "Alias" option and the interface will allow you to select an AWS-specific target to point the record to. So the ELB has to exist first, then you can create the Alias to it.

So you start to create a new A record in Route 53 as usual, but you click on the "Alias" option right under the host name. The freeform text block will disappear and you will be given the ability to select your ELB under "Alias Target". Select your ELB and save the change. You will then have an A record that points to www, which will be your ELB.

(The above info about the Route 53 UI has been corrected from the original error.)

This is a special Route 53 feature most often used to handle serving from the domain apex, where A records are required. But it can also be used for subdomains such as www. Basically, it's an A record that acts like a CNAME within the confines of AWS. Using this feature, DNS tools will find an A record.

5
  • thanks for your answer. so you are saying that the domain apex (*.example.com) requires an A record? It can't be a CNAME unlike www?
    – greener
    Dec 2, 2012 at 19:09
  • 1
    Actually by domain apex I mean just the one host at the top level of the domain, example.com. And that does require an A record. That's why they created this special feature in Route 53, because you can't own the A record for something like lb-4294967295.us-east-1.elb.amazonaws.com.
    – platforms
    Dec 2, 2012 at 19:14
  • 1
    So Amazon effectively says, "We know you need an A record for this, but you can't have it. So instead, let's work together to fake everyone out." It works.
    – platforms
    Dec 2, 2012 at 19:15
  • This is where I get confused: until I use Route53 which I will end up using, my current dns zone records are example.com and www A records pointing to an IP. I need to point them to the ELB so I would make both CNAMES. But that's wrong right because the example.com one has to be an A record? Is there no way then not to use Route53?
    – greener
    Dec 2, 2012 at 19:19
  • See my edit - I corrected how the UI works in Route 53. You go into Route 53 and first delete your CNAME for www. Then create a new A record, but you click on the "Alias" option right under the host name. The freeform text block will disappear and you will be given the ability to select your ELB under "Alias Target". Select your ELB and save the change. You will have an A record that points to www, which will be your ELB.
    – platforms
    Dec 2, 2012 at 19:23
2

In my case, I want to point my domain's www record to an Amazon Web Services load balancer which I can only do with a CNAME. What would be the best way to achieve that?

If the only way to do it is via a CNAME, it seems like the best way to do it would be a CNAME. I know it sounds simple, but if that's all that Amazon supports, then it's what you have to do, regardless of any other pros and cons.

Just for the record though, I've definitely CNAME'd www before without issue.

1
  • Appreciate your answer. Perhaps I have to use Amazon's nameservers Route 53 was a constraint I considered as possible.
    – greener
    Dec 2, 2012 at 17:41
0

Creating the CNAME is what you're supposed to do, according to Amazon's documentation. You point it at the name of the Elastic Load Balancer that you were given, which you can find in the management console.

So you set up a CNAME record like:

www     IN      CNAME   lb-4294967295.us-east-1.elb.amazonaws.com.
2
  • I would think that's what one is supposed to do but then why are the DNS tools checking for A records and IP addresses?
    – greener
    Dec 2, 2012 at 18:50
  • Yes - in addition, you can even have an ELB serve requests for the apex of a domain if you create a special "alias" A record in Route53 (not available with other DNS solutions).
    – platforms
    Dec 2, 2012 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .