AWS Cloud Architecture•Part 2: Networking, VPC & Traffic Routing (6 - 20)
Route 53 Alias Record vs CNAME Record.
In Simple Words:
- CNAME: Standard DNS alias pointing one domain name to another. Cannot be created for the root zone apex (e.g.,
example.com). - Alias Record: Route 53-specific record that can point the root zone apex (
example.com) directly to AWS resources (ALB, CloudFront, S3) with free internal DNS lookups.
hcl
# Alias record at the root zone apex (example.com -> CloudFront):
resource "aws_route53_record" "apex" {
zone_id = aws_route53_zone.primary.zone_id
name = "example.com"
type = "A"
alias {
name = aws_cloudfront_distribution.cdn.domain_name
zone_id = aws_cloudfront_distribution.cdn.hosted_zone_id
evaluate_target_health = false
}
}