Replicating Amazon RDS for PostgreSQL data
You can replicate data from Amazon RDS for PostgreSQL to other databases with Data Replication.
To set up replication for PostgreSQL, first configure your Amazon RDS for PostgreSQL service, and then add a connection to it in a project.
Restrictions
- You can use this connection only as a source for Data Replication. You cannot use this connection as a target connection.
- You can replicate only some PostgreSQL data types. See Supported PostgreSQL data types.
Supported versions
PostgreSQL database versions 10, 11 and 12
Configuring the PostgreSQL database for replication
To set up PostgreSQL in your Amazon account:
-
Check that your Amazon RDS for PostgreSQL database instance has the proper privileges for replication. Using a database client, run the following query.
SELECT setting FROM pg_settings WHERE NAME='rds.logical_replication';
Note: Do not alter the replica identity for schemas and tables you are replicating. Data Replication will stop if you modify the replica identity to be less than full. -
Create a DB parameter group. Confirm that you have an existing parameter group named default.postgresversion. Create a new parameter group, selecting parameter group family postgresversion, where
version
matches the existing parameter group version. -
If your PostgreSQL database instance has the proper privileges, the Setting column will have value on, and you can skip to the next section. If the value is not on, modify the database parameters to enable replication.
-
Associate a DB parameter group with your database instance.
-
Modify parameters in the DB parameter group
- Set rds.logical_replication to 1. This enables logical replication.
- Set max_replication_slots and max_wal_sender to the number of concurrent Data Replication assets you want to run.
- Save the changes.
-
Apply the changes. Open the RDS console, in the navigation pane select Databases, select your database instance. From the Actions menu, select Reboot.
-
Grant access to connections from IBM Cloud. Many Amazon RDS for PostgreSQL database instances have Public access but do not allow connections from IBM Cloud. To grant access for IBM Cloud to connect to the database:
- Open the RDS console. In the navigation pane select Databases, select your database instance, and click Connectivity & security.
- Under heading VPC security groups, click the link for the active security group.
- Scroll down and click Edit inbound rules.
- Click Add rule. Select type PostgreSQL and source Anywhere.
- Click Save rules. This will also modify the Outbound rules.
-
Grant roles to the database username. Ask your database administrator to grant the roles
rds_superuser
andrds_replication
to the username you use in the connection for Data Replication.
Connecting to Amazon RDS for PostgreSQL in a project
To connect to Amazon RDS for PostgreSQL in a project in Cloud Pak for Data as a Service, see Amazon RDS for PostgreSQL connection.
Next step
Learn more
- Amazon RDS for PostgreSQL
- Creating an Amazon RDS DB Instance
- Connecting to a DB Instance running the PostgreSQL Database Engine
Parent topic: Supported Data Replication connections