How to connect AWS RDS to Materialize
To connect AWS RDS PostgreSQL as a Postgres Source, the AWS user account requires the rds_superuser
role to perform logical replication for the PostgreSQL database on Amazon RDS.
As an account with the rds_superuser
role, make these changes to the upstream database:
-
Create a custom RDS parameter group with your instance and associate it with your instance. You will not be able to set custom parameters on the default RDS parameter groups.
-
In the custom RDS parameter group, set the
rds.logical_replication
static parameter to1
. -
The Materialize instance will need access to connect to the upstream database. This is usually controlled by IP address. If you are hosting your own installation of Materialize, add the instance’s IP address in the security group for the RDS instance.
-
Restart the database so all changes can take effect.
-
Create a publication with the tables you want to replicate:
For specific tables:
CREATE PUBLICATION mz_source FOR TABLE table1, table2;
For all tables in Postgres:
CREATE PUBLICATION mz_source FOR ALL TABLES;
The
mz_source
publication will contain the set of change events generated from the specified tables, and will later be used to ingest the replication stream.
For more information, see the Amazon RDS documentation.