I'm trying to point mydomain.eu to an AWS load balancer, which, by its nature, does not have a stable IP, so I think I'm supposed to point the A record to a subdomain at Amazon, but as far as I can tell the A record can only be an IP address, so I'm terribly confused at the moment.

What would the zone file look like for mydomain.eu where the A record and the www subdomain both point to, let's say, loadbalancer.mydomain.aws.com?

  • Can you clarify if you are using Route 53 as your DNS provider or your own external provider? – Brent Pabst Sep 4 '12 at 19:03

You can use an Alias record like described in http://aws.amazon.com/route53/faqs/:

Additionally, Route 53 offers ‘Alias’ records (a Route 53-specific virtual record). Alias records are used to map resource record sets in your hosted zone to Elastic Load Balancing instances. Alias records work like a CNAME record in that you can map one DNS name (mydomain.com) to another ‘target’ DNS name (elb1234.elb.amazonaws.com). They differ from a CNAME record in that they are not visible to resolvers. Resolvers only see the A record and the resulting IP address of the target record.

Next you can cname the domain like domain.com to www.domain.com using a CNAME(after you've pointed it using the Alias record), like:

www.domain.com CNAME TO domain.com

Also please note that in order to do this you'll need to move your zone to route53 so to do the Alias record. Most of the DNS providers unfortunately don't offer the ability to make such records for the domain name.

| improve this answer | |
  • This is the approach I ended up going with and it works perfectly. Thanks! :) – Elver Loho Sep 5 '12 at 20:04
  • What do you mean by "cname the domain like domain.com to www.domain.com using a CNAME". Is this domain management or Route 53? – S-K' May 10 '13 at 12:10
  • ALIAS is some made-up stuff, annoying – Randy L Aug 22 '18 at 20:20
  • Note: Route53 is the default choice in the AWS context, but some other DNS providers also offer ALIAS records as a feature now. – mschuett Jan 23 at 21:59

From the AWS info page on Elastic Load Balancing:

Traffic to the DNS name provided by the Elastic Load Balancer is automatically distributed across your load balanced, healthy Amazon EC2 instances.

So in essence, Amazon provides you with a DNS name to map your records to. This would be using a CNAME record as opposed to an A record. The DNS name of the load balancer should not change therefore you never have to deal with IPs which as you point out might change.


AWS has always supported direct CNAME links to subdomains and wildcard subdomains for a root domain with simply CNAME records. So essentially it looks something like:

www.mydomain.com -> my-aws-01-elb.aws.amazon.com

Then for your root level domain you have two options, either setup DNS forwarding with your DNS host provider so that mydomain.com -> www.mydomain.com or utilize Amazon's Route 53 service to host your entire DNS zone and let them manage and setup the required records to get root-level domain support.

If you don't need root domain level support and using a subdomain such as sub.mydomain.com or www.mydomain.com then you can use simple CNAME records for everything.

| improve this answer | |
  • If you are to use the zone name record, like you have zone abc.com, then a CNAME won't work and you will have to use and Alias record as stated in my answer in order to point abc.com to the ELB. – Logic Wreck Sep 4 '12 at 18:26
  • If you have a domainname that you need to point to the ELB, and it's similar to the zonename name, then you need to use an Alias record in order to point this domain to the ELB rather then a CNAME as a CNAME won't work in this case. – Logic Wreck Sep 4 '12 at 18:33
  • Actually he says the next: where the A record and the www subdomain both point to, let's say, loadbalancer.mydomain.aws.com - please check thus my update. if he'll want to point the domain itself he'll have to use the Alias record as stated. Also please note that most DNS providers don't allow CNAMEs for the domain name, only A records are allowed. – Logic Wreck Sep 4 '12 at 18:51
  • Well for instance godaddy doesn't and from what I've seen in my practice as a sysadmin a lot of people host their DNS zones there. – Logic Wreck Sep 4 '12 at 18:54
  • godaddy is hardly a gold standard… – MikeyB Sep 4 '12 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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