In this tutorial, you’ll learn how to recover access to your Vault cluster by regenerating a root token using the recovery keys. We’ll cover status verification, initialization, revocation, root token generation, and final validation.Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
Table of Contents
- Check Vault Status
- Initialize Vault
- Authenticate with the Initial Root Token
- Revoke the Root Token
- Begin Root Token Generation
- Submit Recovery Keys
- Decode the New Root Token
- Authenticate with the New Root Token
- Verify Restored Access
1. Check Vault Status
Start with a fresh, uninitialized Vault server configured with AWS KMS auto-unseal:Vault is uninitialized and sealed. The
Recovery Seal Type shows AWS KMS for auto-unseal.2. Initialize Vault
Generate the recovery key shares and the initial root token:Securely distribute and store your recovery keys and initial root token. Anyone holding 3 of 5 keys can generate a new root token.
3. Authenticate with the Initial Root Token
Log in using the root token you just received:4. Revoke the Root Token
Revoking the root token simulates loss of access:403 permission denied:
5. Begin Root Token Generation
Initialize the root-token recovery process:Save the Nonce and One-Time Password (OTP). You will need them to decode the final token.
6. Submit Recovery Keys
Enter recovery keys one at a time until you reach the threshold (3/3):| Attempt | Command | Progress |
|---|---|---|
| 1 | vault operator generate-root | 1/3 |
| 2 | vault operator generate-root | 2/3 |
| 3 | vault operator generate-root | 3/3 |
7. Decode the New Root Token
Use theEncoded Token and OTP to retrieve the actual root token:
8. Authenticate with the New Root Token
Log in with your newly generated root token:9. Verify Restored Access
Confirm Vault is functional again:Example HCL Policy
Regenerating the root token with recovery keys ensures you can restore full access even if the original token is lost or revoked. For more details, see the Vault CLI Generate-Root Documentation.