Automation, operations and troubleshooting
Moving records around
aws route53 list-resource-record-sets --hosted-zone-id Z0ABC > zone.json # export
# transform to a change batch, then:
aws route53 change-resource-record-sets --hosted-zone-id Z0NEW --change-batch file://changes.json
Or import existing zones into Terraform (terraform import aws_route53_record.x Z0ABC_app.example.com_A) and manage them as code. For migrating a domain's DNS into Route 53 with no downtime: recreate all records, verify against the new name servers, lower TTLs, then switch NS at the registrar.
Testing DNS failover
Simulate an endpoint failure (stop the target, block the health checker), watch the health check status flip in Route 53/CloudWatch, query the record from several resolvers, and measure how long real clients take to switch relative to TTL.
"Instance can't resolve a private zone name" checklist
- Is the private hosted zone associated with this VPC (correct region/account)?
- Are enableDnsSupport and enableDnsHostnames true on the VPC?
- Is the instance using the Amazon-provided resolver (check
/etc/resolv.conf, the DHCP options set)? If it uses a custom DNS server, does that server forward to the VPC resolver? - Does the record exist in the zone with the exact name? Is a more specific private zone shadowing it? Is the name only in the public zone (no fallback)?
- Negative caching: did someone query before creating it?
- For pods: does CoreDNS forward to the VPC resolver? For Lambda: is it attached to the VPC?
- For on-prem clients: conditional forwarder → inbound endpoint IPs, endpoint security group allows UDP/TCP 53, routing over VPN/DX.
"Internal name accidentally exposed publicly"
Move the record into a private hosted zone, delete it from the public zone, check what it revealed (internal IPs, hostnames) and whether those services are reachable from outside, and add a guardrail (policy checks on Terraform, External DNS zone filters).