AWS · Route 53

Teach the internet
where to ask.

Start with read-only DNS lookups. Optionally create a small Route 53 zone for an unused lab subdomain and verify a harmless TXT record—without moving your main website or email.

These are sample names, not our infrastructure. Before copying commands, read Customize the examples: paths, keys, IPs and names. Substitute your own authorized account and resources. Existing lab? Retain its original resource names, usernames and state; renamed samples can cause replacement. See the existing-lab warning before applying updated recipes.

Keep the live domain out of the exercise

DNS is the address book. Your registrar records who registered the domain. The authoritative DNS provider keeps the address-book entries. Your web host serves the actual page. They can be three different companies.

Namecheap being your registrar does not prove Namecheap currently hosts your DNS. Check the domain's NS records first. If Cloudflare is authoritative, the parent records are managed there. A Cloudflare Pages site and a DNS zone are different things.

The optional Route 53 zone is billable, even if you never delegate it. Check current hosted-zone and query pricing; monthly hosted-zone charges are not generally prorated. Credits/eligibility are not guaranteed. Skip creation/delegation to keep this a read-only lesson.

For hands-on creation, you need an unused lab.YOUR-OWNED-DOMAIN, permission to manage that child name at the current parent DNS provider, and an authorized AWS deployment session. Do not use GuidewellCloud's live apex, www, email records, Pages custom-domain verification records, or a child name already used by someone else. example.com below is a placeholder, not a domain you own.

No web server, certificate, A record, health check, resolver endpoint or domain registration is created by this recipe. It publishes only a test TXT record. DNS does not require opening a VM firewall.

1. Inspect first—change nothing

Windows PowerShell · replace example.com
Resolve-DnsName -Name example.com -Type NS
Resolve-DnsName -Name example.com -Type MX
Resolve-DnsName -Name www.example.com -Type CNAME

Record the current authoritative provider privately. A CNAME lookup can return no CNAME because the name uses an A/AAAA record or provider flattening; absence alone is not a website failure. Resolver caches can preserve older answers.

2. Know which job each record does

Record / conceptPlain EnglishDo not assume
A / AAAAName to IPv4 / IPv6 addressIt opens ports or starts an app
CNAMEName points to another nameA normal CNAME belongs at the zone apex alongside required NS/SOA
TXTText attached to a namePublic text is an appropriate place for secrets
MXWhere mail delivery goesIt should be changed to practice web hosting
NSWhich servers answer for a zoneThe child's delegation replaces the whole domain's registrar nameservers
TTLHow long an answer may be cachedEvery resolver instantly follows a change
Route 53 aliasProvider-specific record targeting supported destinationsIt is a generic CNAME or works with any arbitrary destination

Route 53 record typesAWS subdomain routing

3. Create only the lab child zone with Terraform

Use Ubuntu/WSL and the AWS CLI/Terraform setup from the AWS server guide. Sign into the intended account and inspect aws sts get-caller-identity. Use a new local folder/state for DNS; never put the live site's state or credentials into this website.

Download these examples and create terraform.tfvars privately with your unused lab child name:

terraform.tfvars · owned, unused child name only
lab_zone_name = "lab.YOUR-OWNED-DOMAIN"

The validation guards the lab prefix; it cannot verify domain ownership or whether the child name is unused. Check those yourself. This public zone is not associated with a VPC. Parent delegation is deliberately NOT automated by this recipe.

Ubuntu / WSL · review before creating billable DNS
terraform init
terraform fmt
terraform validate
terraform plan -out=dns.tfplan
# Expect one new public hosted zone and one TXT record only.
# Apply only after reviewing ownership, scope and cost.
terraform apply dns.tfplan
terraform output lab_name_servers
terraform output proof_name

Stop if the plan touches existing records or any unrelated resource. Save the four nameservers from this exact zone, not nameservers copied from another tutorial. Duplicate same-name zones can have different nameservers and still incur charges.

Terraform Route 53 zoneTerraform Route 53 record

4. Delegate only the unused lab child

First query the test record directly against one new Route 53 nameserver, as in the next section. Only then decide whether you need public recursive resolution. Direct authoritative testing works without changing the parent.

Optional: at the current authoritative provider for your parent domain, add an NS delegation for only the lab child, with all four returned Route 53 nameservers. Keep the existing parent/apex NS, SOA, mail, www and website records unchanged.

  • Cloudflare authoritative parent: use DNS → Records, add NS records named lab, one per returned nameserver. Follow Cloudflare's subdomain-delegation instructions; these are delegation records, not proxied web records.
  • Another authoritative provider: use that provider's child-delegation workflow. A registrar's “Custom DNS / nameservers” setting normally changes the entire domain—do not use it for this child exercise.
  • Conflicts: if lab already has a CNAME, delegation, records below it, or any dependent application, stop and choose a different dedicated learning name. Do not delete existing data to make this lab fit.
  • DNSSEC: this beginner child zone does not enable signing. Do not create a DS record for it. A stale/incompatible DS at an existing child delegation requires a proper DNSSEC migration, not this exercise.
A delegated zone can publish records under the child name. Treat control of that zone as security-sensitive. Public DNS reveals the lab names and marker; do not use personal details, keys, account IDs or private infrastructure inventory in TXT records.

Record exactly which parent delegation records you added, their previous state and their TTL for cleanup. Do not change the domain's registration contact details or registrar nameservers.

5. Verify authoritative and recursive answers separately

Replace the proof name and server with your actual Terraform outputs:

Windows PowerShell · DNS verification
Resolve-DnsName -Name proof.lab.example.com -Type TXT -Server YOUR-ROUTE53-NAMESERVER -DnsOnly
# Only after optional parent delegation:
Resolve-DnsName -Name lab.example.com -Type NS
Resolve-DnsName -Name proof.lab.example.com -Type TXT
Linux / WSL · DNS verification
dig @YOUR-ROUTE53-NAMESERVER proof.lab.example.com TXT
# Expect NOERROR, the marker answer and the authoritative aa flag.
# Only after optional parent delegation:
dig NS lab.example.com
dig TXT proof.lab.example.com

A direct authoritative answer proves that nameserver has the record. A recursive answer through your usual resolver proves that resolver can follow the delegation, subject to its cache. Check the response status, server and exact marker, not just whether a command returned text.

SymptomCheck
Direct answer works; recursive does notParent child-delegation records, correct four servers and cached negative answers
NXDOMAINExact queried name, correct zone/server and whether that name exists
NOERROR with no TXT answerName may exist but not have this type; inspect the intended record
SERVFAILDelegation reachability and DNSSEC validation, including any stale DS
Old markerAuthoritative answer versus recursive cache/TTL; confirm the change reached the correct zone
Prove it: you can show where the record is authoritative and explain whether public delegation was configured. No website or email record was moved.

6. Change only the marker

Change the TXT value in main.tf from contoso-dns-baseline to contoso-dns-updated, keeping its quoted TXT representation. Create a fresh reviewed plan:

Ubuntu / WSL · one-record update
terraform fmt
terraform validate
terraform plan -out=dns-update.tfplan
# Expect an update to only the marker record.
terraform apply dns-update.tfplan

Retest authoritative first, recursive second. TTL 300 applies to this TXT answer, not every NS or negative cache. Do not repeatedly create zones because an old answer remains cached. Ansible is useful for host configuration; Terraform owns these DNS records so two tools do not compete over the same desired state.

7. Remove delegation before deleting the zone

  1. If you delegated the child, remove only the exact parent NS records added for this lab. Check no child DS record or application depends on it.
  2. Allow previously cached delegations to age out using their recorded TTL before deleting the child zone. Do not assume the TXT TTL is the delegation TTL. Keep the zone under your control during that interval.
  3. Confirm the folder/state and intended AWS account. Review a destroy plan containing only this TXT record and dedicated child zone.
  4. Apply the reviewed destroy plan, verify the zone is gone, and check costs after reporting catches up. A partially used month's zone charge may remain.
Ubuntu / WSL · dedicated DNS cleanup only
terraform plan -destroy -out=dns-destroy.tfplan
terraform apply dns-destroy.tfplan

force_destroy = false avoids blindly removing records added outside this recipe. If deletion fails because someone added other records, investigate ownership rather than enabling force deletion. Never leave a parent delegation pointing to a zone you no longer control.

Finished: understand DNS authority, create/update a record through code, verify cache behavior, and remove the child cleanly without touching the live parent website.