The Infisical PostgreSQL secret rotation allows you to automatically rotate your PostgreSQL database user’s password at a predefined interval.

Prerequisite

  1. Create a user with the required permission in your SQL instance.

Set up Dynamic Secrets with PostgreSQL

1

Open Secret Overview Dashboard

Open the Secret Overview dashboard and select the environment in which you would like to add a dynamic secret.
2

Click on the `Add Dynamic Secret` button

Add Dynamic Secret Button
3

Select `SQL Database`

Dynamic Secret Modal
4

Provide the inputs for dynamic secret parameters

Secret Name
string
required
Name by which you want the secret to be referenced
Default TTL
string
required
Default time-to-live for a generated secret (it is possible to modify this value when a secret is generate)
Max TTL
string
required
Maximum time-to-live for a generated secret
Service
string
required
Choose the service you want to generate dynamic secrets for
Host
string
required
Database host
Port
number
required
Database port
User
string
required
Username that will be used to create dynamic secrets
Password
string
required
Password that will be used to create dynamic secrets
Database Name
string
required
Name of the database for which you want to create dynamic secrets
CA(SSL)
string
A CA may be required if your DB requires it for incoming connections. AWS RDS instances with default settings will requires a CA which can be downloaded here.
Dynamic Secret Setup Modal
5

(Optional) Modify SQL Statements

If you want to provide specific privileges for the future generated dynamic secrets, you are able to specify them as SQL statements.Modify SQL Statements Modal
6

Click `Submit`

After submitting the form, you will see a dynamic secret creates in the dashboard.
If this step fails, you might have to add the CA certficate.
Dynamic Secret
7

Generate dynamic secrets

Now that the dynamic secret is created, you can start generating unique secret values by specifying the Time-to-live within the predefined range.Provision LeaseAfter you click the Submit button, a new secret lease will be generated and the Database User and Database Password will be shown.Provision Lease
8

Audit or Revoke Leases

As soon as you have generated a few secret leases, you will be able to access them by clicking Generate on the dynamic secret row. In this modal, you are able to see the expiration time or delete a secret preemptively.Provision Lease