PostgreSQL Destination Setup Guide
Follow this guide to configure a PostgreSQL database as a Fivetran destination. This guide applies to self-hosted PostgreSQL, Amazon Aurora PostgreSQL, Amazon RDS for PostgreSQL, Azure Database for PostgreSQL, Google Cloud SQL for PostgreSQL, Databricks Lakebase for PostgreSQL, and PostgreSQL-compatible databases such as Neon and Supabase.
When a step contains implementation-specific instructions, follow the instructions for your PostgreSQL implementation. Otherwise, follow the common instructions.
Prerequisites
To connect PostgreSQL to Fivetran, make sure you have the required database, accounts, and connection details described in the following sections.
Database requirements: A PostgreSQL v9.1 or later database. For Databricks Lakebase, PostgreSQL v16 is required.
Account requirements:
- A PostgreSQL user account with
CREATEROLEprivilege and database ownership or superuser access to create roles and grant permissions - A Fivetran account with permission to create or manage destinations
- A PostgreSQL user account with
Connection requirements:
- Database host IP address (for example,
1.2.3.4) or domain name (for example,your.server.com) - Database port. The default PostgreSQL port is
5432.
- Database host IP address (for example,
Setup instructions
Choose your deployment model
Before setting up your destination, decide which deployment model best suits your organization's requirements. This destination supports both SaaS and Hybrid deployment models, offering flexibility to meet diverse compliance and data governance needs.
See our Deployment Models documentation to understand the use cases of each model and choose the model that aligns with your security and operational requirements.
You must have an Enterprise or Business Critical plan to use the Hybrid Deployment model.
Choose authentication method
Fivetran supports the following authentication methods for PostgreSQL destinations:
- Username and password: Uses a PostgreSQL username and password. This method is available for all supported PostgreSQL implementations.
- AWS IAM: Uses AWS Identity and Access Management (IAM) credentials instead of a database password. This method is available for Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL, except for connections that use AWS PrivateLink.
Choose an authentication method and follow the corresponding instructions.
Username and password
To use username and password authentication, create a dedicated database user for Fivetran.
Connect to your PostgreSQL database and execute the following command. Replace
<username>with a username of your choice (for example,fivetran) and<password>with a password of your choice.CREATE USER <username> PASSWORD '<password>';Grant the following database privileges to the user:
CREATE: Allows the user to create schemas in the databaseTEMPORARY: Allows the user to create temporary tables in the database
Replace
<database>with the name of your database, and then execute the following command:GRANT CREATE, TEMPORARY ON DATABASE <database> TO <username>;Make a note of the username and password. You will need them to configure your destination in Fivetran.
AWS IAM
To use IAM authentication, configure your Aurora PostgreSQL cluster or Amazon RDS for PostgreSQL instance and create the AWS and PostgreSQL resources that Fivetran requires.
Find External ID
- Log in to your Fivetran account.
- On the navigation menu, click Destinations.
- Click + Add destination.
- Enter a Destination name of your choice, and then click Add.
- Select PostgreSQL as the destination type.
- In the Authentication Method drop-down menu, select IAM.
- Make a note of the External ID. You will need it to create an IAM role for Fivetran.
The External ID is associated with your Fivetran account and does not change if you close and reopen the setup form.
Enable IAM authentication
Log in to the Amazon RDS console.
On the navigation menu, click Databases.
Select your Aurora PostgreSQL cluster or Amazon RDS for PostgreSQL instance, and then click Modify.
Expand Additional credentials settings, and then choose the appropriate option:
- Aurora PostgreSQL: Choose IAM database authentication.
- Amazon RDS for PostgreSQL: Choose Password and IAM database authentication.
Click Continue.
In the Schedule modifications section, choose Apply immediately.
Complete the modification:
- Aurora PostgreSQL: Click Modify cluster.
- Amazon RDS for PostgreSQL: Click Modify DB instance.
Create database user
Create a dedicated database user for Fivetran. You will need this username when you create the IAM policy.
Connect to your PostgreSQL database and execute the following command to create a dedicated database user for Fivetran:
CREATE USER <username>;Replace
<username>with a username of your choice (for example,fivetran).Grant the
rds_iamrole to the user:GRANT rds_iam TO <username>;Grant the
CREATEandTEMPORARYdatabase privileges to the user. Replace<database>with the name of your database:GRANT CREATE, TEMPORARY ON DATABASE <database> TO <username>;Make a note of the username. You will need it when you create the IAM policy and configure your destination in Fivetran.
Do not set a password for the database user. Fivetran uses AWS IAM to authenticate the user.
Create IAM policy
Log in to the IAM console.
On the navigation menu, click Policies.
Click Create policy.
Go to the JSON tab.
Copy the following policy and paste it into the JSON editor.
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "rds-db:connect" ], "Resource": "arn:aws:rds-db:REGION:ACCOUNT_ID:dbuser:RESOURCE_ID/DB_USERNAME" } ] }Replace the following values in the
ResourceARN:REGIONwith the AWS region of your cluster or instance (for example,us-east-1)ACCOUNT_IDwith your AWS account IDRESOURCE_IDwith the DB cluster resource ID for Aurora PostgreSQL or the DB instance resource ID for Amazon RDS for PostgreSQLDB_USERNAMEwith the username of the PostgreSQL user you created for Fivetran
Click Next.
In the Policy name field, enter a name for the policy, and then click Create policy.
Create IAM role
- On the navigation menu, click Roles.
- Click Create role.
- Choose AWS account as the Trusted entity type.
- Under An AWS account, choose Another AWS account.
- In the Account ID field, enter the Fivetran AWS account ID (
834469178297). - Select the Require external ID checkbox.
- In the External ID field, enter the external ID you found.
- Click Next.
- Select the checkbox for the IAM policy you created, and then click Next.
- In the Role name field, enter a name for the role, and then click Create role.
- In the Roles page, select the role you created.
- Make a note of the ARN. You will need it to configure your destination in Fivetran.
Choose connection method
Choose a connection method to connect Fivetran to your PostgreSQL database, and then follow the corresponding instructions.
Direct connection
A direct connection allows Fivetran to connect directly to your PostgreSQL database over the public internet.
Configure your database firewall, security group, or other network access controls to allow the following traffic:
- Inbound: Allow connections to your PostgreSQL host and port (the default port is
5432) from the Fivetran IP addresses for your destination region. - Outbound: Allow connections from ports
1024–65535to the Fivetran IP addresses for your destination region.
If you are connecting to Supabase, use the direct connection method with the IPv4 add-on.
SSH tunnel
An SSH tunnel allows Fivetran to connect to your PostgreSQL database through an SSH server in your network. Use this connection method when Fivetran cannot connect directly to your database host.
To configure an SSH tunnel:
In the destination setup form, select Connect via an SSH tunnel from the Connection method drop-down menu.
In the SSH Key Type drop-down menu, select the SSH key type you want to use:
- RSA
- ECDSA
Copy the Public Key provided by Fivetran.
Add the public SSH key to the
authorized_keysfile on your SSH server.Add the entire public SSH key on a single line. Do not add line breaks when copying the key.
For additional SSH server configuration requirements, see our SSH tunnel documentation.
Private networking
Private networking allows Fivetran to connect to your PostgreSQL database without sending traffic over the public internet.
- You must have a Business Critical plan to use private networking.
- Fivetran does not support this connection method for Databricks Lakebase for PostgreSQL.
Fivetran supports the following private networking options:
- AWS PrivateLink: Used for AWS VPCs and AWS-hosted or on-premises services. For more information, see our AWS PrivateLink documentation.
- Azure Private Link: Used for Azure virtual networks (VNets) and Azure-hosted or on-premises services. For more information, see our Azure Private Link documentation.
- Google Cloud Private Service Connect: Used for Google Cloud VPC networks and Google Cloud-hosted or on-premises services. For more information, see our Google Cloud Private Service Connect documentation.
Proxy Agent
Proxy Agent allows Fivetran to connect to your PostgreSQL database through an agent installed in your network. The agent establishes an outbound connection to Fivetran, enabling secure communication between Fivetran and your destination.
For more information, see our Proxy Agent documentation.
- You must have a Standard, Enterprise, or Business Critical plan to use Proxy Agent.
- Fivetran does not support this connection method for Databricks Lakebase for PostgreSQL.
Configure implementation-specific settings
If your PostgreSQL implementation is listed below, follow the corresponding instructions.
Amazon Aurora PostgreSQL and Amazon RDS for PostgreSQL
If Fivetran connects directly to your database endpoint, configure the VPC security group associated with your database instance to allow access from Fivetran. If your database subnets use custom or restrictive network access control lists (ACLs), make sure the ACL rules also allow traffic between Fivetran and your database.
Configure security group
Log in to the Amazon RDS console.
On the navigation menu, click Databases.
Select your database:
- Amazon Aurora PostgreSQL: Expand your database cluster and select the database instance you want to use as your destination.
- Amazon RDS for PostgreSQL: Select the database instance you want to use as your destination.
Go to the Connectivity & security tab.
Make a note of the database Port. You will need it to complete the security group configuration.
Expand the Additional configurations section.
In the Security section, click the link displayed in the VPC security groups field.
Click the link in the Security group ID column.
Go to the Inbound rules tab and click Edit inbound rules.
Click Add rule.
In the Port range field, enter the port number you found earlier.
In the Source drop-down menu, select Custom, and then enter the Fivetran IP addresses.
Click Save rules.
Configure network ACLs
Configure network ACLs only if your database subnets use custom or restrictive ACLs. The default network ACL typically allows all inbound and outbound traffic and does not require modification.
Log in to the Amazon RDS console.
On the navigation menu, click Databases.
Expand your database cluster and select the database instance you want to use as your destination.
Go to the Connectivity & security tab.
In the Connect using section, select Endpoints.
Expand the Additional configurations section.
In the Networking section, click the link displayed in the VPC field.
Click the link in the VPC ID column.
In the Details section, click the link displayed in the Main network ACL field.
Click the link in the Network ACL ID column.
Go to the Inbound rules tab.
- If you use the default VPC that AWS automatically created, the inbound rules may already allow all incoming traffic. This is indicated by an
ALLOWrule with the source0.0.0.0/0listed above theDENYrule. - If your inbound rules do not include an
ALL - 0.0.0.0/0 - ALLOWrule, edit the rules to allow the Fivetran IP addresses to access your database port.
For more information, see Amazon documentation.
- If you use the default VPC that AWS automatically created, the inbound rules may already allow all incoming traffic. This is indicated by an
Go to the Outbound rules tab. If your outbound rules do not include an
ALL - 0.0.0.0/0 - ALLOWrule, update the rules to allow outbound traffic to the Fivetran IP addresses on ephemeral ports1024–65535.
Azure Database for PostgreSQL
If you connect to your Azure Database for PostgreSQL flexible server using its public endpoint, configure firewall rules to allow the Fivetran IP addresses.
Log in to the Azure portal.
Go to your Azure Database for PostgreSQL flexible server.
On the navigation menu, go to Settings > Networking.
Under Firewall rules, add a firewall rule for each Fivetran IP address.
For each rule:
i. Enter a name for the rule.
ii. Enter the Fivetran IP address in both the Start IP address and End IP address fields.
Click Save.
Databricks Lakebase for PostgreSQL
Enable native Postgres password authentication so that Fivetran can connect using a PostgreSQL username and password.
For more information about Lakebase authentication methods, see Databricks documentation.
To enable native Postgres password authentication:
- Log in to your Databricks workspace.
- From the app switcher, select Lakebase Postgres.
- Select your project.
- Go to Settings > Database connections.
- Select the Password (Native Postgres roles) checkbox.
- Click Save.
Google Cloud SQL for PostgreSQL
If you connect to your Cloud SQL for PostgreSQL instance using its public IP address, configure an authorized network for the Fivetran IP addresses.
- Log in to the Google Cloud console.
- On the navigation menu, click Cloud SQL.
- Select the Cloud SQL for PostgreSQL instance that you want to connect to Fivetran.
- On the SQL navigation menu, click Connections.
- Go to the Networking tab.
- Select the Public IP checkbox.
- In the Authorized networks section, click Add a network or expand New IP range.
- In the Name field, enter a name for the authorized network rule (for example,
fivetran). - In the IP range field, enter a Fivetran IP address or CIDR range. Add a separate rule for each additional Fivetran IP address.
- Click Done.
- Click Save.
Complete Fivetran configuration
Log in to your Fivetran account.
On the navigation menu, click Destinations, and then click + Add destination.
Enter a Destination name of your choice, and then click Add.
Click Select for PostgreSQL.
(Enterprise and Business Critical accounts only) Select your deployment model:
- SaaS Deployment
- Hybrid Deployment
If you selected Hybrid Deployment, click Select Hybrid Deployment Agent and do one of the following:
- To use an existing agent, select the agent you want to use, and click Use Agent.
- To create a new agent, click Create new agent and follow the setup instructions specific to your container platform.
(Not applicable to Hybrid Deployment) Select your Connection method.
Provide the details required for your selected connection method.
Connect directly
- In the Host field, enter your database host's IP (for example,
1.2.3.4) or domain (for example,your.server.com). For Google Cloud SQL for PostgreSQL, enter the public IP address of the instance you want Fivetran to connect to. - In the Port field, enter your database instance's port number (usually
5432).
Connect via an SSH Tunnel
- In the SSH Host field, enter the hostname of your SSH server. Do not use the IP address or hostname of a load balancer.
- In the SSH Port field, enter the port number for the SSH connection.
- In the SSH User field, enter the username for the SSH connection.
- In the SSH Key Type drop-down menu, select the SSH key type you configured for your SSH server:
- RSA
- ECDSA
- The Require TLS through Tunnel toggle is ON by default. Keep it ON to require TLS encryption between Fivetran and your PostgreSQL database through the SSH tunnel.
- In the Host field, enter your database host's IP (for example,
1.2.3.4) or domain (for example,your.server.com). For Google Cloud SQL for PostgreSQL, enter the public IP address of the instance you want Fivetran to connect to. - In the Port field, enter your database instance's port number (usually
5432).
Connect via private networking
- Select an existing private network connection from the drop-down menu or click Configure a new connection to create and use a new connection.
- The Require TLS when using Private Networking toggle is ON by default. Keep it ON to require TLS encryption between Fivetran and your PostgreSQL database through the private network connection.
- In the Port field, enter your database instance's port number (usually
5432).
Connect via Proxy Agent
- Select an existing agent from the Proxy agents drop-down list or click + Configure a new proxy agent to set up a new agent.
- The Require TLS when using Private Networking toggle is ON by default. Keep it ON to require TLS encryption between Fivetran and your PostgreSQL database through the Proxy Agent.
- In the Host field, enter your database host's IP (for example,
1.2.3.4) or domain (for example,your.server.com). - In the Port field, enter your database instance's port number (usually
5432).
- In the Host field, enter your database host's IP (for example,
(Not applicable to private network connections) Select the Authentication Method you configured.
Provide the details required for your selected authentication method.
Password
- In the User field, enter the username of the database user you created.
- In the Password field, enter the password for that user.
In the Database field, enter the name of the PostgreSQL database you want to use as your destination.
If your PostgreSQL database uses PgBouncer as the connection pooler, configure PgBouncer to use session pooling mode.
(Not applicable to Hybrid Deployment) Copy the Fivetran IP addresses (or CIDR) that you must safelist in your firewall.
(Not applicable to Hybrid Deployment) Select the Data processing location. Depending on the plan you are on and your selected cloud service provider, you may also need to select a Fivetran processing cloud provider and cloud region as described in our Destinations documentation.
Select your Time zone.
(Optional for Business Critical accounts and SaaS Deployment) To enable regional failover, set the Use Failover toggle to ON, and then select your Failover Location and Failover Region. Make a note of the IP addresses of the secondary region and safelist these addresses in your firewall.
Click Save & Test.
Fivetran tests and validates the PostgreSQL destination connection. On successful completion of the setup tests, you can sync your data using Fivetran connectors to the PostgreSQL destination.
In addition, Fivetran automatically configures a Fivetran Platform connection to transfer the connection logs and account metadata to a schema in this destination. The Fivetran Platform Connector enables you to monitor your connections, track your usage, and audit changes. The Fivetran Platform connection sends all these details at the destination level.
If you are an Account Administrator, you can manually add the Fivetran Platform connection on an account level so that it syncs all the metadata and logs for all the destinations in your account to a single destination. If an account-level Fivetran Platform connection is already configured in a destination in your Fivetran account, then we don't add destination-level Fivetran Platform connections to the new destinations you create.
Setup tests
Fivetran performs the following PostgreSQL destination setup tests:
- Proxy Agent Status Test: Checks whether the Proxy Agent is running and connected to Fivetran. We skip this test if you are not using Proxy Agent.
- SSH Tunnel Test: Validates the SSH tunnel details you provided in the setup form and checks whether Fivetran can connect to your database through the SSH tunnel. We skip this test if you are not using an SSH tunnel.
- AWS IAM Credentials Validation Test: For destinations that use IAM authentication, validates the following:
- The role ARN format (
arn:aws:iam::[account-id]:role/[role-name]) - The AWS account ID is a valid 12-digit number
- The database region is a valid AWS region
- The External ID is populated correctly
- The role ARN format (
- Database Host Connection Test: Validates the database credentials you provided in the setup form, verifies that the host is not private, and checks connectivity to the host.
- Certificate Validation Test: Prompts you to select the certificate that Fivetran should use, validates the certificate, and checks whether Fivetran can connect to your database using TLS. We skip this test if you are not connecting directly.
- Permission Test: Checks whether Fivetran has the required permissions to create schemas and tables in your database.
- Validate Temporary Table Test: Checks whether Fivetran has permission to create a temporary table in your database and insert rows into it.
The setup tests may take a couple of minutes to complete.