Alex Rivera | Logout

Difference between an A Rec and CNAME in Route53

Asked 2013-06-19T14:16:32.753
59

As Amazon Route 53 allows you to set an A record or a CNAME to a different sub-domain name using Alias, I am wondering what is the difference between A record and CNAME now.

To clarify my question, the difference between CNAME and A record in a traditional NameServer is that only CNAME can be used to point to a different subdomain and A record must point to a valid IP address. Since the AWS Route53 allows you to do use a subdomain with either A Rec or CNAME .. does it not blur the distinction between the two.

Edit
Report

1 Answer

111

Your question is quite valid, but you are using the word "subdomain" in a not-quite-precise way.

What you are actually asking is about the fact that an Route 53, an A record can give the appearance of referencing either a fully-qualified hostname from another domain, or a hostname or subdomain from its own domain, while in proper DNS, the only way to reference another hostname is with a CNAME, yet those can't be provisioned at the apex of a domain ("example.com") pointing to a subdomain ("www.example.com").

An alias, you're saying, seems to be functionally equivalent but more flexible than a CNAME so is there a difference?

The difference between a CNAME and an alias is that a CNAME is still a proper, standard, ordinary DNS CNAME, which returns a DNS query response "hi, you need to know that the real ("canonical") name of the server you are looking for is 'x'" and, depending on circumstances, may also include the A record for the target host or may not, requiring the client to go for a second lookup.

Aliases, on the other hand, are a clever hack created by Amazon which does not break the protocol yet allows Route 53 to hand out the A record directly from resource "X" when the A record for resource "Y" is requested. Aliases can also reference other record types, but the record type they reference must be the same and for the purposes of this discussion, I am talking about A record aliases.

And, the important take-away here is that an alias actually returns an A record -- not a reference to the target, like a CNAME does.

The catch is that with an alias, you cannot put just any hostname in that box. It has to be a hostname within a domain where Route 53 has the magical hooks so that it can retrieve the apprpriate A record to s

answered 2013-06-20T00:32:22.780

Your Answer