I have a large PostgreSQL DB (around 100GB) which is on EC2. I want to migrate it to RDS.
How can I achieve this with minimal downtime?
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityI have a large PostgreSQL DB (around 100GB) which is on EC2. I want to migrate it to RDS.
How can I achieve this with minimal downtime?
You can't do it with minimal downtime, or not easily anyway.
RDS doesn't support importing base backups and doing streaming replication to/from outside servers.
See Getting WAL from AWS RDS and Moving a standalone DB to Amazon RDS.
You'll have to dump and reload.
If you're keen, you could instead set up Londiste or a similar tool to stream changes from the standalone server into RDS, with the Londiste pgq daemon and the subscriber daemon both running on AWS EC2. The subscriber would connect remotely to RDS over the PostgreSQL protocol. This lets you use trigger based replication to keep the DBs in sync, giving you a shorter outage window. You still have to disable writes on the old DB and make sure Londiste is fully caught up before switching over, though.
Amazon has a tool for doing exactly this, called the RDS Migration Tool, and there is also AWS Migration Service. The migration tool has to run in windows, however, last I looked.