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've setup an elastic load balancer on EC2 which (for example) has the public DNS (A Record) of:

LB-165746761.eu-west-1.elb.amazonaws.com

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?

share|improve this question
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 '12 at 5:12
    
I'm also very interested in an follow-up experience-- how is the latency? Thanks! –  Acyra Mar 24 '12 at 13:16
add comment

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
+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 –  James Butler Dec 14 '11 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 '11 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 '12 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 '12 at 5:13
1  
It didn't add any noticeable latency. –  psatek Mar 5 '12 at 12:00
show 2 more comments

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.

share|improve this answer
    
How bad would the extra latency be? Do you have any information or references testing this? Thanks. –  stepanian Mar 5 '12 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 '12 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 '12 at 19:33
add comment

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.