PostgresQL Amazon RDS Setup
This guide goes through the steps you need to take to create a PostgreSQL resource using a PostgreSQL database on Amazon RDS.
Requirements
- Configure Security Groups
- Configure Network ACLs (only if your database is within a VPC)
- Enable Logical Replication (only if using as an upstream CDC resource)
- Create a Read Replica (only if using as an upstream polling resource)
Configure Security Groups
To allow access to your PostgreSQL database from Meroxa IPs, follow these steps:
- Go to Amazon RDS in your AWS account.
- Go to Databases in the Amazon RDS menu.
- Click into the PostgreSQL database you'd like to use with Meroxa.
- In the Connectivity & security section, under Security and VPC security groups, click your security group by clicking the blue hyperlink.
- You should now see a list of Security Groups, click into the selected security group by clicking the blue hyperlink under Security group ID.
- Under Inbound rules, click the Edit inbound rules button.
- Click the Add rule button.
- Set Protocol to
TCP
. - Set Port to the port of your database. For PostgreSQL it's
5432
by default. - Set the Source to include the Meroxa IPs.
Configure Network ACLs
note
You only need to update this if your database is within a VPC.
To allow access to your PostgreSQL database from Meroxa IPs, follow these steps:
- Go to Amazon RDS in your AWS account.
- Go to Databases in the Amazon RDS menu.
- Click into the PostgreSQL database you'd like to create a replica of.
- In the Connectivity & security section, under Networking and VPC, click your VPC by clicking the blue hyperlink.
- You should now see a list of Your VPCs. Click into the selected VPC by clicking the blue hyperlink under VPC ID.
- In your VPC Details, click the blue hyperlink under Main network ACL.
- You should now see a list of Network ACLs. Click into the selected Network ACL by clicking the blue hyperlink under Network ACL ID.
- You will update both the Inbound and Outbound Rules of the Network ACL to contain
ALL - 0.0.0.0/0 - ALLOW
. - If your Inbound and Outbound Rules do not contain
ALL - 0.0.0.0/0 - ALLOW
—update the Source to allow Meroxa IPs both Inbound and Outbound.
Enable Logical Replication
With Logical Replication enabled, Meroxa can pull records from PostgreSQL by reading the Write-Ahead Log (WAL), which produces change events for row-level INSERT
, UPDATE
, and `DELETE operations and emits those change events into a stream.
note
Enabling Logical Replication will require a reboot of your database.
Using an existing parameter group
If you would like to enable Logical Replication using an existing parameter group, follow these steps:
- Go to Amazon RDS in your AWS account.
- Go to Databases in the Amazon RDS menu.
- Click into the PostgreSQL database you'd like to use with Meroxa.
- In the Configuration section, under Instance and click the blue hyperlink under Parameter group.
- Click the Edit parameters button.
- Search and set the following key/values in your DB parameter group:
rds.logical_replication
-1
- Click the Save changes button.
Using a new parameter group
If you would like to enable Logical Replication using a new parameter group, follow these steps:
- Go to Amazon RDS in your AWS account.
- Go to Parameter groups in the Amazon RDS menu.
- Click the Create parameter group button.
- Set Parameter group family to the PostgreSQL version of your database (e.g.,
postgres14
). - Set Type to
DB Parameter Group
. - Set Group name to an identifiable name.
- Click the Create button.
- You should now see a list of Parameter groups. Click into the parameter group you just created by clicking the blue hyperlink under Name.
- Click the Edit parameters button.
- Search and set the following key/values in your DB parameter group:
rds.logical_replication
-1
- Click the Save changes button.
- Go back to Databases in the Amazon RDS menu.
- Click into the PostgreSQL database you'd like to use with Meroxa.
- Click the Modify button.
- Under the Additional configuration dropdown, look for DB parameter group and select your new parameter group.
- Click the Continue button.
- Under the Scheduling of modifications dialog, select Apply immediately.
- Click the Modify DB Instance button to confirm changes.
- Next, you must reboot the PostgreSQL server and can do that by clicking on the Actions menu and clicking Reboot.
- You will be asked to confirm the reboot. Click the Confirm button.
- Logical Replication should now be enabled on your PostgreSQL database.
Create a Read Replica
You can create a read-only replica to allow READ
only access to a PostgreSQL database. Keep in mind, Logical Replication is not supported using this method.
- Go to Amazon RDS in your AWS account.
- Go to Databases in the Amazon RDS menu.
- Click into the PostgreSQL database you'd like to use with Meroxa.
- Click on the Actions menu and select Create read replica.
- Give your read replica a name and select Yes for Publicly accessible. All other defaluts can be changed if desired.
- Click the Create instance button.
- Finally, give the necessary access to the read replica.
What's Next?
Now that you've configured your PostgreSQL Amazon RDS database instance, you are ready to create your PostgreSQL resource!