PostgreSQL
Overview
This guide outlines the configuration steps for adding a PostgreSQL database as a resource in StrongDM.
When a PostgreSQL resource is added, StrongDM proxies client connections through a node (gateway, relay, or proxy cluster). This enables centralized access control, credential management, and audit logging. StrongDM supports standard PostgreSQL clients and drivers that use the PostgreSQL wire protocol.
To add a PostgreSQL datasource as a resource, you will need the database hostname, port, name, and a valid set of credentials. Optionally, you can store these credentials in a supported secrets manager and reference them from within StrongDM. The PostgreSQL server must be reachable from the selected StrongDM node and configured to accept connections from that node’s IP or network.
TLS is supported and can be configured during setup. For cloud-hosted PostgreSQL instances (for example, AWS RDS), ensure that security groups or firewall rules permit access from StrongDM components.
Use this guide to complete all necessary preparations to add this resource to your StrongDM environment; input the correct properties in the Admin UI, CLI, SDKs, or Terraform provider; and test for a successful connection. When done, you will be able to use the StrongDM Desktop application or CLI to connect to PostgreSQL.
For general information about how to add a database as a resource in StrongDM, see our main guide, Add a Datasource.
Supported Versions and Clients
StrongDM typically supports PostgreSQL version 9.6 and higher, including most mainstream versions such as 10.x, 11.x, 12.x, 13.x, 14.x, and 15.x. This range covers all currently maintained and production-ready PostgreSQL versions used in modern environments.
StrongDM is generally compatible with all PostgreSQL clients. To ensure successful connections to Postgres via StrongDM, we recommend the following best practices:
Use recent, actively maintained versions of your PostgreSQL client.
Avoid enabling GSSAPI, Kerberos, or custom SSL unless StrongDM explicitly supports those mechanisms for your use case.
Test client connections in a non-production environment first, especially if using GUI tools or ORMs with abstracted configuration layers.
Prerequisites
To add a PostgreSQL database as a resource in StrongDM, you need to meet several technical and configuration prerequisites to ensure smooth connectivity, security, and monitoring. Please ensure that the following requirements are met.
In StrongDM, you must have the following:
Administrator permission level
At least one operational node (gateway, relay, or proxy cluster) deployed in a location that can reach the resource's host and port over TCP (for PostgreSQL, the default port is 5432)
Valid database credentials (username and password) for the resource
If using secrets management tools for storing your database credentials, a Secret Store configured in StrongDM
Compatible version of PostgreSQL (generally version 9.6 or higher)
Connection tools such as psql or DBeaver to test the connection to the resource independently of StrongDM, if needed
On the PostgreSQL side, you must have the following:
Database user with appropriate privileges (SELECT for read-only, CRUD for admin use)
Authentication information, including the host, port, database name, username, and password
TLS/SSL set up to enable encryption, if required by your organization
For RDS IAM-authenticated instances, IAM roles and rds-db:connect policies correctly applied to the StrongDM node
Cloud-specific adjustments, if necessary, such as disabling incompatible settings (for example, request signing protocols) on managed PostgreSQL services
Ability to test reachability from the StrongDM node using tools such as telnet or psql, and confirm DNS resolution
Resource Management in StrongDM
After all prerequisites and prep work is done, you are ready to add the resource to StrongDM. This section provides instructions for adding the resource in either the StrongDM Admin UI, CLI, Terraform provider, or SDKs.
Set up and manage with the Admin UI
If using the Admin UI to add PostgreSQL as a resource to StrongDM, use the following steps.
Log in to the StrongDM Admin UI.
Go to Resources > Datasources.
Click Add datasource.
For Datasource Type, select PostgreSQL or PostgreSQL (mTLS).
Complete all required configuration properties for your selected datasource type.
Click Create to save the resource.
Click the resource name to view status, diagnostic information, and setting details.
Configuration Properties
The following configuration properties are required to define a PostgreSQL datasource in StrongDM. These settings control how StrongDM connects to the database, authenticates the connection, and optionally uses encryption or secret management. Each property must be correctly configured to ensure connectivity and access enforcement through StrongDM.
Please note that we provide two different versions of the PostgreSQL datasource type: PostgreSQL and PostgreSQL (mTLS).
The mutual TLS (mTLS) version of this datasource type is available if you need certificates to reach the PostgreSQL port, rather than username and password. This is of particular importance with GCP-hosted Postgres, for which it is the default expected behavior.
Display Name
Required
Meaningful name to display the resource throughout StrongDM; exclude special characters like quotes (") or angle brackets (< or >)
Datasource Type
Required
Select PostgreSQL
Proxy Cluster
Required
Defaults to "None (use gateways)"; if using proxy clusters, select the appropriate cluster to proxy traffic to this resource
Hostname
Required
Hostname for the resource; must be accessible to a gateway or relay
Port
Required
Port to use when connecting to the resource; default port value is 5432
Connectivity Mode
Required
Select either Virtual Networking Mode, which lets users connect to the resource with a software-defined, IP-based network; or Loopback Mode, which allows users to connect to the resource using the local loopback adapter in their operating system
IP Address
Optional
If Virtual Networking Mode is the selected connectivity mode, an IP address value in the range 100.64.0.1
to 100.127.255.252
(default 100.64.100.100
); optionally change the default value for Virtual Networking Mode to your preferred IP address value, as long as it's a valid IP address defined by your organization settings; edit either on this form or later on the Admin UI's Port Overrides page after the resource is created; if Loopback Mode is the selected connectivity mode, the IP address value must be within the range of 127.0.0.1
to 127.0.0.34
Port Override
Optional
If Virtual Networking Mode is the selected connectivity mode, a port value between 1 and 65535 that is not already in use by another resource; if Loopback Mode is the selected connectivity mode, a port value between 1024 to 64999 that is not already in use by another resource; when left empty, the system assigns the default port to this resource; preferred port also can be modified later from the Port Overrides settings
DNS
Optional
If Virtual Networking Mode is the selected connectivity mode, a unique hostname alias for this resource; when set, causes the desktop app to display this resource's human-readable DNS name (for example, k8s.my-organization-name
) instead of the bind address that includes IP address and port (for example, 100.64.100.100:5432
)
Database
Required
Database name you would like to connect to using this datasource
Secret Store
Optional
Credential store location; defaults to Strong Vault
Username
Required
Username to utilize when connecting to this datasource; displays when Secret Store integration is not configured for your organization or when StrongDM serves as the Secret Store type
Password
Required
Password for the user connecting to this datasource; displays when Secret Store integration is not configured for your organization or when StrongDM serves as the Secret Store type
Username (path)
Required
Path to the secret in your Secret Store location (for example, path/to/credential?key=optionalKeyName
where key argument is optional); required when using a non-StrongDM Secret Store type
Password (path)
Required
Path to the secret in your Secret Store location (for example, path/to/credential?key=optionalKeyName
where key argument is optional); required when using a non-StrongDM Secret Store type
Override Database
Optional
By default, StrongDM will limit all connections to the configured PostgreSQL database; uncheck the box to disable this option
Resource Tags
Optional
Datasource Tags consisting of key-value pairs <KEY>=<VALUE>
(for example, env=dev
)
Set up and manage with the CLI or Terraform
This section provides examples of how to configure and manage the resource using either the StrongDM CLI or Terraform provider. For more information and examples, please see the CLI Reference or Terraform provider documentation.
# Add a PostgreSQL datasource
sdm admin datasources add postgres
--name "pg-prod"
--hostname "db.example.com"
--port 5432
--database "production"
--username "sdm_user"
--password "secret"
--scheme "postgres"
--port-override 15432
--secret-store-id "ss-abcdef123456"
--tags "env:prod,team:data"
--tls-required true
--ca-cert "$(cat ca.crt)"
--client-cert "$(cat client.crt)"
--client-key "$(cat client.key)"
# Clone a datasource
sdm admin datasources clone RESOURCE_ID --name "pg-prod-clone"
# Update a datasource
sdm admin datasources update RESOURCE_ID --port 5433 --tags "env:staging"
# Delete a datasource
sdm admin datasources delete RESOURCE_ID
Set up and manage with SDKs
In addition to the Admin UI, CLI, and Terraform, you may configure and manage your resource with any of the following SDK options: Go, Java, Python, and Ruby. Please see the following references for more information and examples.
Test the Connection
After you have added your resource to StrongDM, follow these steps to test the connection to it and verify that a newly added PostgreSQL resource in StrongDM is functioning correctly.
Assign yourself access by ensuring that your user or role has access to the PostgreSQL resource. In the StrongDM Admin UI, go to Access > Roles, and verify that the PostgreSQL resource is attached to a role you’re in.
In the CLI, run
sdm status
to list the available datasources. Confirm that the PostgreSQL resource is available.Launch a PostgreSQL client tool (for example, psql, DBeaver, or DataGrip) and connect to the resource. For example, if using the CLI and psql:
sdm connect pg-prod
This will open a shell with environment variables such as
PGHOST
,PGPORT
, andPGUSER
set to use StrongDM.Then test it:
psql "$PGDATABASE"
Once connected, run a simple SQL command to confirm the connection is functional:
SELECT version();
You can also try querying a known table if one exists:
SELECT * FROM information_schema.tables LIMIT 5;
In the StrongDM Admin UI, go to Logs > Queries to check the audit logs and confirm your session and SQL statements are captured.
If you set TLS to be required, inspect the connection to ensure TLS is used (
sslmode=verify-full
or the equivalent should be set).
Troubleshooting
If you are unable to connect to the resource, try the following:
Ensure that all the prerequisites are met.
Check the resource configuration details and ensure that all properties are set correctly.
Run
sdm status
in the CLI and confirm the resource appears in your list of accessible datasources.Ensure your user is assigned to a role that has access to the PostgreSQL resource.
Check the node status to ensure that the gateway, relay, or proxy node can reach the PostgreSQL host and port. SSH into the node (if allowed) and run
nc -zv db.example.com 5432
.Confirm that your PostgreSQL instance allows inbound traffic from your StrongDM node's IP or subnet.
For AWS-hosted databases, check VPC security groups and NACLs.
Check that the username and password (or secret store reference) are correct. Try connecting manually with psql using those credentials, bypassing StrongDM to isolate the issue.
If you're using a secrets manager, ensure the secret paths are correct. Check that StrongDM has appropriate permissions or IAM roles to retrieve them. In the Admin UI, verify that the secrets are resolving (not marked as invalid).
If
tls_required
is enabled, verify that thePostgreSQL server supports TLS and is properly configured (ssl=on
inpostgresql.conf
). Also check that StrongDM was given the correct ca_cert, client_cert, and client_key.Ensure that certificates are not expired, match the server’s expected common name (CN)m and are PEM-encoded and valid.
Check the logs in the StrongDM Admin UI. Go to Logs > Connections or Logs > Queries and look for auth failures, timeouts, TLS handshake errors, and secret resolution errors.
In the CLI, run
sdm connect <RESOURCE> --verbose
to get more debug info during the connection process.You can also test outside of StrongDM to understand if the issue is with PostgreSQL itself. For example, use
psql -h db.example.com -U sdm_user -d production
.
If you still encounter issues, please consult the StrongDM Help Center.
Be prepared to provide the following information to StrongDM Support, so that they can inspect logs and confirm node and resource health:
Resource name or ID
CLI error output or logs
Node name and region
Timestamps of failed attempts
Last updated
Was this helpful?