Runbook: rotate the DNSSEC key-signing key#
A double-signing rollover: publish the new key alongside the old, wait for propagation, then retire the old one. There is no in-place update — attempting one breaks the chain of trust.
Allow 2–3 days elapsed, mostly waiting. Actual work is under an hour.
When to do this#
DNSSECKeySigningKeysNeedingActionfired and the key is unrecoverable.- The KMS key was compromised, or you believe it might have been.
- Migrating to a different algorithm (Ed25519, if Route 53 ever supports it).
- Practising the procedure on purpose — a good idea before you need it.
There is no scheduled rotation for this domain. With an externally-managed DS record, a rotation requiring a manual registrar step is more likely to cause an outage than to prevent a compromise, and the key is non-exportable inside KMS. See ADR-0003.
Before starting#
ZONE_ID="$(tofu -chdir=terraform/environments/prod output -raw zone_id)"
# Record the current state so you can tell what changed.
aws route53 get-dnssec --hosted-zone-id "$ZONE_ID"
dig +short DS testz.dev @1.1.1.1
tofu -chdir=terraform/environments/prod output -json dnssec_ds_record_parts
Confirm the zone is currently healthy. Rotating a broken chain compounds the problem — fix it first with the emergency runbook.
Step 1 — create the new key-signing key#
Change the name. This is why key_signing_key_name is a variable.
# terraform/environments/prod/terraform.tfvars — or pass -var
key_signing_key_name = "ksk2"
The dns-zone module creates a new KMS key, a new alias, and a new KSK. Because the name changed, Terraform plans a create-then-destroy, not an update.
make plan # verify: new KMS key + new KSK, and the zone NOT being replaced
Read the plan carefully. If it proposes replacing aws_route53_zone.this, stop — prevent_destroy should block it, but a plan that even suggests it means something is wrong.
make apply
At this point both keys sign the DNSKEY set. The zone is valid under either DS record, which is what makes the rollover safe.
Step 2 — publish the new DS record alongside the old#
make ds-record
At the registrar, add the new DS record. Do not remove the old one yet. Registries accept multiple DS records precisely for this.
If your registrar only allows one DS record, you have a harder problem: there is no zero-downtime path. Schedule a maintenance window, and consider transferring to a registrar that supports multiple DS records — or into Route 53 Domains, which automates the whole sequence.
Step 3 — wait#
# Both DS records should be visible.
dig +short DS testz.dev @1.1.1.1
# Validation must still succeed throughout.
delv @1.1.1.1 testz.dev A +rtrace
dig +dnssec A testz.dev @8.8.8.8 | grep -E '^;;.*flags'
Wait at least 48 hours, and longer than the .dev DS TTL. This is the whole safety margin of the procedure — resolvers that cached the old DS must have a chance to see the new one.
Do not shorten this because it looks fine after an hour. It looks fine because the old key still works.
Step 4 — retire the old key#
Only after the wait, and only with validation confirmed working.
Remove the old DS record at the registrar first:
# Only the new DS should remain.
dig +short DS testz.dev @1.1.1.1
Wait for the old DS to leave caches (up to the DS TTL again), then remove the old KSK from AWS. Because the module manages one KSK at a time, this happens automatically on the next apply once key_signing_key_name is the new value — the old key was already scheduled for destroy in step 1's plan.
Verify the old KMS key entered its deletion window rather than vanishing:
aws kms describe-key --key-id <old-key-id> \
--query 'KeyMetadata.[KeyState,DeletionDate]'
PendingDeletion with a date ~30 days out is correct. That window is deliberate: it is the period in which an accidental rotation is still recoverable.
Step 5 — confirm#
aws route53 get-dnssec --hosted-zone-id "$ZONE_ID" # one ACTIVE KSK
dig +short DS testz.dev @1.1.1.1 # one DS record
delv @1.1.1.1 testz.dev A +rtrace # fully validated
make health
Update the tech radar or an ADR if the rotation changed anything about the approach.
If it goes wrong mid-rollover#
The rollover is designed to be safe at every step because both keys are valid simultaneously. Recovery is almost always "put the old DS record back":
- Re-add the old DS record at the registrar.
- Wait for propagation.
- Confirm validation.
- Diagnose without time pressure.
If resolution is already broken, go straight to the emergency runbook — restore service first, rotate later.