Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for HashiCorp Vault Difficulty: Advanced ClaudeChatGPT

Vault Auto-Unseal and Recovery Key Procedure Prompt

Design HashiCorp Vault auto-unseal against a cloud KMS or HSM, plus the recovery-key custody, rekey, and seal-migration procedures that keep the cluster recoverable when the KMS is unavailable.

Target user
Platform and security engineers running HashiCorp Vault
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior secrets-platform engineer who has designed Vault seal configurations for regulated environments and who plans for the day the KMS key is unavailable, because that day decides whether you have a cluster or an outage.

I will provide:
- Where Vault runs (AWS, Azure, GCP, on-prem, hybrid) and the storage backend
- Available key-management options (cloud KMS, an HSM, or another Vault cluster for Transit seal)
- Compliance requirements around key custody, split knowledge, and audit
- Current seal configuration, if any, and how many people hold unseal or recovery keys today
- My Vault version and edition

Your job:

1. **Choose the seal type and justify it.** Compare `awskms`, `gcpckms`, `azurekeyvault`, `ocikms`, and `transit` seals — all available in Community edition — against the `pkcs11` HSM seal, which is Enterprise-only. Also note that multiple simultaneous seals (seal HA) is an Enterprise feature. Recommend one for my environment and say what its dependency graph is: what must be reachable and healthy for Vault to start.

2. **Be precise about what auto-unseal changes.** Explain that with auto-unseal the KMS holds the unseal key and Vault seals/unseals itself on start, so Shamir key shares are replaced by *recovery keys*. Recovery keys cannot unseal Vault — they authorize privileged operations such as generating a root token and rekeying. Correct the common misconception directly: losing all recovery keys does not seal your cluster, but it does remove your ability to mint a root token or rekey, and losing the KMS key does make the data unrecoverable.

3. **Write the seal stanza and the KMS-side setup.** Give the `seal` block for my chosen provider with the correct parameters, plus the key policy or IAM grant on the KMS side scoped to exactly the operations Vault needs (encrypt and decrypt against that one key) for exactly the identity Vault runs as. Explicitly cover what the key policy must NOT allow — key deletion or disabling by the Vault runtime identity — and require that the KMS key have deletion protection and its own backup or multi-region replication where the provider offers it.

4. **Design recovery-key custody.** Set the recovery share count and threshold to enforce split knowledge (never a threshold of 1). Specify who holds shares, that shares must be distributed to distinct individuals and never stored together or in the same system Vault protects, whether to encrypt shares to individual PGP keys at init time, and the physical or vaulted storage for each. Include a periodic custody attestation, because the real failure is discovering a share holder left the company two years ago.

5. **Give the initialization and verification sequence.** Show `vault operator init` with recovery share and threshold flags for an auto-unseal configuration, capturing the recovery keys and initial root token, immediately distributing shares, then revoking the initial root token (`vault token revoke`) once a real auth method and admin policy exist. Verify by checking `vault status` for seal type, initialization, and seal state, and by restarting a node to confirm it unseals unattended.

6. **Document rekey and seal migration.** Cover `vault operator rekey -target=recovery` for rotating recovery shares (with the nonce-and-quorum flow), `vault operator rotate` for the encryption key, and the seal-migration procedure using `vault operator unseal -migrate` for moving between Shamir and auto-unseal or between KMS providers. State the prerequisites and the fact that migration requires quorum and a defined maintenance window — this is not an in-flight change.

7. **Write the KMS-unavailable runbook.** This is the section that earns its keep. What `vault status` and the server logs look like when the KMS is unreachable, why the cluster cannot unseal and existing nodes may keep serving until restarted, the escalation path to the cloud provider, whether a standby region or a second seal (Enterprise) would help, and the decision point for restoring from a storage snapshot into a cluster with a working seal. Include how to test this deliberately in non-production by denying the KMS grant.

8. **Specify monitoring and audit.** Alert on seal state changes, on failed unseal attempts, on KMS API errors from the Vault identity, on root-token generation, and on any rekey or seal-migration operation. Ensure the audit device is enabled before any of this and that KMS-side CloudTrail-equivalent logging captures every decrypt call against the unseal key.

Output as: (a) the seal-type recommendation with its dependency graph, (b) the seal stanza and the scoped KMS key policy, (c) recovery share/threshold values and the custody plan with attestation cadence, (d) the init and verification command sequence, (e) rekey and seal-migration procedures with prerequisites, (f) the KMS-unavailable runbook including the non-production test, (g) alerting rules.

Never store recovery key shares together, in the Vault they protect, or in a system a single person can access. Revoke the initial root token as soon as a real auth path exists, and mark clearly which features in your answer are Enterprise-only so I don't plan around something I can't run.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Why this prompt works

Auto-unseal is adopted for convenience and then misunderstood in a specific, dangerous way: people assume recovery keys are unseal keys under a new name. They are not. The KMS holds the unseal key; recovery keys only authorise privileged operations like rekeying and root generation. Correcting that misconception directly, as step two does, changes two decisions at once — losing every recovery share does not seal your cluster, but losing the KMS key makes the data unrecoverable. Teams that never internalise this guard the wrong artefact, protecting paper shares in a safe while the KMS key sits with default deletion settings and a broad IAM grant.

That is why the key policy step specifies what the grant must not allow, not just what it must. A Vault runtime identity that can encrypt and decrypt against one key is correct; the same identity able to schedule that key for deletion is a single API call away from an unrecoverable cluster. Pairing scoped permissions with deletion protection and provider-side replication turns the seal dependency from an invisible assumption into a documented part of the architecture — which is exactly what the required dependency graph in step one is for.

The KMS-unavailable runbook is the section that justifies the whole exercise, and it is deliberately placed before monitoring rather than after. Everyone plans the happy path; almost nobody knows what vault status looks like when the KMS is unreachable, whether running nodes keep serving until restarted, or at what point you stop waiting on the cloud provider and restore a snapshot into a cluster with a working seal. Requiring a deliberate non-production test by denying the KMS grant converts that runbook from a document into something that has actually been executed once, under conditions you chose.

Related prompts

More HashiCorp Vault prompts & error guides

Browse every HashiCorp Vault prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.