Migrating AWS RDS PostgreSQL to AnubizHost
RDS is a comfortable managed PostgreSQL service - and you pay for that comfort with US jurisdiction, complex pricing, and limited extension support. This guide walks through migrating an RDS PostgreSQL instance to self-managed PostgreSQL on an AnubizHost offshore VPS using logical replication for near-zero-downtime cutover.
Need this done for your project?
We implement, you ship. Async, documented, done in days.
Confirm RDS Replication Support
Logical replication requires PostgreSQL 10+ and rds.logical_replication parameter set to 1 in the RDS parameter group. Apply the change and reboot the RDS instance (a one-time maintenance window). Verify with SHOW wal_level - should return logical.
Create a replication user on RDS with REPLICATION privilege: CREATE ROLE repuser WITH REPLICATION LOGIN PASSWORD 'xxx';. Grant SELECT on all tables: GRANT SELECT ON ALL TABLES IN SCHEMA public TO repuser;.
Provision and Tune PostgreSQL on AnubizHost
Order an AnubizHost VPS with enough disk for the database plus 30% headroom and enough RAM for the working set. Install PostgreSQL matching the RDS major version (15, 16, etc.):
apt install postgresql-15 postgresql-15-pg-stat-statements
Tune postgresql.conf: shared_buffers 25% of RAM, effective_cache_size 75%, wal_level=logical, max_replication_slots=4, max_wal_senders=4. Restart and create the target database.
Initial Schema Sync and Logical Replication
Dump schema only from RDS:
pg_dump --schema-only -h rds-host -U doadmin dbname > schema.sql
psql -h localhost -U postgres -d dbname < schema.sql
On RDS: CREATE PUBLICATION migration FOR ALL TABLES;. On AnubizHost: CREATE SUBSCRIPTION migration CONNECTION 'host=rds-host port=5432 user=repuser password=xxx dbname=dbname' PUBLICATION migration;. Replication begins. Monitor lag with SELECT * FROM pg_stat_subscription;.
Cutover at Near-Zero Lag
Wait until pg_stat_subscription.last_msg_receipt_time shows current timestamp - this means logical replication is caught up. Stop application writes for ~10 seconds, verify final state matches, then point connection strings at the AnubizHost host. Drop the subscription to disconnect from RDS: DROP SUBSCRIPTION migration;.
Update application DATABASE_URL and restart. Validate read and write paths. Keep RDS active for 24-48 hours as rollback.
Post-Migration Operational Tasks
Set up nightly base backups with pg_basebackup to an AnubizHost storage VPS. Configure pgBackRest for incremental backups if your database is large. Install Prometheus + postgres_exporter for monitoring. Related reading: database hosting, PostgreSQL migration overview, EC2 migration.
Related Services
Why Anubiz Host
Ready to get started?
Skip the research. Tell us what you need, and we'll scope it, implement it, and hand it back — fully documented and production-ready.