Do I need “A record” for AWS ELB while I set up CNAME

a-recordamazon-elbcname-record

I register the domain through GoDaddy. And now i have a AWS EC2 server behind a ELB.

I read the document from AWS about setting up the CNAME. which I did.

www    CNAME     elb.aws.address

while my A Record is pointing to my EC2's EIP ip address.

@      A         123.123.123.123

When I load the URL, it hits the domain directly, but not the ELB. Should I remove the A Record, and just leave the CNAME pointing to elb address?

Best Answer

That's up to you. Either way, the naked domain won't go to the ELB -- you can't use naked domains with ELBs unless you use Amazon's Route 53 service for your DNS and set up an alias. Because you can't set up a CNAME for a naked domain. Normal practice would be to have your server do a 301 redirect for example.com to www.example.com, and accept the lack of resilience in calls to example.com.

Related Topic