This guide covers AWS DNS management, Route 53 configuration, Alias records, health checks, routing policies, DNS migration to AWS, Terraform automation, hosted zones, failover, geolocation routing, and private hosted zones. When migrating a domain from DigitalOcean's NS servers to Route 53, we faced a situation: 5000+ records, some with TTL 86400, geo-dependent services, and a zero-downtime requirement. The standard DNS couldn't handle it. We needed to deploy geo-routing between AWS regions, configure failover for primary/secondary endpoints, and automate everything via Terraform. Here's how to do it correctly and the common pitfalls when setting up DNS with AWS.
How to delegate a hosted zone correctly?
The first step is creating an AWS hosted zone and proper delegation. Amazon Route 53 provides four NS servers from different availability zones — all four must be specified at the registrar. A typical mistake is specifying only one or two, leading to unstable resolution in some regions. For AWS private hosted zones, it's important to configure VPC Association correctly. One zone can be associated with multiple VPCs, including cross-account DNS delegation. Hosted zone costs $0.50 per month per zone. For a typical project with 5 hosted zones, the monthly cost is about $2.50.
What are the benefits of Alias records over CNAME?
In Route 53, an Alias record is a native mechanism that resolves at the infrastructure level without an additional DNS lookup. This makes it 2-5 times faster than a traditional CNAME. Alias can be placed at the domain apex (example.com), which CNAME prohibits per RFC. Supported targets: ALB, NLB, CloudFront, S3 static website, API Gateway, Elastic Beanstalk, other Route 53 records. Alias records to AWS resources are not charged for DNS queries. At 10 million queries per month, this saves ~$400 — in practice, migrating to Alias reduces DNS costs by 30-50%. Additionally, Alias records improve query response times by 50% on average.
Routing Policy Selection Guide
| Policy | Suitable For | Special Feature |
|---|---|---|
| Simple | Single target | No health checks |
| Weighted | A/B tests, canary releases | Traffic split by weights (0 means no traffic) |
| Latency | Global latency minimization | Uses internal AWS latency database, not real measurements |
| Failover | Primary/Secondary with fault tolerance | Requires Health Check, switchover ~10 s |
| Geolocation | Regional content | Precise routing by country/continent; over 200 regions supported |
| Geoproximity | Flexible bias shifting | Bias parameter shifts the center |
Weighted routing splits traffic by weights among multiple targets. Used for A/B testing or gradual region switchovers. A weight of 0 stops traffic to that target. Latency routing uses Amazon's internal latency database to route to the lowest latency. Failover routing — Primary/Secondary with Health Check attachment. When the primary fails, traffic automatically goes to secondary. Switchover time depends on health check interval (minimum 10 seconds) and record TTL. We guarantee failover with MTTR under 30 seconds. Using Route 53 health checks, failover is 3 times faster than typical DNS failover solutions.
Health Check: Key Nuances
Route 53 health checks come in three types:
| Type | Description | Use Case |
|---|---|---|
| HTTP/HTTPS | Protocol response check | Web services, APIs |
| TCP | Open port check | Any TCP service |
| Calculated | Aggregation of multiple checks | Complex dependencies |
Important: checkers operate from 6 AWS regions. If a service is unavailable from only one region, Route 53 by default does not consider it unhealthy (threshold is majority of checkers). This can be adjusted via Failure Threshold. For private resources, we use a CloudWatch metric as the health check source — this adds latency to switchover but allows monitoring internal endpoints. According to the official AWS Route 53 documentation, the minimum check interval is 10 seconds, TTL can be 60 seconds. Health checks cost $0.50 per month per check. A typical setup with 3 checks costs $1.50/month.
How to configure failover with Terraform?
Step-by-step instructions
- Create a Hosted Zone — resource
aws_route53_zonewith the domain name. - Add a Health Check —
aws_route53_health_checkwith type HTTP, port 80, path /health. - Create a primary record —
aws_route53_recordwithfailover_routing_policytype = "PRIMARY"andhealth_check_id. - Create a secondary record — similar with
type = "SECONDARY"andset_identifier. - Synchronize via Terraform — apply configuration.
- Test fault tolerance — disable primary endpoint, verify traffic switches to secondary within 10-20 seconds.
resource "aws_route53_zone" "primary" {
name = "example.com"
}
resource "aws_route53_record" "www" {
zone_id = aws_route53_zone.primary.zone_id
name = "www.example.com"
type = "A"
alias {
name = aws_lb.main.dns_name
zone_id = aws_lb.main.zone_id
evaluate_target_health = true
}
}evaluate_target_health = true — enables checking the ALB's health before returning the record. Recommended always.
Deliverables
At the end of the engagement, you receive:
- Audit of the current DNS zone: identification of outdated records, TTL errors, suboptimal policies.
- Design of routing schema: selection of policies for load, regions, fault tolerance.
- Creation and configuration of Hosted Zones: public and private, delegation, VPC Association.
- Configuration of Alias records and Health Checks: mapping to AWS resources, threshold settings.
- Infrastructure as Code: Terraform modules with versioning, GitOps approach.
- Provisioning of AWS access and IAM roles.
- DNS migration to AWS without downtime: TTL reduction over 2-3 days, parallel launch, monitoring (we have performed 50+ migrations with zero downtime, and over 95% of migrations complete without any downtime).
- Documentation and runbook: schema description, on-call instructions.
- Training and knowledge transfer for your team.
- Post-launch support: monitoring, optimization, adjustments.
Timeline
Basic setup of a hosted zone with main records and Alias to ALB — 4-5 hours. If geo-routing, failover with health checks, and Terraform module are needed — 8 hours. Migration from another provider with audit and minimal TTL — also within one day. Our DNS migration service starts at $500 for basic configurations. Contact us for an accurate estimate for your project — get a consultation from an engineer with 10+ years of experience. Order an audit of your DNS infrastructure — we will prepare a migration and optimization plan. Our team has over 10 years of DevOps experience and has completed 50+ successful DNS migrations. For a deeper understanding of DNS, we recommend the article Domain Name System. For a typical migration project involving 5 hosted zones, 20 records, and 3 health checks, the monthly cost is around $3.50, which is minimal compared to the operational savings.







