Amazon Route 53 is AWS's managed DNS, domain registration, and health-checking service. It combines authoritative DNS hosting with traffic policies that let you route users based on geography, latency, weighted distribution, or the health of your endpoints.
Creating a public hosted zone, an alias record to a CloudFront distribution, and a failover record set with a health check via boto3:
import boto3
r53 = boto3.client("route53")
# 1) Create hosted zone (returns NS records to delegate from registrar)
zone = r53.create_hosted_zone(
Name="example.com",
CallerReference="example-2026-04-25",
HostedZoneConfig={"Comment": "Production zone", "PrivateZone": False},
)
zone_id = zone["HostedZone"]["Id"].split("/")[-1]
# 2) Alias record at the zone apex pointing to CloudFront
r53.change_resource_record_sets(
HostedZoneId=zone_id,
ChangeBatch={"Changes": [{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "example.com",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z2FDTNDATAQYW2", # CloudFront's fixed zone ID
"DNSName": "d111111abcdef8.cloudfront.net.",
"EvaluateTargetHealth": False,
},
},
}]},
)
# 3) Health check + failover record set
hc = r53.create_health_check(
CallerReference="api-primary-2026-04-25",
HealthCheckConfig={
"Type": "HTTPS",
"FullyQualifiedDomainName": "api-primary.example.com",
"Port": 443,
"ResourcePath": "/health",
"RequestInterval": 30,
"FailureThreshold": 3,
},
)["HealthCheck"]["Id"]
for set_id, target, hc_id in [
("primary", "api-primary.example.com.", hc),
("secondary", "api-dr.example.com.", None),
]:
rrset = {
"Name": "api.example.com",
"Type": "CNAME",
"SetIdentifier": set_id,
"Failover": "PRIMARY" if set_id == "primary" else "SECONDARY",
"TTL": 60,
"ResourceRecords": [{"Value": target}],
}
if hc_id:
rrset["HealthCheckId"] = hc_id
r53.change_resource_record_sets(
HostedZoneId=zone_id,
ChangeBatch={"Changes": [{"Action": "UPSERT",
"ResourceRecordSet": rrset}]},
)
CNAME is standard DNS — it can only exist on a non-apex name (you can't CNAME the zone apex like example.com) and queries are billed per-million. Alias is an AWS-specific virtual record stored in Route 53 that resolves to the current IPs of an AWS resource (ALB, CloudFront, API Gateway, S3 website endpoint, another Route 53 record). Aliases work at the apex and queries to AWS resources are free.
Use Latency-Based Routing: create a record for each region pointing to that region's endpoint, attach health checks. Route 53 returns the lowest-latency healthy region per client. Combine with weighted records inside each region for finer control. For runbook-driven failover (regulated environments), use Application Recovery Controller routing controls — explicit on/off switches independent of automated health.
Geolocation routes by the client's country or continent — discrete buckets. Geoproximity routes by the geographic distance between the client and an AWS region (or your custom location), with a "bias" factor that lets you expand or shrink a region's effective service area. Geoproximity requires Traffic Flow (an extra paid feature); Geolocation is part of standard Route 53.
Public hosted zones serve queries from anywhere on the internet. Private hosted zones are associated with one or more VPCs and resolve only from inside those VPCs — perfect for internal service discovery (db.internal.example.com) without exposing names publicly. You can have a public and private zone for the same domain ("split-horizon DNS") returning different answers internally vs. externally.
ELB health checks decide whether to send traffic to a target inside a load balancer's target group — fast, granular, AZ-aware. Route 53 health checks decide whether to return a record set in DNS responses — coarser, slower (TTL-bounded), runs from globally distributed checkers. Both can complement each other: ELB handles per-instance failover within a region; Route 53 handles cross-region failover via DNS.
Every VPC has a default DNS resolver at VPC_CIDR.2 (e.g., 10.0.0.2). Route 53 Resolver adds endpoints: outbound endpoints forward queries from VPC to on-prem DNS (so your apps can resolve corporate domains), inbound endpoints accept queries from on-prem to resolve VPC private hosted zones. This is the bridge for hybrid DNS in AWS-on-prem hybrid architectures.