Interview Prep/Real-World Interview/DNS, TLS and certificates

Route 53 rejects your change with "RRSet of type CNAME with DNS name example.com. is not permitted at apex in zone example.com."

BeginnerTroubleshootingDNS, TLS and certificates
Answer

Likely causes → DNS rules forbid a CNAME at the zone apex, because the apex must also carry SOA and NS records and a CNAME can't coexist with other records.

Diagnose → You're trying to point example.com at a hostname like an ALB or CloudFront distribution (my-alb-123.ap-south-1.elb.amazonaws.com).

Fix → Use a Route 53 ALIAS A/AAAA record that targets the ALB or CloudFront distribution:

resource "aws_route53_record" "apex" {
  zone_id = var.zone_id
  name    = "example.com"
  type    = "A"
  alias {
    name                   = aws_lb.app.dns_name
    zone_id                = aws_lb.app.zone_id
    evaluate_target_health = true
  }
}

Other providers have equivalents (Cloudflare CNAME flattening, ANAME).

Prevent → Standardise on ALIAS records for anything that points at AWS-managed endpoints, apex or not.

All Real-World Interview questions Roadmap: Interview readiness

More on DNS, TLS and certificates