What is a better approach for a webserver using EC2: to use its public DNS hostname as a CNAME record, or to attach an Elastic IP to it and use it with an A record? I suppose using the (elastic ip) A record is faster, but I seen a youtube tutorial where it's recommended to avoid using it, and to stick to public DNS hostname or to ELB. Is there any truth to that? If so, why?
Asked
Active
Viewed 686 times
1 Answers
1
I've been doing AWS for many years, got many of the qualifications, I've never seen a recommendation to use CNAME to the default public DNS. If you stop and start your server that domain name will likely change, which would need a DNS update and your site may appear to be down for some time due to DNS caching. There are probably other reasons it's a bad idea as well, mostly around lack of flexibility, but none come to mind right now.
I would always use an elastic IP and an A record for a single server, or Alias record to a load balancer in front of the EC2 server(s). The cost is zero or close to it and it gives you a flexible setup that I strongly most servers use.

Tim
- 31,888
- 7
- 52
- 78