DEV Community

Cover image for Stop accidental DNS outages: locking records in Route 53
Sascha Mirow-Stanitzok
Sascha Mirow-Stanitzok

Posted on Edited on Originally published at sascha-ms.de

Stop accidental DNS outages: locking records in Route 53

Most DNS outages I have seen were not attacks. They were a deployment with the wrong variable, a tired click in the console, or someone "cleaning up" a CNAME that turned out to be the ACM validation record. One overwritten apex record and the website is gone; one deleted MX record and mail stops arriving.

Since November 12, 2026, Route 53 has a simple answer for this: record set protection. I walked through the setup, the permission model and an automated guard in my article Route 53 Record Set Protection: Lock Critical DNS Records. Here is the condensed version.

How the lock works

A protection targets one combination of record name and type in a hosted zone. As long as it exists, Route 53 rejects every ChangeResourceRecordSets request that would create, modify or delete those records, and that includes principals with route53:*. To change the record, someone has to remove the protection first, on purpose.

A few behaviors are worth knowing:

  • A protection covers all records with that name and type, so three weighted A records for www are protected together.
  • You can protect a name that does not exist yet. That effectively reserves it, which is handy for names like admin that should never appear.
  • If one change in a batch hits a protection, the whole batch fails with InvalidChangeBatch. Nothing is applied partially.
  • Each protection can carry a comment of up to 256 characters, and Route 53 includes it in the error message. Perfect for "read the runbook first".

A simplified example of protecting the MX record:

aws route53 create-resource-record-set-protections \
  --hosted-zone-id "$ZONE_ID" \
  --protections '[{"RecordName":"bikerental.example",
    "RecordType":"MX",
    "Comment":"Mail routing. See DNS runbook before changing."}]'
Enter fullscreen mode Exit fullscreen mode

Before this feature, you needed record-level conditions in the IAM policy of every role that could touch DNS. That worked, but it was scattered, and callers only saw a generic "Access Denied". The new protection lives on the zone, is visible to everyone and explains itself.

What to protect, and what to leave alone

My rule of thumb: protect records that rarely change and would cause an outage if changed by accident. Apex records, MX, DMARC and DKIM entries, ACM validation CNAMEs and the apex NS/SOA are good candidates. Test and preview subdomains are not. Protecting too much trains people to click past the hurdle out of habit. The apex TXT record needs a little thought, because SPF and SaaS verifications pile up there and every new entry becomes "remove, change, protect again".

The parts that decide whether it really helps

The protection is only worth as much as your control over route53:DeleteResourceRecordSetProtections. That action has no condition keys of its own, so anyone allowed to use it on the zone can remove every protection. In an AWS Organization, I would deny it via an SCP for everyone except a dedicated DNS admin role, and alert on removals through CloudTrail and EventBridge.

The second thing to clarify with your team before the first protection: CloudFormation, and therefore CDK and the Serverless Framework, fails on protected records just like the CLI. A deployment that touches one rolls back, and a hosted zone with protections cannot be deleted at all. I also could not find a CloudFormation resource for protections yet, so they live outside your stacks for now. I actually like that, because the protection shouldn't vanish with the very deployment that breaks the record.

Finally, a protection that someone removed and forgot to restore is worse than none, because everyone feels safe. That is why the full article builds a small serverless "DNS guard" that compares desired and actual protections on a schedule, repairs gaps and raises an alarm.

What the full article covers

  • Step-by-step CLI setup, including testing the protection and reserving names
  • A TypeScript script that changes a protected record safely and always restores the protection
  • An example SCP so only one role can remove protections
  • The complete DNS guard: Lambda handler, EMF metric, alarm, serverless.yml and tests
  • Common mistakes such as name normalization, mixed batches and throttling

All the details are in the original: Route 53 Record Set Protection: Lock Critical DNS Records.

📖 This is the condensed version. The full article on sascha-ms.de goes deeper – with all code samples, diagrams and a short knowledge check.


👉 Next step: Working with AWS CDK? Grab my printable AWS CDK cheat sheet with commands, concepts and a stack skeleton.

📬 Stay updated: New articles on serverless, AI and leading tech teams via RSS, browser push or the weekly newsletter (in German).

Originally published on sascha-ms.de. More articles on serverless, AI in everyday development and leading tech teams: sascha-ms.de/en

Top comments (0)