Why can't you put a CNAME at the zone apex, and what do you use instead?
BeginnerScenarioDNS & Service Discovery
Answer
Situation read → The apex (example.com) must hold SOA and NS records, and a CNAME cannot coexist with other records.
What I'd do →
- Use a Route 53 ALIAS record to the ALB or CloudFront distribution for
example.com - Other providers call it ANAME or CNAME flattening
- Or use A records pointing to static IPs
- Verify with
dig example.com A +shortand confirm it returns IPs
Why → ALIAS is resolved by the DNS provider at query time and returned as plain A records, so it is valid at the apex.
Interview tip → Add that Route 53 ALIAS queries to AWS resources are free.
More on DNS & Service Discovery
A customer types www.example.com in a browser. Walk through how DNS resolves it.BeginnerWhat is the difference between an A record and a CNAME, and when do you use each?BeginnerYou are moving a site to a new server. What do you do with DNS to make the cutover smooth?BeginnerHow do you find which nameservers are authoritative for a domain and query them directly?BeginnerWhat DNS records do you set up for company email?BeginnerWhen do you use /etc/hosts and when DNS?Beginner