I've setup an elastic load balancer on EC2 which (for example) has the public DNS (A Record) of:


I've then registered a domain which I want to act as my public domain for the load balancer by configuring a CNAME record which points to the public DNS of the load balancer:

CNAME loadbalancer.domain.com -> LB-165746761.eu-west-1.elb.amazonaws.com

I then have a public website domain which I have setup a CNAME for to point to the host name of the loadbalancer:

CNAME www.mysite.com -> loadbalancer.domain.com

The example here has the public site being setup with a CNAME directly to the load balancer.

The reason for this chain is that we want to give our clients a single friendly DNS rather than the ELB generated one to set their domains up to point to (of which there are hundreds). We figure this wil also give us a single place to update should the public DNS of the ELB change (the CNAME record for loadbalancer.domain.com).

My question is whether it's firstly possible to chain CNAME records together like this, whether it's recommended and whether there are any down sides to doing this in the EC2 ELB environment?

  • 1
    I am planning to have the same set up soon. How did this go for you? How bad is the latency? Is it noticeable compared to connecting through the ELB URL?
    – stepanian
    Mar 5, 2012 at 5:12
  • I'm also very interested in an follow-up experience-- how is the latency? Thanks!
    – Acyra
    Mar 24, 2012 at 13:16

2 Answers 2


Yes it's possible to chain CNAME records but it's not always recommended. To prevent loops, servers usually have a limit on the number of times they'll restart a query. And since it's not common to have long chains of CNAMEs, the limit is typically pretty low, like 5-10, and most of this can be taken up by having to resolve NS records in delegations.

Your set-up is pretty much identical to the set-up we have here and it works fine.

  • +1 No idea if its the best solution, but it's also what we use and it works just fine. I'd be tempted to remove the middle record and just have 'CNAME www.mysite.com -> LB-165746761.eu-west-1.elb.amazonaws.com' if it doesn't cause too much pain Dec 14, 2011 at 17:03
  • @psatk - thanks. Out of interest did you use any tools or services to help diagnose issues with the DNS - I can't actually tell if my public website domain is reaching the load balancer at all, I just get a browser level "could not find www.mysite.com" error.
    – Mitul
    Dec 15, 2011 at 12:47
  • Didn't really have any issues with setting it up worked first time, you could run a trace route. To make it harder EC2s don't respond to ping requests, given this is now best part of month old I hope you have it sorted now.
    – psatek
    Jan 6, 2012 at 17:37
  • 1
    @psatek: You mentioned that this is the set up you are currently using. How bad is the latency? Is it really noticeable? I plan to have a similar set up soon.
    – stepanian
    Mar 5, 2012 at 5:13
  • 1
    It didn't add any noticeable latency.
    – psatek
    Mar 5, 2012 at 12:00

You can chain CNAME records... but remember that you'll end up with extra latency as your clients will have to do multiple lookups to find the end result.

  • How bad would the extra latency be? Do you have any information or references testing this? Thanks.
    – stepanian
    Mar 5, 2012 at 5:16
  • It largely depends on all the DNS servers involved... and connectivity from each client. There is no 100% way to test this as everyone in the world is connected via different internet providers across the globe.
    – TheCompWiz
    Mar 5, 2012 at 18:55
  • I understand. I was just thinking, maybe in a specific case, with everything else equal, the net effect can be measured. But I see why that would be highly variable. Thanks.
    – stepanian
    Mar 5, 2012 at 19:33

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.