Managed PostgreSQL
Amazon RDS, Aurora and Google Cloud SQL as a source, with nothing installed beyond a publication and REPLICA IDENTITY FULL.
On Amazon RDS and Aurora, two things differ from your own server: you turn on
logical replication in a parameter group (a named list of server settings),
and DBTrail's login gets the rds_replication role. The rest of
Prepare your PostgreSQL is the same.
Copy and paste
Run these where the AWS command line works for your account. Change the first two lines: your instance (or cluster) name, and your PostgreSQL version.
export DB=mydb
export PGVER=16
aws rds create-db-parameter-group --db-parameter-group-name dbtrail-logical \
--db-parameter-group-family "postgres$PGVER" --description "DBTrail: logical replication"
aws rds modify-db-parameter-group --db-parameter-group-name dbtrail-logical \
--parameters "ParameterName=rds.logical_replication,ParameterValue=1,ApplyMethod=pending-reboot" \
"ParameterName=max_slot_wal_keep_size,ParameterValue=10240,ApplyMethod=pending-reboot"
aws rds modify-db-instance --db-instance-identifier "$DB" \
--db-parameter-group-name dbtrail-logical --apply-immediately
sleep 30
aws rds wait db-instance-available --db-instance-identifier "$DB"
aws rds reboot-db-instance --db-instance-identifier "$DB"DB is the cluster's name here, and WRITER its writer instance. After
the last line, reboot each reader instance of the cluster the same way.
export DB=mycluster
export WRITER=mycluster-instance-1
export PGVER=16
aws rds create-db-cluster-parameter-group --db-cluster-parameter-group-name dbtrail-logical \
--db-parameter-group-family "aurora-postgresql$PGVER" --description "DBTrail: logical replication"
aws rds modify-db-cluster-parameter-group --db-cluster-parameter-group-name dbtrail-logical \
--parameters "ParameterName=rds.logical_replication,ParameterValue=1,ApplyMethod=pending-reboot" \
"ParameterName=max_slot_wal_keep_size,ParameterValue=10240,ApplyMethod=pending-reboot"
aws rds modify-db-cluster --db-cluster-identifier "$DB" \
--db-cluster-parameter-group-name dbtrail-logical --apply-immediately
sleep 30
aws rds wait db-instance-available --db-instance-identifier "$WRITER"
aws rds reboot-db-instance --db-instance-identifier "$WRITER"-
10240is in MB: WAL a stopped capture may hold, 10 GB at most. -
Your instance already has a parameter group of its own (its name does not start with
default.)? Do not move it to a new one, which would drop its other settings. This prints its name (on Aurora, usedescribe-db-clusters --db-cluster-identifier "$DB" --query 'DBClusters[0].DBClusterParameterGroup'):aws rds describe-db-instances --db-instance-identifier "$DB" \ --query 'DBInstances[0].DBParameterGroups[0].DBParameterGroupName' --output textThen run only the
modify-db-parameter-groupline (on Aurora,modify-db-cluster-parameter-group) with its name in place ofdbtrail-logical, then the reboot. -
The reboot restarts the database, a short outage: pick a quiet moment.
Once it is back, check it. It says logical:
psql -c "SHOW wal_level"Then go back to the Quickstart, step 2.
Right after its block that creates the dbtrail login, run:
psql -c "GRANT rds_replication TO dbtrail"Prefer a browser? In the RDS console: Parameter groups → Create,
set rds.logical_replication to 1, attach the group to the instance
(Modify), then Reboot.
In detail
Providers
| Provider | Tested | Turn on logical replication | DBTrail's login |
|---|---|---|---|
| Amazon RDS for PostgreSQL | Yes, PostgreSQL 16 | rds.logical_replication = 1 in the parameter group, then reboot. A group set when the instance is created needs no reboot. | GRANT rds_replication TO dbtrail;, or the master user, which has it. |
| Amazon Aurora PostgreSQL | Yes, 16-compatible, Serverless v2 | The same, in the cluster parameter group. | The same as RDS. |
| Google Cloud SQL | No, documented only | The cloudsql.logical_decoding flag on, then restart. | A user with cloudsqlsuperuser or the replication grant. |
Tested means a real instance went through the whole path: the checks pass, changes are captured with the whole row before and after, and undo produces the right SQL. Cloud SQL should work the same way, since DBTrail is an ordinary logical-replication client, but it has not been tested.
RDS and Aurora leave max_slot_wal_keep_size unlimited by default. The
commands above set it to 10 GB; DBTrail's checks warn while it is unlimited.
Nothing is installed on the managed instance: only the publication and
REPLICA IDENTITY FULL on your tables, both plain SQL.
Prepare your PostgreSQL
What DBTrail needs on your PostgreSQL, the cases the Quickstart leaves out, and what each check looks for. Nothing is installed in your server.
Add and run a server
Add a PostgreSQL server from a terminal or the web interface, change, stop or remove it, and the disk and memory its copy needs.