Why Use Periodic Tokens?
- Unlimited lifetime: No
explicit_max_ttllimit (set to0s). - Automatic renewal: Reset the TTL back to the full period on each successful renewal.
- Safe revocation: You can revoke them at any time without leaving orphaned credentials.
Periodic tokens require careful management. Failing to renew before TTL expiry will invalidate the token and disrupt any dependent service.
Required Permissions
You need one of the following to create a periodic token:
Here’s an example HCL policy granting the necessary permissions for non-root users:
How Periodic Tokens Work
- Initial TTL
On creation, the token receives atoken_duration(e.g.,24h). - Renewal Period
Theperiodfield determines how far into the future you can renew (e.g.,24h). - Infinite Renewal
Withexplicit_max_ttl = 0s, you can renew the token indefinitely—until you choose to revoke it.
Creating a Periodic Token
Use the Vault CLI to generate a periodic token. In this example, we assign thetraining policy and set a 24-hour renewal period:
token_duration: Initial TTLtoken_renewable:trueperiod: Renewal window
Inspecting a Periodic Token
To view the properties of your token:Renewing a Periodic Token
Callvault token renew before the ttl expires to reset the TTL back to the full period:
Automate renewal for long-lived services using a cron job or HashiCorp Consul Template to avoid manual intervention.