How do Vault dynamic database credentials work operationally, and what can go wrong?
AdvancedProductionSecrets Management Architecture
Answer
Vault holds a privileged DB connection and creates a unique user per lease with a TTL, revoking it when the lease expires.
vault write database/roles/app-ro db_name=orders \
creation_statements="CREATE ROLE \"{{name}}\" WITH LOGIN PASSWORD '{{password}}' VALID UNTIL '{{expiration}}'; GRANT SELECT ON ALL TABLES IN SCHEMA public TO \"{{name}}\";" \
default_ttl=1h max_ttl=24h
vault read database/creds/app-ro
Gotchas: connection pools keep using credentials past expiry unless the app reloads them; thousands of short leases can stress Vault and the DB user table; if Vault is down, new pods cannot start. Mitigate with sensible TTLs, Vault Agent templating that triggers app reload, and HA Vault.
More on Secrets Management Architecture
How would you design a secrets management architecture for a multi-cloud, multi-cluster company?AdvancedVault vs AWS Secrets Manager: how do you choose in production?IntermediateHow do you run Vault in production for high availability?AdvancedHow do you solve the "secret zero" problem?IntermediateHow does AWS Secrets Manager rotation work under the hood?IntermediateHow do you rotate a secret without downtime?Intermediate