Skip to Content
Cloud Engineering Academy
2. AWS Networking & Infrastructure

DNS and Route 53

Run public and private DNS on AWS with Route 53: hosted zones, alias records, all eight routing policies, health checks and failover — and shift traffic between two versions of an API with a C# tool.

intermediate⏱ 1 h 30 min🟡 Low costSAA-C03SOA-C03SCS-C03

Assumes: AWS CLI v2 · AWS SDK for .NET v4 (AWSSDK.Route53 4.1.1.2) · .NET 10 LTS · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.

Learning objectives

By the end of this lesson you can:

  • Explain public and private hosted zones, how a VPC resolves names, and what split-horizon DNS is.
  • Choose the right record type, including alias records, and explain why alias beats CNAME for AWS resources.
  • Pick the right routing policy — simple, weighted, latency, failover, geolocation, geoproximity, IP-based, multivalue — for a scenario.
  • Configure health checks, including for private resources that Route 53's health checkers cannot reach.
  • Create a private hosted zone with the CLI, CDK and Terraform, and run a C# tool that shifts weighted traffic safely.

Prerequisites

  • Networking refresher — how DNS resolution works, TTLs and record types.
  • VPC fundamentals — the Amazon DNS resolver at VPC base + 2 and the enableDnsSupport/enableDnsHostnames attributes.
  • Tools: AWS CLI v2 (learn-sandbox), .NET 10 SDK.

Why this matters in banking

DNS is in the critical path of every banking transaction. The mobile app resolves api.harbourline.example before it can authenticate; the payments service resolves the database endpoint before it can post a transaction; the core banking adaptor resolves on-premises names over a VPN. When DNS is wrong, everything looks broken at once.

DNS is also a resilience tool. Failover records, health checks and short TTLs are how many banks move customer traffic from a failing Region to a standby one — and regulators (for example, the UK's operational resilience rules for important business services) expect you to have tested that path. And DNS is a security surface: hijacked records, dangling CNAMEs pointing at deleted resources, and DNS used as an exfiltration channel are all real incident types.

Harbourline uses Route 53 for its public domains, private zones for internal service names in every VPC, failover between eu-west-2 and eu-west-1 for customer-facing APIs, and weighted records for gradual rollouts. This lesson covers all of it.

The idea in plain language

DNS translates names (api.harbourline.example) into addresses (203.0.113.10). Amazon Route 53 is AWS's DNS service. It does four jobs:

  1. Domain registration — buying and renewing domain names.
  2. Authoritative DNS — answering "what is the address of X?" for zones you own, in hosted zones.
  3. Health checking and traffic routing — answering differently depending on health, location, latency or weights.
  4. Resolution inside VPCs — the Route 53 Resolver at VPC base + 2 answers queries from your resources, including for private zones and, with endpoints and rules, for on-premises names.

Analogy: Route 53 is the bank's switchboard. The public hosted zone is the number printed on the website: anyone can call it. The private hosted zone is the internal extension list: it only works from phones inside the building (associated VPCs). Routing policies are the switchboard operator's rules — "send callers to the nearest branch", "send 10% of calls to the new team", "if the London office doesn't answer, put callers through to Dublin". Health checks are the operator ringing each office every 30 seconds to make sure someone picks up.

Hosted zones

Public hosted zonePrivate hosted zone
Answers queries fromThe internetOnly VPCs associated with the zone (any Region, any account with authorization)
Typical namesharbourline.example, api.harbourline.examplepayments.internal.harbourline.example, db.learn.internal
NeedsName server (NS) delegation at the registrarVPC attributes enableDnsSupport and enableDnsHostnames = true
PriceUSD 0.50 per zone per month (first 25), USD 0.10 after; free if deleted within 12 hoursSame zone price

Split-horizon DNS: a public zone and a private zone can have the same name. Inside associated VPCs, the private zone wins; everyone else sees the public one. Harbourline uses this so api.harbourline.example resolves to an internal load balancer for staff and services in the VPC, and to the public edge for customers.

Record types you will use

TypeHoldsNotes
A / AAAAIPv4 / IPv6 address
CNAMEAnother nameNot allowed at the zone apex (harbourline.example itself)
Alias (Route 53 extension)A pointer to an AWS resource: ELB, CloudFront, API Gateway, S3 website, another record in the zone…Works at the apex; queries to alias records for AWS resources are free; follows the target's IP changes automatically
MX, TXT, CAA, SRVMail, verification, certificate authority restrictions, servicesCAA limits which CAs may issue certificates for your domain — a cheap security win
NS, SOADelegation and zone metadataCreated with the zone

The eight routing policies

PolicyAnswers with…Private zonesBanking use
SimpleOne record's value(s)YesMost internal names
WeightedRecords in proportion to weights (e.g. 90/10)YesCanary and blue/green releases
LatencyThe Region with lowest latency for the resolverYesMulti-Region active-active APIs
FailoverPrimary while healthy, otherwise secondaryYesActive-passive DR between Regions
GeolocationBy the user's continent/country/subdivisionYesEU customers to the EU subsidiary's stack (data residency)
GeoproximityBy distance to resources, adjustable with a biasYesGradually shifting load between Regions
IP-basedBy the client's source IP ranges (CIDR collections)No (public zones only)Routing a partner's or ISP's ranges to a specific endpoint
Multivalue answerUp to eight healthy records, chosen at randomYesSimple client-side load spreading with health checks

Policies can be nested with alias records: for example a failover record whose primary is a latency record set.

Health checks

Route 53 health checkers run from many locations on the internet. Three kinds:

  • Endpoint — HTTP, HTTPS or TCP to an IP or domain name, optionally matching a string in the response.
  • Calculated — combines other health checks ("healthy if at least 2 of 3 are healthy").
  • CloudWatch alarm — healthy while an alarm is OK. This is how you health-check private resources the internet can't reach: alarm on an internal metric (ALB HealthyHostCount, a synthetic canary) and attach the health check to the record.

For alias records pointing at a load balancer, set Evaluate target health = Yes instead of creating a separate health check: Route 53 then uses the load balancer's own target health.

Prices (checked 2026-11-18): basic health check USD 0.50 per month for AWS endpoints, USD 0.75 for non-AWS; optional features (HTTPS, string matching, fast interval, latency measurement) add USD 1.00 / USD 2.00 each per month.

Resolution inside a VPC

Resources in a VPC send DNS queries to the Route 53 Resolver (VPC base + 2, or 169.254.169.253). The Resolver answers, in order of specificity: Resolver forwarding rules (to on-premises DNS, covered in this module's hybrid connectivity lesson), private hosted zones associated with the VPC, VPC-internal names (ip-10-20-64-15.ec2.internal) and finally public DNS. Each network interface can send at most 1,024 packets per second to the Resolver — cache DNS answers in busy services.

What problem Route 53 solves

  • Highly available authoritative DNS with a 100% availability SLA ⚠ VERIFY current SLA wording, anycast name servers, and no servers for you to run.
  • Traffic management — health-aware, latency-aware and weighted answers, which are the backbone of multi-Region designs.
  • Private naming for services across VPCs and accounts, without running your own DNS servers.

Sharp edges:

  • DNS failover is only as fast as TTLs and client caches. A 300-second TTL means some clients keep using the old answer for five minutes or more; some client libraries and JVMs cache far longer. .NET's HttpClient keeps connections open — set SocketsHttpHandler.PooledConnectionLifetime (for example 1–5 minutes) so new DNS answers are actually used.
  • Health checks can't reach private IPs — use CloudWatch-alarm-based checks.
  • Dangling records (a CNAME or alias to a deleted resource) can let someone else claim the target name — a known subdomain-takeover pattern. Delete records with their resources.
  • Private hosted zones need the VPC DNS attributes; otherwise they silently don't resolve.
  • Route 53 is a global service whose control plane is in us-east-1. For failover, rely on the data plane (health checks flipping answers), not on making API changes during an incident. Route 53 Application Recovery Controller adds highly available routing controls for that purpose.

Microsoft / Azure comparison

You know (Microsoft/Azure)AWS equivalentWhat's different
Azure DNS (public zones)Route 53 public hosted zoneRoute 53 also registers domains and has alias records
Azure Private DNS zones + VNet linksRoute 53 private hosted zone + VPC associationsCross-account association needs an authorization step
Azure Traffic Manager (priority, weighted, performance, geographic, multivalue, subnet)Route 53 routing policies (failover, weighted, latency, geolocation/geoproximity, multivalue, IP-based)Built into the DNS service, not a separate product
Traffic Manager endpoint monitoringRoute 53 health checksRoute 53 adds calculated and CloudWatch-alarm checks
Alias record sets (to Azure resources)Alias recordsBoth work at the apex; Route 53 alias queries to AWS resources are free
Azure DNS Private Resolver (inbound/outbound endpoints, forwarding rulesets)Route 53 Resolver endpoints and rulesVery similar model
Azure Firewall DNS proxy / DNS filteringRoute 53 Resolver DNS FirewallDomain allow/deny lists on the VPC resolver

Architecture

Security-boundary view: the public zone is part of the internet-facing attack surface — protect it with IAM (few people may change records), DNSSEC signing, CAA records, and change monitoring through CloudTrail. The private zone is visible only to associated VPCs, so internal topology (database endpoints, internal service names) is not published to the internet. The VPC Resolver is a natural control point: Resolver query logging records every name looked up, and DNS Firewall can block known-bad or unexpected domains.

Step-by-step implementation

Create a private hosted zone associated with the lab VPC

learn.internal.harbourline.example, associated with hl-m02-vpc in us-east-1. Check the VPC's DNS attributes are on. Delete it within 12 hours and it is not charged.

Add simple records

db.learn.internal.harbourline.example → CNAME to an RDS endpoint (or any name, for practice); app.… → A record with a private IP.

Add a weighted pair for a canary

ledger.learn.internal.harbourline.example with two CNAME records: SetIdentifier=blue, Weight=100 → blue.…; SetIdentifier=green, Weight=0 → green.…. A weight of 0 means "never, unless all others are 0".

Shift traffic with the C# tool

Run the weight shifter to move to 90/10, then 50/50, then 0/100, waiting for INSYNC each time.

Design (on paper) the public failover record

Primary: alias to the eu-west-2 ALB, evaluate target health. Secondary: alias to the eu-west-1 ALB. Decide the TTL and what monitors the secondary.

AWS Console instructions

  • Route 53 → Hosted zones → Create hosted zone. Domain learn.internal.harbourline.example; Type: Private hosted zone; VPCs to associate: Region us-east-1, hl-m02-vpc; tags → Create.
  • In the zone → Create record → record name ledger; type CNAME; value blue.learn.internal.harbourline.example; TTL 60; Routing policy: Weighted; Weight 100; Record ID blue → Add another record for green with weight 0 → Create records.
  • Route 53 → Health checks → Create health check → State of CloudWatch alarm to monitor a private resource, or Endpoint for a public one.
  • Route 53 → Resolver → Query logging to log VPC DNS queries to CloudWatch Logs or S3.
  • To check a VPC's DNS attributes: VPC → Your VPCs → select → Details: DNS resolution and DNS hostnames both Enabled.

AWS CLI

$p = "--profile", "learn-sandbox", "--region", "us-east-1"
$vpcId = aws ec2 describe-vpcs --filters Name=tag:Name,Values=hl-m02-vpc @p --query "Vpcs[0].VpcId" --output text

# Private hosted zone (associating a VPC at creation makes it private)
$zoneId = aws route53 create-hosted-zone --name learn.internal.harbourline.example `
  --vpc VPCRegion=us-east-1,VPCId=$vpcId --caller-reference "hl-m02-$(Get-Date -Format yyyyMMddHHmmss)" `
  --hosted-zone-config Comment="Module 2 lab",PrivateZone=true @p `
  --query "HostedZone.Id" --output text
$zoneId = $zoneId -replace "/hostedzone/", ""
aws route53 change-tags-for-resource --resource-type hostedzone --resource-id $zoneId `
  --add-tags Key=Project,Value=cea-lab Key=Lab,Value=m02-secure-vpc Key=Environment,Value=learn Key=Owner,Value=alex @p

# Simple A record and a weighted pair, in one atomic change batch
$batch = @"
{
  "Comment": "Lab records",
  "Changes": [
    { "Action": "UPSERT", "ResourceRecordSet": { "Name": "app.learn.internal.harbourline.example", "Type": "A", "TTL": 60,
      "ResourceRecords": [ { "Value": "10.20.64.10" } ] } },
    { "Action": "UPSERT", "ResourceRecordSet": { "Name": "ledger.learn.internal.harbourline.example", "Type": "CNAME", "TTL": 60,
      "SetIdentifier": "blue", "Weight": 100, "ResourceRecords": [ { "Value": "blue.learn.internal.harbourline.example" } ] } },
    { "Action": "UPSERT", "ResourceRecordSet": { "Name": "ledger.learn.internal.harbourline.example", "Type": "CNAME", "TTL": 60,
      "SetIdentifier": "green", "Weight": 0, "ResourceRecords": [ { "Value": "green.learn.internal.harbourline.example" } ] } }
  ]
}
"@
$batch | Out-File -Encoding ascii records.json
$changeId = aws route53 change-resource-record-sets --hosted-zone-id $zoneId --change-batch file://records.json @p --query "ChangeInfo.Id" --output text
aws route53 wait resource-record-sets-changed --id $changeId @p

# List records
aws route53 list-resource-record-sets --hosted-zone-id $zoneId @p `
  --query "ResourceRecordSets[].[Name,Type,SetIdentifier,Weight,TTL]" --output table

# Ask Route 53 what it would answer (works for private zones too, without being inside the VPC)
aws route53 test-dns-answer --hosted-zone-id $zoneId --record-name ledger.learn.internal.harbourline.example --record-type CNAME @p

# Confirm the VPC DNS attributes private zones depend on
aws ec2 describe-vpc-attribute --vpc-id $vpcId --attribute enableDnsSupport @p
aws ec2 describe-vpc-attribute --vpc-id $vpcId --attribute enableDnsHostnames @p

test-dns-answer is the quickest way to debug routing policies: it shows the answer Route 53 would give, optionally for a given resolver IP or EDNS client subnet.

Infrastructure as Code

DnsStack.cs
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.Route53;
using Constructs;

namespace Harbourline.Networking.Examples;

public sealed class DnsStack : Stack
{
    public DnsStack(Construct scope, string id, IVpc vpc, IStackProps? props = null) : base(scope, id, props)
    {
        var zone = new PrivateHostedZone(this, "LearnZone", new PrivateHostedZoneProps
        {
            ZoneName = "learn.internal.harbourline.example",
            Vpc = vpc,
            Comment = "Module 2 lab",
        });

        _ = new ARecord(this, "App", new ARecordProps
        {
            Zone = zone,
            RecordName = "app",
            Target = RecordTarget.FromIpAddresses("10.20.64.10"),
            Ttl = Duration.Seconds(60),
        });

        // Weighted pair: L2 record props accept Weight + SetIdentifier in recent CDK v2 releases.
        _ = new CnameRecord(this, "LedgerBlue", new CnameRecordProps
        {
            Zone = zone,
            RecordName = "ledger",
            DomainName = "blue.learn.internal.harbourline.example",
            Weight = 100,
            SetIdentifier = "blue",
            Ttl = Duration.Seconds(60),
        });
        _ = new CnameRecord(this, "LedgerGreen", new CnameRecordProps
        {
            Zone = zone,
            RecordName = "ledger",
            DomainName = "green.learn.internal.harbourline.example",
            Weight = 0,
            SetIdentifier = "green",
            Ttl = Duration.Seconds(60),
        });

        Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
        Amazon.CDK.Tags.Of(this).Add("Lab", "m02-secure-vpc");
        Amazon.CDK.Tags.Of(this).Add("Environment", "learn");
    }
}

For alias records to a load balancer, use RecordTarget.FromAlias(new LoadBalancerTarget(alb)) from Amazon.CDK.AWS.Route53.Targets.

Complete code

A weight shifter for canary releases. It reads the current weighted records for a name, validates the requested weights, UPSERTs them in one atomic change batch, and waits until Route 53 reports INSYNC on all its name servers.

WeightShift.csproj
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="AWSSDK.Route53" Version="4.1.1.2" />
    <PackageReference Include="AWSSDK.SSO" Version="4.1.0.2" />
    <PackageReference Include="AWSSDK.SSOOIDC" Version="4.1.0.2" />
  </ItemGroup>
</Project>
Program.cs
using Amazon;
using Amazon.Route53;
using Amazon.Route53.Model;

// Usage: dotnet run -- <hosted-zone-id> <record-name> blue=90 green=10
if (args.Length < 3)
{
    Console.Error.WriteLine("Usage: WeightShift <zone-id> <record-name> <setId=weight> [<setId=weight> ...]");
    return 2;
}

var zoneId = args[0];
var recordName = args[1].TrimEnd('.') + ".";
var requested = new Dictionary<string, long>(StringComparer.Ordinal);
foreach (var pair in args.Skip(2))
{
    var parts = pair.Split('=', 2);
    if (parts.Length != 2 || !long.TryParse(parts[1], out var w) || w is < 0 or > 255)
    {
        Console.Error.WriteLine($"Invalid weight '{pair}': use setId=0..255");
        return 2;
    }

    requested[parts[0]] = w;
}

if (requested.Values.All(w => w == 0))
{
    Console.Error.WriteLine("Refusing: all weights 0 makes Route 53 treat every record as equal weight.");
    return 2;
}

// Route 53 is a global service; the SDK signs for us-east-1.
using var route53 = new AmazonRoute53Client(RegionEndpoint.USEast1);

// 1. Load the existing weighted records for this name (all types share the name, so filter).
var existing = new List<ResourceRecordSet>();
var list = await route53.ListResourceRecordSetsAsync(new ListResourceRecordSetsRequest
{
    HostedZoneId = zoneId,
    StartRecordName = recordName,
});
existing.AddRange((list.ResourceRecordSets ?? [])
    .Where(r => r.Name == recordName && r.SetIdentifier is not null && r.Weight is not null));

if (existing.Count == 0)
{
    Console.Error.WriteLine($"No weighted records found for {recordName} (results are limited to the first page).");
    return 1;
}

var unknown = requested.Keys.Except(existing.Select(r => r.SetIdentifier!)).ToList();
if (unknown.Count > 0)
{
    Console.Error.WriteLine($"Unknown set identifier(s): {string.Join(", ", unknown)}");
    return 1;
}

// 2. Build one atomic change batch: every requested record is UPSERTed with its new weight.
var changes = new List<Change>();
foreach (var record in existing.Where(r => requested.ContainsKey(r.SetIdentifier!)))
{
    Console.WriteLine($"{record.SetIdentifier,-10} {record.Weight,4} -> {requested[record.SetIdentifier!],4}");
    record.Weight = requested[record.SetIdentifier!];
    changes.Add(new Change { Action = ChangeAction.UPSERT, ResourceRecordSet = record });
}

var total = existing.Sum(r => r.Weight ?? 0);
foreach (var record in existing)
{
    Console.WriteLine($"  {record.SetIdentifier}: {100.0 * (record.Weight ?? 0) / total:N1}% of answers");
}

var response = await route53.ChangeResourceRecordSetsAsync(new ChangeResourceRecordSetsRequest
{
    HostedZoneId = zoneId,
    ChangeBatch = new ChangeBatch
    {
        Comment = $"Weight shift {string.Join(" ", args.Skip(2))} by {Environment.UserName}",
        Changes = changes,
    },
});

// 3. Wait until the change has reached all Route 53 authoritative servers.
var changeId = response.ChangeInfo.Id;
var status = response.ChangeInfo.Status;
var deadline = DateTime.UtcNow.AddMinutes(5);
while (status != ChangeStatus.INSYNC && DateTime.UtcNow < deadline)
{
    await Task.Delay(TimeSpan.FromSeconds(5));
    status = (await route53.GetChangeAsync(new GetChangeRequest { Id = changeId })).ChangeInfo.Status;
    Console.WriteLine($"  change {changeId}: {status}");
}

if (status != ChangeStatus.INSYNC)
{
    Console.Error.WriteLine("Timed out waiting for INSYNC — check the change in the console before shifting further.");
    return 1;
}

Console.WriteLine($"Done. Clients see the new split within the record TTL ({existing[0].TTL} s) plus their own caching.");
return 0;
> dotnet run -- Z0123456789ABCDEFGHIJ ledger.learn.internal.harbourline.example blue=90 green=10
blue        100 ->   90
green         0 ->   10
  blue: 90.0% of answers
  green: 10.0% of answers
  change /change/C0987654321ZYXWVUTSRQ: INSYNC
Done. Clients see the new split within the record TTL (60 s) plus their own caching.

Code explained line by line

  1. recordName = args[1].TrimEnd('.') + "." — Route 53 returns fully qualified names with a trailing dot; normalising avoids "not found" surprises.
  2. w is < 0 or > 255 — Route 53 weights are integers from 0 to 255.
  3. "all weights 0" check — if every record in a weighted set has weight 0, Route 53 returns them all with equal probability. That is never what a canary operator means.
  4. new AmazonRoute53Client(RegionEndpoint.USEast1) — Route 53 is global; its API is signed for us-east-1 regardless of where your workloads run.
  5. ListResourceRecordSetsAsync(... StartRecordName = recordName) — lists records starting at that name; the filter keeps only weighted records (SetIdentifier and Weight both set) with exactly that name. Large zones would need paging with NextRecordName; the message says so.
  6. record.Weight = ... then ChangeAction.UPSERT — reusing the full existing ResourceRecordSet keeps every other field (TTL, values, health check ID) unchanged. UPSERT creates or replaces.
  7. One ChangeBatch with all changes — Route 53 applies a batch atomically: either every weight changes or none does. Two separate calls could leave a moment with an unintended split.
  8. Comment = ... by {Environment.UserName} — the comment appears in the change record; CloudTrail records the caller identity as well.
  9. GetChangeAsync until ChangeStatus.INSYNC — PENDING means not all authoritative servers have the change yet. Only after INSYNC + TTL can you judge the canary's metrics.

Security considerations

  • Least privilege on DNS. Only the pipeline role should have route53:ChangeResourceRecordSets, ideally scoped with conditions on record names and types (route53:ChangeResourceRecordSetsNormalizedRecordNames) ⚠ VERIFY condition key names in the Route 53 IAM reference.
  • DNSSEC signing for public zones (with a KMS asymmetric key in us-east-1) protects customers from spoofed answers; monitor the DNSSEC CloudWatch metrics so a key problem doesn't take the domain offline.
  • CAA records restrict which certificate authorities may issue for your domains (for example only Amazon's CA for ACM).
  • Avoid dangling records. Delete DNS records in the same change as the resources they point to; scan regularly for CNAMEs to non-existent targets.
  • Log and filter queries. Resolver query logging plus Route 53 Resolver DNS Firewall (allow-list of domains for sensitive VPCs) detect and block DNS-based exfiltration and malware callbacks.
  • Private zones keep topology private. Never publish internal names (database endpoints, internal service names) in public zones.

⚠ Learning shortcut — not for production

The lab creates a private zone in your account, associated with one VPC, and changes records with a CLI and a C# tool you run yourself. In production at Harbourline, private zones live in a central networking account and are associated with workload VPCs across accounts (with association authorizations), records change only through pipelines with approvals, and public zones are DNSSEC-signed with change alerts sent to the security operations team.

Banking use case

Customer API failover (eu-west-2 → eu-west-1). api.harbourline.example is a failover record: PRIMARY is an alias to the London ALB with evaluate target health; SECONDARY is an alias to the Dublin ALB. A calculated health check on the primary combines the ALB's target health with a CloudWatch alarm on an internal synthetic transaction (log in, fetch balance) — so London fails over when customers can't actually transact, not only when servers are down. TTL is 60 seconds; the mobile app's .NET MAUI client uses PooledConnectionLifetime = 2 minutes. Failover is tested quarterly as part of the operational-resilience programme (Module 12: HA & DR).

EU data residency. Requests from EU countries are routed with a geolocation record to the EU subsidiary's stack in eu-west-1; a default geolocation record catches locations that don't match any rule. Whether DNS-level routing is a sufficient residency control is a legal and compliance question — it's one layer, alongside where data is actually stored.

Internal canaries. The ledger service is released by shifting weighted records 0 → 5 → 25 → 100 with the weight shifter, watching error rates between steps.

Common mistakes

  • CNAME at the zone apex → not allowed → use an alias record.
  • Private zone doesn't resolve → VPC not associated, or enableDnsSupport/enableDnsHostnames off → associate and enable both.
  • Health check on a private IP → always unhealthy, because checkers are on the internet → CloudWatch-alarm health check.
  • Long TTLs on failover records → failover takes hours for some clients → 60 seconds or less on records that must move.
  • Geolocation without a default record → clients from unmatched locations get no answer → always add a default.
  • Ignoring client-side caching → HttpClient keeps using the old IP over a pooled connection → set PooledConnectionLifetime.

Troubleshooting

SymptomLikely causeFix
NXDOMAIN inside the VPC for a private recordZone not associated with this VPC, or VPC DNS attributes offaws route53 get-hosted-zone shows VPCs; enable DNS attributes
Public name doesn't resolve after creating the zoneRegistrar NS records don't match the zone's NS setUpdate the registrar's name servers to the four in the zone
InvalidChangeBatch: ... CNAME ... conflictsCNAME and another record at the same nameA CNAME must be the only record at its name
Failover never happensNo health check on the primary, or evaluate target health offAttach a health check / enable target health evaluation
Weighted record gets all traffic despite weight 10Other records unhealthy (unhealthy records are excluded)Check health check status for every set
Resolver throttling / intermittent DNS timeouts under loadOver 1,024 packets per second per ENI to the ResolverCache DNS; reuse connections; spread load across ENIs
Cross-account VPC association failsNo association authorization from the zone ownercreate-vpc-association-authorization in the zone's account, then associate-vpc-with-hosted-zone in the VPC's account

Cost and cleanup

Cost label: credits. A hosted zone deleted within 12 hours of creation is not charged (queries still are). Queries from inside the VPC to a private zone in this lab: a few hundred, so effectively USD 0.00 at USD 0.40 per million. If you keep the zone: USD 0.50 per month. Health checks (if you try one): USD 0.50–0.75 per month, billed proportionally ⚠ VERIFY proration for short-lived checks. Free alternative: design-only — write the record sets and routing policies in Terraform without applying.

$p = "--profile", "learn-sandbox", "--region", "us-east-1"

# A zone can only be deleted when it contains just its NS and SOA records
$sets = aws route53 list-resource-record-sets --hosted-zone-id $zoneId @p --output json | ConvertFrom-Json
$deletes = $sets.ResourceRecordSets | Where-Object { $_.Type -notin "NS", "SOA" } |
  ForEach-Object { @{ Action = "DELETE"; ResourceRecordSet = $_ } }
if ($deletes) {
  @{ Changes = @($deletes) } | ConvertTo-Json -Depth 10 | Out-File -Encoding ascii delete.json
  aws route53 change-resource-record-sets --hosted-zone-id $zoneId --change-batch file://delete.json @p
}
aws route53 delete-hosted-zone --id $zoneId @p
Remove-Item records.json, delete.json -ErrorAction SilentlyContinue

# Any health checks left?
aws route53 list-health-checks @p --query "HealthChecks[].[Id,HealthCheckConfig.Type]" --output table

Exercises

  • 🟢 Guided: Create the private zone, the A record and the weighted pair; use test-dns-answer several times to see blue returned; run the weight shifter to 50/50 and repeat. Delete the zone within 12 hours.
  • 🟡 Challenge: Design the record sets (Terraform, not applied) for api.harbourline.example: failover between eu-west-2 and eu-west-1, where the primary is itself a weighted pair (blue/green) in eu-west-2. Include the health checks and explain how a blue-only outage is handled.
  • 🔴 Live problem: "We failed over the customer API to Dublin at 10:02 during the DR test. Route 53 shows the secondary answer since 10:03, but 30% of mobile traffic was still hitting London at 10:30." Explain the likely causes and the fixes for the next test.

Assignment

Write a DNS runbook for one Harbourline service: zones and records (with TTLs and why), routing policy, health checks, who may change what, how a failover is triggered and verified, and the rollback. Add the weight shifter to your repository as tools/weight-shift/ and reference it from the runbook.

Solutions

Knowledge check

Interview questions

  • "How would you implement active-passive DR for an API with Route 53?" — Failover records: primary alias to the main Region's ALB with target health (and a health check on a real transaction), secondary alias to the standby; short TTLs; clients that recycle connections; tested regularly.
  • "What's split-horizon DNS and why would a bank use it?" — Same zone name in a public and a private hosted zone; internal clients get private answers, internet clients public ones; keeps internal topology private and traffic on private paths.
  • "How do you resolve on-premises names from a VPC, and VPC names from on-premises?" — Route 53 Resolver outbound endpoints with forwarding rules, and inbound endpoints that on-premises DNS forwards to.
  • "What's a dangling DNS record?" — A record pointing to a resource you deleted; if someone else can claim that resource name, they can serve content on your domain. Delete records with resources and scan for them.

Certification practice

Completion checklist

  • I can explain public vs private hosted zones and split-horizon DNS
  • I can pick a routing policy for a scenario and explain alias vs CNAME
  • I created a private zone, records and a weighted pair (or designed them in Terraform)
  • I ran the weight shifter and saw INSYNC
  • I deleted the zone within 12 hours and checked for leftover health checks

Key takeaways

  • Route 53 provides public and private authoritative DNS, health checks and traffic routing; the VPC Resolver answers your resources' queries.
  • Alias records are free for AWS targets, work at the apex and follow target health.
  • Eight routing policies cover canaries (weighted), DR (failover), performance (latency) and residency (geolocation).
  • Health checkers live on the internet — use CloudWatch-alarm checks for private resources.
  • DNS changes are only as fast as TTLs and client connection reuse; secure DNS with least privilege, DNSSEC, CAA, query logging and DNS Firewall.

Further reading

Next: Elastic Load Balancing.

Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.

On this page