
Zero-Downtime Database Migrations on AWS: Combining Aurora Serverless v2 and DMS
Learn how to migrate relational databases to Amazon Aurora Serverless v2 with zero application downtime using AWS Database Migration Service (DMS) and Change Data Capture (CDC).
Database migrations are often viewed as high-risk engineering operations that require scheduled maintenance windows and application downtime. However, for modern applications with global users, taking your application offline is no longer an option.
By combining Amazon Aurora Serverless v2 with AWS Database Migration Service (DMS), you can migrate live relational databases (MySQL, PostgreSQL, Oracle, or SQL Server) to AWS with near-zero downtime while automatically handling dynamic traffic spikes.
- Why Aurora Serverless v2 for Migration Targets?
Traditional database provisioned instances require you to over-provision compute and memory for peak loads.
Aurora Serverless v2 scales compute and memory capacity in fractions of a second—from 0.5 ACUs to 128 ACUs (Aurora Capacity Units)—without interrupting database transactions. During large data ingestion phases in a migration, Aurora automatically scales up to handle write throughput, then scales back down when traffic stabilizes.
- The Architecture: Full Load + Change Data Capture (CDC)
To achieve zero downtime, the migration is split into two distinct execution phases:
[ Source DB (On-Prem / EC2) ]
│
├───────> (1. Full Load Snapshot) ────────┐
│ ▼
[ Transaction Log ] ──> (2. Continuous CDC) ──> [ AWS DMS ] ──> [ Aurora Serverless v2 ]
│
▼
[ App Traffic Cutover ]
Full Load Phase: AWS DMS creates a snapshot of the source database schema and existing data, inserting it into Aurora Serverless v2.
│
├───────> (1. Full Load Snapshot) ────────┐
│ ▼
[ Transaction Log ] ──> (2. Continuous CDC) ──> [ AWS DMS ] ──> [ Aurora Serverless v2 ]
│
▼
[ App Traffic Cutover ]
Full Load Phase: AWS DMS creates a snapshot of the source database schema and existing data, inserting it into Aurora Serverless v2.
CDC Phase (Replication): DMS continuously reads the binary/transaction logs from the source database, applying ongoing row changes in real-time to the target.
- Step-by-Step Implementation Guide
Step 1: Configure Source Database Logging
Before launching DMS, enable binary or logical logging on your source database to record change data:
PostgreSQL: Set wal_level = logical in postgresql.conf.
MySQL: Enable binlog_format = ROW in my.cnf.
Step 2: Provision the Aurora Serverless v2 Cluster
Define your minimum and maximum ACU limits (e.g., Min: 0.5 ACU, Max: 16 ACU) to allow elastic scaling during the bulk data load.
Define your minimum and maximum ACU limits (e.g., Min: 0.5 ACU, Max: 16 ACU) to allow elastic scaling during the bulk data load.
Step 3: Launch AWS DMS Replication Instance & Tasks
Create source and target DMS Endpoints.
Create source and target DMS Endpoints.
Create a Replication Task with the migration type set to:
Migrate existing data and replicate ongoing changes (Full Load + CDC).
Start the task and monitor the AWS Management Console to verify CDC replication latency reaches < 1 second.
Step 4: Execute the Zero-Downtime Cutover
Pause write traffic on the application for a few seconds.
Pause write traffic on the application for a few seconds.
Confirm the DMS target database replication status is fully in-sync (zero latency lag).
Update your application's connection string (e.g., via AWS Systems Manager Parameter Store or Secrets Manager) to point to the Aurora Primary Writer Endpoint.
Resume write traffic on the new database.
- Lessons Learned & Best Practices
Disable Secondary Indexes during Full Load: Drop foreign key constraints and secondary indexes on the target database before initiating Full Load, then recreate them before enabling CDC to speed up load times by 3x–5x.
Monitor DMS Memory Usage: Ensure your DMS replication instance has sufficient RAM (such as dms.c5.xlarge) to prevent swap file bottlenecks during large transactions.
Conclusion
Zero-downtime migrations do not require complex custom scripts. Leveraging AWS DMS CDC alongside Aurora Serverless v2's autoscaling capability gives you an elastic, reliable migration pipeline that keeps your business running smoothly without missing a transaction.
Zero-downtime migrations do not require complex custom scripts. Leveraging AWS DMS CDC alongside Aurora Serverless v2's autoscaling capability gives you an elastic, reliable migration pipeline that keeps your business running smoothly without missing a transaction.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article