Amazon RDS PostgreSQL
On This Page
You can set up, operate, and scale PostgreSQL deployments in the cloud with Amazon RDS. Amazon RDS for PostgreSQL gives you access to the capabilities of the familiar PostgreSQL database engine. This means that the code, applications, and tools you already use today with your existing databases can be used with Amazon RDS.
You can ingest data from your Amazon RDS PostgreSQL database using Hevo Pipelines and replicate it to a Destination of your choice.
Prerequisites
-
IP address or host name of your PostgreSQL server is available.
-
The PostgreSQL version is 9.4.15 or higher.
-
If Pipeline mode is Logical Replication:
-
PostgreSQL database instance is a master instance.
-
SELECT, USAGE, and CONNECT privileges are granted to the database user.
Perform the following steps to configure your Amazon RDS PostgreSQL Source:
Set up Log-based Incremental Replication
Hevo supports data ingestion from PostgreSQL servers via Write Ahead Logs set at the logical level (available on PostgreSQL version 9.4). A Write Ahead Log(WAL) is a collection of log files that record information about data modifications and data object modifications made on a PostgreSQL server instance. Typically WAL is used for data replication and data recovery.
To set up log-based replication, follow these steps:
1. Create a parameter group
-
Log in to the Amazon RDS console.
-
Click Parameter groups in the left sidebar.
-
Select the parameter group corresponding to your PostgreSQL instance, to edit. If this is the default Parameter group, RDS restricts you from editing it. In such a case, create a parameter group.
-
Select the instance with Type as DB cluster parameter group. Example: postgresql cluster parameter group
-
Specify the parameter group details and click Create.
-
2. Configure the parameters
For the parameter group you just created:
-
Click Edit parameters in the top right.
-
Search and update the following parameters:
Parameter | Value | Description |
---|---|---|
max_replication_slots |
5 | The number of clients that can connect to the server. Default value: 10. RDS recommends to set this value to at least 5 so that internal replication by RDS is not affected. |
max_wal_senders |
5 | The number of processes that can simultaneously transmit the WAL log. Default value: 10. RDS recommends to set this value to at least 5 so that the internal replication by RDS is not affected. |
rds.logical_replication |
1 | The setting to enable or disable logical replication. The value of 1 is required to enable WAL at the logical level. |
wal_sender_timeout |
0 | The time, in seconds, after which PostgreSQL terminates the replication connections due to inactivity. Default value: 60 seconds. You must set the value to 0 so that the connections are never terminated and your Pipeline does not fail. You can use the following query to check the value configured for the parameter: show wal_sender_timeout |
3. Apply the parameter group to your PostgreSQL database
-
In the Databases page, select the DB Identifier for your PostgreSQL instance, and click Modify on the top bar.
-
In the Additional configuration page:
-
Select the DB cluster parameter group you just created.
-
Specify the Backup retention period, and click Next.
-
-
View the Summary of modifications and click Modify cluster.
Whitelist Hevo’s IP Addresses
You need to whitelist the Hevo IP addresses for your region to enable Hevo to connect to your PostgreSQL database. To do this:
1. Add inbound rules
-
Open the Amazon RDS console.
-
In the left navigation pane, click Databases (or Instances if you are using an older version).
-
In the Databases section on the right, click the DB identifier of the Amazon RDS PostgreSQL instance to configure a security group.
-
In the Connectivity & security tab, click the security group ID under Security, VPC security groups.
-
In the Actions drop-down on the top right, select Edit inbound rules. Then, in the Inbound rules tab, click Edit Inbound Rules.
-
In the Edit inbound rules page:
-
Click Add rule.
-
Add a new rule with Hevo’s IP addresses for your region to give access to the PostgreSQL instance.
-
Click Save rules.
The rules are now visible under Security groups.
-
2. Configure Virtual Private Cloud (VPC)
-
In the Connectivity & security tab, click the VPC link under VPC:
-
In the page that is displayed, click on the VPC ID.
-
In the Inbound Rules tab, ensure Allow/Deny field is set to ALLOW. Else, click Edit inbound rules to do this.
Grant Privileges to the User
Grant privileges to the database user connecting to the PostgreSQL database as follows:
-
Log into your Amazon RDS PostgreSQL database as a user with
grant
privilege. -
Enter the following commands to give accesses to the database user:
GRANT CONNECT ON DATABASE <database_name> TO <database_username>; GRANT USAGE ON SCHEMA <schema_name> TO <database_username>; GRANT SELECT ON DATABASE <database_name> TO <database_username>;
-
Alter the schema’s default privileges to grant
SELECT
privileges on tables to the database user:ALTER DEFAULT PRIVILEGES IN SCHEMA <schema_name>; GRANT SELECT ON TABLES TO <database_username>;
Limitations
- The data type Array in the Source is automatically mapped to Varchar at the Destination. No other mapping is currently supported.
See Also
Revision History
Refer to the following table for the list of key updates made to this page:
Date | Release | Description of Change |
---|---|---|
Feb-07-2022 | 1.81 | Updated section, Whitelist Hevo’s IP Address to remove details about Outbound rules as they are not required. |
Jan-24-2022 | 1.80 | Removed from Limitations that Hevo does not support UUID datatype as primary key. |
Dec-20-2021 | 1.78 | Updated section, Configure the parameters. |
Sep-09-2021 | 1.71 | Updated the section, Limitations to include information about columns with the UUID data type not being supported as a primary key. |
Jun-14-2021 | 1.65 | Updated the Grant Privileges to the User section to include latest commands. |