I'm told that I can't make the root of a domain (example.com) a CNAME - I have to specify an IP.

Given that you can't use an IP address to point at your Elastic Load Balancer, what's the best thing to do?

Currently I do this:

example.com - A record to elastic IP of first server- redirects to www.example.com

www.example.com CNAME to hostname of load balancer

If the first server is out of action, the redirect will fail.

Is there a better way to approach this?

3 Answers 3


your approach is probably the most sane one.

what you could do is Round Robin DNS your root record by just adding multiple A records for the example.com. domain and replicate the redirection code accross all your servers. this way its not so reliant on the first server.

if your redirect is a 301, virtually all users will cache the 301 so likely next time they view the site if they went via example.com there browser should (if they dont clear cache) auto redirect to www.example.com without even checking the servers and then go straight to your load balancer

  • We do exactly this. There is some hope the Amazon's DNS server will solve the redirect to www.domain problem, but until then this is the best way to do it.
    – kashani
    Mar 17, 2011 at 0:33

Looks like Amazon have now implemented a solution for this.

"Amazon Route 53 has integrated with Amazon EC2’s Elastic Load Balancing in order to easily let you map your root domain, or “zone apex” (e.g., mydomain.com, without the ‘www’), directly to your Load Balancer."



I have found that most domain registrars offer basic DNS tools with domain redirection (HTTP 301) and thus you should be able to set your root entry (e.g. example.com) as a redir to www.example.com or the like. This is all assuming that you are ok with the redir and don't need your site to respond to example.com. This would keep you from having to pay for another elastic IP as Amazon.

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.