PostgreSQL Connection
Learn how to configure a PostgreSQL Connection for Infisical.
Infisical supports connecting to PostgreSQL using a database role.
Configure a PostgreSQL Role for Infisical
Create a Role
Infisical recommends creating a designated role in your PostgreSQL database for your connection.
Grant Relevant Permissions
Depending on how you intend to use your PostgreSQL connection, you’ll need to grant one or more of the following permissions.
To learn more about PostgreSQL’s permission system, please visit their documentation.
For Secret Rotations, your Infisical user will require the ability to alter other users’ passwords:
For Secret Rotations, your Infisical user will require the ability to alter other users’ passwords:
Get Connection Details
You’ll need the following information to create your PostgreSQL connection:
host
- The hostname or IP address of your PostgreSQL serverport
- The port number your PostgreSQL server is listening on (default: 5432)database
- The name of the specific database you want to connect tousername
- The role name of the login created in the steps abovepassword
- The role password of the login created in the steps abovesslCertificate
(optional) - The SSL certificate required for connection (if configured)
If you are self-hosting Infisical and intend to connect to an internal/private IP address, be sure to set the ALLOW_INTERNAL_IP_CONNECTIONS
environment variable to true
.
Create Connection in Infisical
-
Navigate to the App Connections tab on the Organization Settings page.
-
Select the PostgreSQL Connection option.
-
Select the Username & Password method option and provide the details obtained from the previous section and press Connect to PostgreSQL.
Optionally, if you’d like Infisical to manage the credentials of this connection, you can enable the Platform Managed Credentials option. If enabled, Infisical will update the password of the connection on creation to prevent external access to this database role.
- Your PostgreSQL Connection is now available for use.
-
Navigate to the App Connections tab on the Organization Settings page.
-
Select the PostgreSQL Connection option.
-
Select the Username & Password method option and provide the details obtained from the previous section and press Connect to PostgreSQL.
Optionally, if you’d like Infisical to manage the credentials of this connection, you can enable the Platform Managed Credentials option. If enabled, Infisical will update the password of the connection on creation to prevent external access to this database role.
- Your PostgreSQL Connection is now available for use.
To create a PostgreSQL Connection, make an API request to the Create PostgreSQL Connection API endpoint.
Optionally, if you’d like Infisical to manage the credentials of this connection, you can set the isPlatformManagedCredentials
option to true
.
If enabled, Infisical will update the password of the connection on creation to prevent external access to this database role.
Sample request
Sample response
Was this page helpful?