Replicate PostgreSQL from Aptible to AWS RDS

If I have a PostgreSQL database on Aptible, can I use VPC peering to my AWS account and setup a read-replica of the database in RDS there?

From Aptible’s side, network isolation is the only barrier that would prevent replication to an external database. As you identified, VPC Peering is one method for exposing the Aptible Database to your AWS VPC. Using a Database Endpoint is the other option but traffic would be traversing the public internet rather than using the private network as VPC peering would.

Unfortunately, from what I can tell, RDS only allows physical replication from another RDS database, not external sources such as self-hosted or Aptible Databases. It looks like you’d have to use AWS Data Migration Service (DMS) or logical replication in order to stream data from an Aptible Database to RDS.

This guide describes how to replicate from RDS to an external database using PostgreSQL’s built-in logical replication but the same process can be used to perform replication from an external source to an RDS database. Built-in logical replication was introduced in PostgreSQL 10 so it can only be used from this version on.

If you’re using a version prior to PostgreSQL 10, Aptible PostgreSQL Databases have the pglogical extension installed which allows logical replication from PostgreSQL 9.4. This guide describes how to set up replication using pglogical.