- Verifying enabled secrets engines
- Enabling the Database Secrets Engine
- Configuring the database connection
- Creating a dynamic role
- Rotating root credentials
- Generating dynamic credentials
- Revoking leases and cleanup
Prerequisites
- A running Vault server (
vault statusreturns OK) - Network connectivity from Vault to your RDS instance (security group, firewall)
- AWS RDS PostgreSQL endpoint, admin username, and password
1. Verify Enabled Secrets Engines
Start by listing all secrets engines currently enabled:database/ engine should not appear yet.
2. Enable the Database Secrets Engine
Enable the database engine at its default mount path:3. Configure the Database Connection
Create a Vault “database configuration” namedhcvop-db that points to your AWS RDS PostgreSQL instance:
Success message:
Vault does not show the stored
username and password for security reasons.4. Create a Dynamic Role
A Vault “role” defines how dynamic users are created and what permissions they have:- db_name: Must match the configuration name (
hcvop-db). - default_ttl/max_ttl: Time-to-live for generated credentials.
- creation_statements: SQL executed to create a new user with permissions.
5. Rotate the Root Credentials
Regularly rotating your admin credentials reduces risk:After rotation, the old admin credentials become invalid immediately. Update any systems relying on these credentials.