I’m currently working on migrating an AWS RDS database from the Hyderabad region to the Ireland region, and I’m facing a unique challenge: I can’t afford any downtime during the migration process. The database is critical for our applications, and even a few seconds of interruption could have significant consequences.
Here’s what I’m considering so far, but I’d love your input, tips, or best practices based on your experiences:
AWS Database Migration Service (DMS): I’ve read that AWS DMS can facilitate a near-zero downtime migration by allowing ongoing replication of data. Has anyone used DMS for such migrations? What was your experience like, and did you encounter any issues?
Setting Up Replication: My plan is to set up a replication instance in Ireland and create endpoints for both the source (Hyderabad) and target (Ireland) databases. Any advice on how to configure these endpoints effectively or common pitfalls to avoid?
Final Cutover: Once the initial data is migrated, I’m aware I’ll need to do a final synchronization of changes before pointing my application to the new database. How have others handled this cutover process without downtime? Any tips for minimizing risk during this step?
Application Configuration: After the migration, I’ll need to update our application’s connection strings. Is there a best practice for handling this transition smoothly?
Monitoring and Validation: What tools or methods do you recommend for monitoring the migration process? Also, how do you ensure that all data is accurately migrated and consistent between the two databases?
I appreciate any insights or experiences you can share! Thank you in advance for your help!
That’s a pretty good plan, but there’s no way to completely avoid the downtime, only try to reduce the time as much as possible, so better to set expectations for everyone.
For that you will need to be able to change the application configuration immediately after the final failover.
If downtime is so critical my recommendation is to rehearse this process with a clone of your production database and a clone of the application servers.
Try to automate all of it until you can get it done as quickly as possible, so that for the real migration you just need to fire the automation you’ve been rehearsing countless times.
For #4, create a Route 53 DNS that points to the original RDS. Use this endpoint in your application. Make sure the TTL is set to as low as possible (5s). When your new instance is ready, update the Route 53 to point to the new RDS endpoint. The cutover should be pretty instantaneous.
Instead of focusing on the unrealistic goal of 100% uptime you should focus on designing your app for resiliency and redundancy. Things fail. Things go offline. Shit happens all the time. Your DB will have to patched and rebooted one day.
Your app should degrade gracefully if the DB is gone. Cache the work in a queue for example, until such time when the DB is back up.
And by the way - every single manager insists that their app is absolutely crucial and that even one second of downtime will have catastrophic consequences for the business. Guess what? Nothing is going to happen. Unless you’re running a nuclear powerplant simply schedule a maintenance window and do the migration then.
The other answers all have something to offer but ultimately you’re not going to do this with zero downtime and maintain consistency of your dataset if you’re relying on tools like dms. I’ll take downtime over an insidious consistency problem the monitoring didn’t catch any day of the week. Talk to the managers, customers and whoever else, agree an outage window based on how long it’s taking you in preproduction. Have a solid rollback plan which maintains consistency if you’ve already written new data in the target region. Talk to your AWS account team (SA) about their recommended approach. I suspect the app can’t be that important or you’d already know far more about its architecture and data/consistency models which would likely have answered the question for you.
Requires code changes, but you can add a “disable writes” configuration to your application, nearing the end of the replication you can disable writes, it’s partial downtime, while reads would still be served, and you minimize the risk of any lost writes at the end
This is key. If you want zero downtime, you’ll need to either (A) pause writes, complete the transfer to the new DB, then enable writes there, (B) accept some data loss, or (C) design your application better.
This seems to be right. In order to avoid anything written to old db in that 5sec interval you can setup writes to both endpoints and feature flag with Evidently to disable the second write once dns updated.
I helped a customer migrate a sports website from onprem MS SQL Server to Aurora MySQL pretty much using the same plan focusing on DMS doing active replication from the source to the destination live time and a failover of application connections from the SQL Server to the new server. It wasn’t 0 downtime but less than 4 minutes as we needed to move app configuration changes.
Andy Jassy even did a shout out to the 247 Sports team at CBS during his re:Invent Keynote for the great success.
100% had the same experience with DMS. In all honesty DMS is by far one of the most subpar services within AWS where it has “one job” and it does it extremely poorly. I wouldn’t recommend using DMS ever and instead using Aurora multi region replication features
DMS also only really transitions data. No indexes etc. if you’re in aurora you can create a global cluster and replicate that way. Promoting an instance takes 5min ish but you aren’t getting 0 downtime without using something outside the AWS ecosystem and probably not even then unless you have way more control over DNS than is normal and set resolvers to 0
We are in the process of migrating some 400 databases from on prem colos to RDS with minimal downtime. The general strategy is
Establish routing between both sites
Setup DMS for ongoing replication from source to RDS
Once initial load is done and replication is ongoing we modify the connection strings to point to RDS, reboot all nodes of the app at the same time (reboot is usually less than 2s, so thats the downtime)
Flip the app on in AWS, flip DNS for the app over to AWS deployment, wait for colo to drain, kill colo. (Note both colo+AWS are talking to RDS at this point so it’s fine to leave both running for however long we need, if your app is stateful/not easily run in this way you can’t)
We did this by creating a cascading read replica structure on the other region. When the day came we just promoted the top level replica and were able to maintain the whole structure. Promotion did take few mins but it was safe and smooth for most parts.
As mentioned above zero downtime is not possible but minimum downtime is with a good design.
Just a side note that I used AWS DMS in the past to recreate our Postgres on a smaller db because we wanted to shrink it. It was cloud to cloud same region migration. It’s not completely horrible but it’s not reliable product. Requires tweaking so expect failures. I would not recommend it for this problem however.