Home/Engineer/Cloud/AWS Route 53: Configuring DN…
CloudIntermediatelinuxawsroute53dns

AWS Route 53: Configuring DNS Records, Routing Policies, and Health-Check Failover

Covers Route 53 hosted zones and record types, plus simple, weighted, latency, failover, and geolocation routing policies with health checks. A practical guide to managing records with the AWS CLI and configuring failover and traffic distri

Contents
  1. What Is AWS Route 53?
  2. Core Components
  3. Creating a Hosted Zone
  4. Record Types
  5. Changing Records with the CLI
  6. Health Checks
  7. Routing Policies
  8. TTL Design Tips
  9. Summary

What Is AWS Route 53?

Route 53 is AWS’s managed DNS service. On top of standard DNS that maps domain names to IPs or AWS resources, it provides traffic routing policies and health-check-based failover. The “53” in the name comes from the UDP/TCP port number used by DNS.

This guide focuses on operating DNS in an AWS environment. Separate from looking up records with dig on the client or configuring Cloudflare DNS, it covers how to design and configure Route 53’s routing policies and health checks.


Core Components

ComponentDescription
Hosted ZoneA collection of records for one domain (e.g., example.com)
Public hosted zoneDNS exposed to the internet
Private hosted zoneDNS resolved only inside a specific VPC
RecordActual DNS entries such as A, AAAA, CNAME, MX
Alias recordRoute 53-specific record that points to AWS resources (ELB, CloudFront, S3, etc.)
Health checkPeriodically checks endpoint health
Routing policyDetermines which response to return among multiple records with the same name

Creating a Hosted Zone

Bash
#
aws route53 create-hosted-zone \
  --name example.com \
  --caller-reference "$(date +%s)"

Once created, Route 53 assigns four name servers (NS). You must update the NS records at your domain registrar to these values to complete delegation.

Bash
# check
aws route53 get-hosted-zone --id Z123456ABCDEFG \
  --query 'DelegationSet.NameServers'

Record Types

TypePurpose
ADomain → IPv4
AAAADomain → IPv6
CNAMEDomain → another domain (alias). Not allowed at the zone apex
AliasPoints to an AWS resource. Allowed at the apex; no query charges
MXMail servers
TXTText such as SPF and domain verification
NSDelegation of a subdomain
SRVService location

You cannot use a CNAME to point the root domain (example.com) at an ELB or CloudFront. Use a Route 53 Alias record instead: it can target AWS resources even at the zone apex, with no extra query charges.


Changing Records with the CLI

Record changes in Route 53 are submitted as a JSON change batch to change-resource-record-sets.

Bash
# change-batch.json
cat > change-batch.json <<'JSON'
{
 "Comment": " A ",
  "Changes": [
    {
      "Action": "UPSERT",
      "ResourceRecordSet": {
        "Name": "www.example.com",
        "Type": "A",
        "TTL": 300,
        "ResourceRecords": [{ "Value": "203.0.113.10" }]
      }
    }
  ]
}
JSON

aws route53 change-resource-record-sets \
  --hosted-zone-id Z123456ABCDEFG \
  --change-batch file://change-batch.json

Action supports CREATE, DELETE, and UPSERT (update if present, create if not). UPSERT is the safest choice for idempotency.


Health Checks

Some routing policies work together with health checks. A record is included in responses only while its endpoint is healthy.

Bash
aws route53 create-health-check \
  --caller-reference "$(date +%s)" \
  --health-check-config '{
    "Type": "HTTPS",
    "FullyQualifiedDomainName": "www.example.com",
    "Port": 443,
    "ResourcePath": "/health",
    "RequestInterval": 30,
    "FailureThreshold": 3
  }'
SettingMeaning
TypeHTTP / HTTPS / TCP / string matching, etc.
ResourcePathPath to check (e.g., /health)
RequestIntervalCheck interval in seconds. 10 or 30
FailureThresholdMark unhealthy after N consecutive failures

Health checks run from many locations worldwide. Allow Route 53 health checker IP ranges and the check path (/health) in your firewall/security groups, or the endpoint will never be considered healthy.


Routing Policies

These rules decide which answer to return when multiple records share the same name and type. This is the core of Route 53.

1) Simple

The default. You set values on a single record and Route 53 returns them as-is. If there are multiple values, they are shuffled at random (no routing control).

2) Weighted

Distributes traffic across endpoints by ratio. Well suited to A/B tests and gradual (canary) rollouts.

JSON
{
  "Action": "UPSERT",
  "ResourceRecordSet": {
    "Name": "app.example.com", "Type": "A", "TTL": 60,
    "SetIdentifier": "v2-canary",
    "Weight": 10,
    "ResourceRecords": [{ "Value": "203.0.113.20" }]
  }
}

A record with Weight 90 and another with 10 split traffic roughly 9:1. Use SetIdentifier to distinguish records that share the same name.

3) Latency

When resources exist in multiple AWS regions, Route 53 sends users to the region with the lowest latency. Set the Region property.

JSON
{
  "Name": "api.example.com", "Type": "A", "TTL": 60,
  "SetIdentifier": "seoul",
  "Region": "ap-northeast-2",
  "ResourceRecords": [{ "Value": "203.0.113.30" }]
}

4) Failover

You define Primary and Secondary records. Route 53 answers with Primary while the health check is healthy, and with Secondary when it is not. Use this for active-standby.

JSON
{
  "Name": "www.example.com", "Type": "A", "TTL": 60,
  "SetIdentifier": "primary",
  "Failover": "PRIMARY",
  "HealthCheckId": "abcd-1234-health",
  "ResourceRecords": [{ "Value": "203.0.113.10" }]
}

The Primary failover record must have a health check attached. Without one, Route 53 always treats Primary as healthy and never fails over to Secondary.

5) Geolocation

Returns different answers based on the user’s location (continent/country/region). Used for content localization and regulatory compliance.

JSON
{
  "Name": "www.example.com", "Type": "A", "TTL": 60,
  "SetIdentifier": "korea",
  "GeoLocation": { "CountryCode": "KR" },
  "ResourceRecords": [{ "Value": "203.0.113.40" }]
}

When using Geolocation, always create a default record ("CountryCode": "*") for users who match no region. Otherwise unmatched users get no answer.

Policy Comparison

PolicyDecision basisHealth checkTypical use
SimpleNoneOptionalSingle endpoint
WeightedWeight ratioOptionalA/B, canary deploys
LatencyLowest-latency regionOptionalMulti-region performance
FailoverPrimary healthRequiredActive-standby
GeolocationUser locationOptionalLocalization and compliance
GeoproximityLocation + biasOptionalFine-tuning regional traffic
MultivalueRandom healthy recordsOptionalSimple distribution plus health

TTL Design Tips

SituationRecommended TTL
Records that rarely change3600 seconds or more
Frequent changes (Failover / Weighted, etc.)Around 60 seconds
Just before a migrationLower in advance (e.g., 60 seconds)

Alias records do not let you set TTL yourself. They inherit the TTL of the target AWS resource.


Summary

TopicKey point
Hosted zonePer-domain record set, public or private
AliasPoint to AWS resources at the zone apex, no query charges
Record changeschange-resource-record-sets + UPSERT
Health checkPath, interval, and threshold; required for Failover
WeightedRatio-based distribution (canary/A/B)
LatencyChoose the lowest-latency region
FailoverFailover based on Primary health checks
GeolocationLocation-based routing; a default (*) record is required

Route 53’s real value is not plain DNS but the combination of routing policies and health checks. For multi-region services, combine Latency and Failover; for gradual rollouts, use Weighted—raising both availability and user experience.

#aws#route53#dns#routing-policy#health-check
Editorial note

AI tools may assist drafting. Check the evidence in each guide for whether commands were run and which environment was used. Confirm the current docs for your version before applying instructions, and email us about errors. email us

Topic-related official docs (auto-linked · not per-claim sources)AWS documentation ↗

Questions & answers

Ask a question about this guide. We'll review and reply.