Skip to main content
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.

Table of Contents

  1. Check Vault Status
  2. Initialize Vault
  3. Authenticate with the Initial Root Token
  4. Revoke the Root Token
  5. Begin Root Token Generation
  6. Submit Recovery Keys
  7. Decode the New Root Token
  8. Authenticate with the New Root Token
  9. Verify Restored Access

1. Check Vault Status

Start with a fresh, uninitialized Vault server configured with AWS KMS auto-unseal:
Example output:
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:
Sample output:
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:
You should see:

4. Revoke the Root Token

Revoking the root token simulates loss of access:
After revocation, any Vault API call will return a 403 permission denied:
Now no valid authentication mechanism remains.

5. Begin Root Token Generation

Initialize the root-token recovery process:
Output includes:
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):
Repeat for each key: After the third key, you’ll receive an Encoded Token:

7. Decode the New Root Token

Use the Encoded Token and OTP to retrieve the actual root token:
Result:

8. Authenticate with the New Root Token

Log in with your newly generated root token:
Expected output:

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.

Watch Video

Practice Lab