Skip to main content

Claude/ChatGPT Prompt to Write a Zero-Downtime Secrets Rotation Runbook

Runbook to rotate a secret with zero downtime: preflight, dual-secret window, consumer rollout, verification, and per-stage rollback with exact commands.

Füllen Sie die Platzhalter aus

Edit the values, then copy your finished prompt.

Ihr Prompt
prompt.txt

                                

What this prompt does

This prompt writes a zero-downtime secrets-rotation runbook that an on-call engineer can follow at 3am — exact commands, real verification, no hand-waving. The structure enforces a safe dual-secret overlap: preflight checks, add the new secret alongside the old, roll consumers to read both, switch writers, verify, and only then remove the old secret. Every stage carries its own verification and rollback step, so a tired engineer never has to improvise.

The variables make the runbook executable. [secret_type] (for example, a database master password) sets what is being rotated and how it is referenced. [consumers] lists every service that reads the secret — api, workers, a reporting job — so the rollout covers each one and nothing is forgotten. [secret_store] determines the exact commands, because rotating in AWS Secrets Manager looks different from Vault or a Kubernetes secret.

When to use it

  • You need to rotate a credential without taking the system down
  • You want a runbook precise enough to follow under pressure at 3am
  • Multiple services read the secret and must all migrate before the old one dies
  • You want a dual-secret overlap window so nothing reads a value that no longer exists
  • You need per-stage verification and rollback, not a single fragile sequence
  • You are rehearsing the rotation in staging before touching production

Example output

The model returns a numbered runbook where each step carries the actual command for your secret store, a verify block, and a rollback block. It moves through preflight (who reads the secret, current version, blast radius), adding the new secret, rolling consumers to read both, switching writers, verifying, and removing the old secret last — with a total expected duration so you know how long the window runs.

Pro tips

  • List every reader in [consumers]; the classic failure is deleting the old secret before one forgotten service has picked up the new one
  • Set [secret_store] exactly so the commands match — Secrets Manager, Vault, and Kubernetes secrets each rotate differently
  • Describe [secret_type] precisely, since a database password rotation has different verification than an API key
  • Keep the dual-secret overlap window; never remove the old value until every consumer is confirmed off it
  • Rehearse the rollback in staging before you run this in production, so the 3am path is one you have already walked
  • Use the per-stage verify blocks as gates — do not advance to the next step until the current one verifies clean
  • Note the total expected duration up front so the on-call knows how long the overlap window runs and when it is safe to remove the old secret
  • Confirm the blast radius in the preflight step so you know exactly which services break if the rotation goes wrong

Frequently Asked Questions

How does this runbook achieve zero downtime?
It enforces a dual-secret overlap window. The new secret is added alongside the old one, consumers are rolled to read both, and the old secret is removed only after every consumer is confirmed off it. Nothing ever has to read a value that no longer exists.
Will it produce real commands for my secret store?
Yes, set `[secret_store]` to your actual store, such as AWS Secrets Manager, and the runbook generates exact commands for it. Rotation steps differ between Secrets Manager, Vault, and Kubernetes secrets, so naming the right store keeps the commands accurate.
What stops me from deleting the old secret too early?
The runbook orders removal of the old secret as the final step, after confirming it is unused, and lists every reader from `[consumers]` so none is forgotten. Deleting the old secret before a straggling consumer migrates is the exact failure mode the dual-secret window prevents.
Does each step have a rollback if something goes wrong?
Yes, the prompt requires a verification and a rollback step at every stage, with exact commands. That means if any stage fails, you have a defined way to back out rather than improvising under pressure. Rehearse the rollback in staging before running it in production.
Engr Mejba Ahmed

Need this built for real?

Engr Mejba Ahmed

AI Developer · Software Engineer

I'm Mejba — I design and ship production AI systems, automations, and full-stack apps. If you want this turned into a working solution for your team, let's talk.

Mehr in Cybersecurity Prompts

Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support