DNS Runbook: Audit, Automate, and Troubleshoot DNS Across Cloudflare, Route 53, and DigitalOcean
DNS AutomationRunbookDNS TroubleshootingTerraformCloudflareRoute 53DigitalOcean

DNS Runbook: Audit, Automate, and Troubleshoot DNS Across Cloudflare, Route 53, and DigitalOcean

PPlkdt Labs
2026-11-11
8 min read

A practical DNS runbook for auditing zones, automating records, verifying changes, and rolling back Cloudflare, Route 53, and other providers.

A reliable DNS runbook turns domain changes from ad hoc edits into a repeatable process. This guide provides a DNS audit checklist, provider comparison, Terraform and API patterns, verification commands, and an emergency rollback procedure for teams using Cloudflare, Amazon Route 53, DigitalOcean, or Google Cloud DNS.

Overview

DNS is often treated as a small configuration task, but a single incorrect record can interrupt a website, API, deployment pipeline, or email system. A runbook reduces that risk by documenting what should exist, who can change it, how changes are verified, and how to recover when the result is not what you expected.

Use this runbook whenever you connect a domain to hosting, add a verification record, migrate providers, change an application endpoint, or investigate a service that appears to be offline. Keep the authoritative zone documented separately from application code, then automate records that are safe to manage through version control.

A practical DNS runbook has five parts:

  1. Inventory: record names, types, values, TTLs, owners, and intended services.
  2. Authority: the registrar, delegated nameservers, and provider responsible for the authoritative zone.
  3. Change control: the proposed change, review, approval, and rollback value.
  4. Verification: authoritative queries, recursive resolver checks, and an application-level test.
  5. Recovery: a documented way to restore the last known-good configuration.

For related deployment work, pair this guide with the CI/CD deployment troubleshooting matrix and the DNS propagation check guide.

Provider comparison for a runbook

ProviderUseful fitRunbook checks
CloudflareTeams that want a broad DNS API and a web-based zone editor.Confirm the zone identifier, API token scope, proxy status where applicable, and whether Terraform or API is the source of truth.
Amazon Route 53Teams already managing infrastructure in AWS or using AWS identity controls.Confirm the hosted zone ID, record routing policy, IAM permissions, and whether health checks or alias records are involved.
DigitalOcean DNSSmall infrastructure teams managing domains alongside DigitalOcean resources.Confirm the domain is added to the correct account, nameservers are delegated correctly, and the API token has only the required access.
Google Cloud DNSTeams using Google Cloud projects and IAM for infrastructure management.Confirm the managed zone, project, service account permissions, and the exact name-server delegation at the registrar.

The best DNS provider for developers depends less on a feature checklist than on where your team already manages identity, infrastructure, logs, and approvals. The important runbook decision is to choose one authoritative source for each zone and record who is allowed to modify it.

Checklist by scenario

1. Perform a quarterly DNS audit

  1. Record the domain, registrar, authoritative nameservers, DNS provider, and zone owner.
  2. Export or otherwise capture the current zone before reviewing it. Store the snapshot in a restricted location.
  3. List every record and classify it as production, staging, email, domain verification, infrastructure, or unknown.
  4. Identify records with no documented owner, obsolete hosting targets, stale verification tokens, and duplicate records.
  5. Check whether wildcard records could route unexpected subdomains to a production service.
  6. Review CNAME, A, AAAA, MX, TXT, NS, and CAA records individually. Do not assume similar-looking records serve the same purpose.
  7. Confirm that SPF, DKIM, and DMARC records match the current email providers. Use the dedicated email authentication checklist for that review.
  8. Confirm that DNSSEC status and signing configuration are documented if DNSSEC is enabled. Treat changes to delegation or signing as a planned maintenance task.
  9. Test the public answers from more than one recursive resolver and compare them with the authoritative answer.
  10. Open follow-up tickets for records that cannot be explained. Do not delete an uncertain record during an audit without confirming its dependencies.

2. Connect a domain to a new host or deployment

  1. Obtain the host's required record type and target. Some platforms use an A or AAAA record, while others require a CNAME or provider-specific alias.
  2. Lower the existing record's TTL before a planned migration if your provider and change window allow it. A lower TTL does not force every resolver to discard cached data immediately.
  3. Capture the current record value so it can be restored.
  4. Add the new record without removing the old one unless the hosting provider requires replacement.
  5. Verify the record at the authoritative nameserver first, then through recursive resolvers.
  6. Test the hostname over HTTPS, including redirects, certificates, health checks, and the expected application response.
  7. Remove the old target only after the new service is confirmed and the rollback decision has been agreed.

If the application runs on a Linux server, the DNS change is only one part of the release. Review the Nginx reverse proxy setup, or use the Docker deployment guide to check the service behind the hostname.

3. Add common records safely

  • CNAME: use a fully qualified target where required, and check whether the provider permits a CNAME at the zone apex.
  • TXT: copy verification strings exactly. Preserve quotation and escaping rules used by the provider, and query the result rather than trusting the input form.
  • MX: specify both priority and destination. Keep existing mail records until the migration plan says they can be removed.
  • SPF: publish one coherent SPF policy for a domain rather than creating unrelated SPF records.
  • DKIM: add the selector-specific record supplied by the mail provider and verify the selector name as well as the value.
  • DMARC: begin with a documented policy and reporting destination appropriate to your rollout plan; avoid changing policy without reviewing mail flow.

4. Automate DNS with Terraform

Terraform is useful when records should be reviewed in pull requests and recreated consistently. Pin provider versions in the root configuration, keep credentials outside the repository, and use separate state or workspaces for environments only when the team understands the resulting separation.

terraform {
  required_providers {
    cloudflare = {
      source = "cloudflare/cloudflare"
    }
  }
}

variable "zone_id" {
  type      = string
  sensitive = true
}

resource "cloudflare_record" "app" {
  zone_id = var.zone_id
  name    = "app"
  type    = "CNAME"
  content = "service.example-host.invalid"
  ttl     = 300
  proxied = false
}

The resource shape varies by provider and provider version, so validate the configuration against the version selected by your team before applying it. A useful module interface should accept the zone identifier, record name, type, value, TTL, and any provider-specific routing or proxy setting. Require a plan review before apply.

For a Cloudflare API pattern, use an environment variable for the token and substitute the real zone and record values:

curl -X POST "https://api.cloudflare.com/client/v4/zones/$CF_ZONE_ID/dns_records" \
  -H "Authorization: Bearer $CF_API_TOKEN" \
  -H "Content-Type: application/json" \
  --data '{
    "type":"TXT",
    "name":"example.com",
    "content":"verification=value",
    "ttl":300
  }'

Use narrowly scoped credentials, log the change identifier, and never place tokens in shell history, source control, or shared screenshots. The Cloudflare API and Terraform guide provides a focused implementation pattern.

5. Investigate DNS that is not propagating

Start with the authoritative answer rather than assuming that a public checker is wrong. Replace the nameserver and hostname in these examples:

dig NS example.com +short
dig @ns1.example-dns.invalid app.example.com A +short
dig app.example.com A +short
dig app.example.com CNAME +short
dig example.com MX +short
dig example.com TXT +short
  1. Check that the registrar delegates the expected nameservers.
  2. Query each authoritative nameserver and compare answers.
  3. Check the record name, type, trailing dot behavior, and target spelling.
  4. Compare the record's TTL with the time since the change.
  5. Check a second network or recursive resolver to distinguish local cache from an authoritative problem.
  6. Test the actual service, because a correct DNS answer does not prove that the origin, certificate, reverse proxy, or application is healthy.

What to double-check

Nameserver authority: Editing a zone at one provider has no effect if the registrar delegates the domain to another provider. This is the first check during a migration or unexplained outage.

Record scope: The zone apex, www, API subdomains, mail subdomains, and wildcard names can have different records. Confirm the exact hostname that the client uses.

Provider-specific behavior: A provider may offer alias records, proxy modes, routing policies, health checks, or flattened responses. Document these settings because a simple export may not explain their operational effect.

TTL and caching: TTL controls how long a resolver may cache an answer; it is not a guaranteed global update timer. Record the previous and new TTL in the change ticket.

Certificates and redirects: After changing DNS, test the hostname users visit. Check TLS, HTTP redirects, origin routing, and the expected status code. A successful dig query alone is not an application verification.

Rollback data: Before every destructive change, save the old value, record type, TTL, routing settings, and provider-specific flags. A screenshot may help during an incident, but an export or versioned configuration is easier to restore accurately.

Common mistakes

  • Changing records at the wrong provider: Confirm delegation before editing the zone.
  • Replacing a zone with an incomplete import: Compare the proposed zone with the existing one, including mail and verification records.
  • Adding a second SPF record: Consolidate the policy according to the mail provider's instructions.
  • Using a CNAME where the provider expects an A or alias record: Follow the hosting platform's exact connection method.
  • Deleting old records too early: Keep a documented rollback path until the new service is tested.
  • Putting secrets in Terraform variables committed to Git: Use a secret manager, CI/CD secret store, or protected environment variable.
  • Assuming propagation is the only failure mode: Check the origin server, Nginx, container, certificate, and deployment status as well.
  • Running automation without a plan review: Require a diff, an approver, and a post-apply verification step.

When DNS changes accompany a release, the GitHub Actions deployment guide can help separate application deployment from DNS approval and verification.

When to revisit

Review this runbook at least quarterly and before seasonal planning cycles, major launches, domain migrations, or changes to hosting and email providers. Revisit it immediately when a provider changes its API, Terraform resource behavior, dashboard paths, DNSSEC workflow, or authentication model.

After every DNS change, update the inventory, owner, source-of-truth location, and rollback value. A runbook that describes yesterday's zone can be more dangerous than no runbook because it creates false confidence.

Emergency rollback checklist

  1. Declare the incident and record the exact affected hostname, symptom, and time detected.
  2. Freeze unrelated DNS changes and identify the last known-good configuration.
  3. Confirm whether the failure is authoritative DNS, recursive caching, TLS, routing, or the origin service.
  4. Restore the previous record value and provider-specific settings, preferably through the same reviewed automation used for the change.
  5. Query each authoritative nameserver, then test through a recursive resolver.
  6. Verify the application, API, certificate, and email path where relevant.
  7. Keep evidence of the changed values and timestamps. Do not repeatedly edit records while waiting for caches to expire.
  8. After recovery, document the cause, add a regression check, and update the runbook before unfreezing normal changes.

Keep this checklist with your deployment and infrastructure documentation. The goal is not to prevent every DNS error; it is to make each change observable, reviewable, and reversible.

Related Topics

#DNS Automation#Runbook#DNS Troubleshooting#Terraform#Cloudflare#Route 53#DigitalOcean
P

Plkdt Labs

Developer Tools and Infrastructure Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.