Course contentsShow
← Cloud and Infrastructure
Lesson 2265 of 2,98948. Secrets ManagementFree lesson

Vault Leases and Revocation

Understanding lease TTLs, renewal, and how Vault automatically revokes expired credentials.

Vault Leases and Revocation

What You'll Learn

You'll learn how Vault attaches time-to-live (TTL) leases to secrets, enabling automatic expiration and revocation of credentials for enhanced security.

The Lease Lifecycle

Every dynamic secret Vault generates comes with a lease — a time-limited contract that defines how long the credential is valid. Think of it like a rental car: you get the keys for a specific duration, and when the lease expires, the keys stop working automatically.

How Leases Work

When Vault issues a secret (like database credentials from the Database Secrets Engine), it attaches:

  • Lease ID: A unique identifier for that specific secret instance
  • TTL (Time-to-Live): How long the credential remains valid
  • Max TTL: The maximum duration a lease can be renewed to

For example, you might receive database credentials with a 1-hour TTL and a 24-hour max TTL.

Lease Renewal

Before a lease expires, applications can request a renewal — extending the credential's lifetime without generating new ones. This is like extending your car rental. However, you can't renew indefinitely; once you hit the max TTL, you must request entirely new credentials.

Automatic Revocation

When a lease expires (or is manually revoked), Vault automatically revokes the underlying credential. For database secrets, Vault connects to the database and deletes the user. For cloud IAM credentials, it removes the access key. This automatic cleanup ensures no orphaned credentials linger in your systems.

You can also manually revoke leases using the lease ID, immediately invalidating credentials — critical when an application is compromised.

Key Takeaway: Vault leases provide time-bound credentials with automatic expiration and revocation, ensuring secrets don't outlive their intended use and reducing the attack surface from long-lived credentials.