RDS to Aurora Zero-Downtime Migration: A Practical Plan
Moving a busy PostgreSQL database from Amazon RDS to Aurora can be done without a maintenance window, but only if the application can tolerate a short fork between the old and new databases. This guide explains the trade-offs between the two services, the standard migration path that causes downtime, and the request-replay technique that avoids it. It is based on a published case study of a production migration of a service handling over 600 requests per second at the time, and it is written for engineering teams planning a similar move.
Why move from RDS to Aurora?
The main reasons to consider Aurora are availability and I/O scalability. With RDS multi-AZ, failover is DNS-based: the process is automatic but can take several minutes, which can mean thousands of dropped requests. Aurora replicates six copies of the database across three availability zones and can fail over in under 30 seconds.
On performance, RDS requires you to provision IOPS in advance, so the system is often over-provisioned and engineers must watch read and write throughput. Aurora handles I/O automatically and supports up to 15 read replicas with low latency, which helps distribute read operations.
The right time to make this kind of change is before you need it. A migration done under pressure leaves less room for research, testing, and a tested rollback plan.
The standard migration path and its downtime problem
The common approach is: create an Aurora read replica from RDS, wait for it to catch up, promote the Aurora replica to master, then change the production database URL. The problem is the promotion step. Promotion takes roughly 3–5 minutes and requires a reboot; during that window, writes to the old RDS database are not reflected in Aurora. With relational data and foreign keys, replaying missing rows later can create dangerous discrepancies, especially with auto-increment primary keys.
The usual workaround is to put the API into maintenance mode and reject writes during promotion. For a service that cannot afford downtime, that is not acceptable. An asynchronous multi-master replication cluster is another option, but it is not easily achievable in PostgreSQL and would require additional engineering and third-party tools.
The enabling condition: idempotent writes and a replay queue
The technique depends on a property of the application: all SDK endpoints are idempotent. Sending the same POST request multiple times produces the same result, with no duplication or inconsistency. That makes it safe to log write requests during the fork window and re-send them to Aurora afterward.
If your endpoints are not idempotent, this approach is not safe without additional deduplication logic. Check that condition before adopting the plan.
The migration plan, step by step
The plan below is reversible until the final production switch. Each step is listed with its purpose and reversibility.
- Create an Aurora read replica from the production RDS database, and set up CloudWatch alarms and dashboards. (Reversible: the replica can be discarded.)
- Wait until the read replica is fully caught up. (Reversible.)
- Pause asynchronous jobs that could write to the main database. (Reversible: restart the jobs.)
- Activate a production flag that logs all POST requests (URL, headers, body) to a queue. This captures writes around the fork. Some requests will also be replicated to Aurora, which is fine because the endpoints are idempotent. (Reversible: deactivate the flag.)
- Promote the Aurora replica. This stops replication so Aurora can accept writes, creating the fork. (This is the point of no return for the replica, but production traffic is still on RDS.)
- Create read replicas from the Aurora master for asynchronous jobs and dashboards. (Reversible.)
- Duplicate the API web infrastructure pointing to Aurora, and re-issue all queued requests to it. This replays the missing writes into Aurora. A script similar to an aiohttp + pypeln request-replay script can be used. (Reversible: the duplicate infrastructure can be turned off.)
- Change the production database URL to Aurora. Until this point, no real change has been made to production. The queue continues logging writes during the switch, so none are missed. (This is the production cutover.)
- Start the asynchronous jobs again. (Reversible.)
- Monitor servers, database, and code exceptions. (Ongoing.)
- Deactivate the logging flag and turn off the duplicated infrastructure from step 7. (Cleanup.)
The day of the migration: dry runs and rollback
Choose a low-traffic moment and have the whole team available for support. Run several dry runs so the scripts are known to work and there is no room for human error. Dry runs act as integration tests and reveal flaws in the plan before production is touched. Test the rollback plan as well, in case you need to abort.
In the original case study, the whole operation took about 5 minutes. Having the team ready was a safety net even though the migration went smoothly.
Decision checklist before you start
- Are all write endpoints idempotent, or can you add deduplication?
- Can you pause asynchronous jobs that write to the database?
- Can you log POST requests (URL, headers, body) to a durable queue?
- Can you replay queued requests to a duplicate API infrastructure?
- Can you switch the production database URL without downtime (for example, via a platform like Heroku)?
- Have you tested the rollback plan?
- Have you run at least one full dry run?
- Do you have monitoring for servers, database, and code exceptions?
If any answer is no, the zero-downtime plan may not be safe for your system.
Worked example: the fork window
At the time of the original case study, the service handled over 600 requests per second. Promotion of the Aurora replica took roughly 3–5 minutes. During that window, writes to RDS were not reflected in Aurora. The replay queue captured those writes, and after promotion they were re-sent to the Aurora-backed infrastructure. Because the endpoints were idempotent, any requests that had already been replicated to Aurora were harmless duplicates. This is why the idempotency condition is the first item on the checklist.
Failure distinction: DNS failover vs storage replication
RDS multi-AZ failover relies on DNS changes and can take several minutes. Aurora replicates data at the storage layer across three availability zones and can fail over in under 30 seconds. The difference matters for planning: a migration that avoids downtime still needs a failover story for the new database.
Frequently asked questions
Can I do this migration if my endpoints are not idempotent?
The replay technique relies on idempotent writes. If your endpoints are not idempotent, re-sending queued requests could create duplicates or inconsistencies. You would need to add deduplication logic or choose a different approach.
How long does Aurora promotion take?
The promotion of the Aurora follower takes approximately 3–5 minutes and requires a database reboot. During that window, writes to the old RDS database are not reflected in Aurora.
What is the point of no return?
The production database URL switch is the cutover. Until then, the plan is reversible: the Aurora replica can be discarded, the duplicate infrastructure can be turned off, and the queue can be drained. After the switch, the new database is live.