Interview Prep/DevSecOps/Secrets Management Architecture

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.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets Management Architecture