This guide walks through how to execute a zero-downtime AWS migration by combining continuous database Change Data Capture (CDC) in AWS Database Migration Service (DMS), block-level server replication in AWS Application Migration Service (MGN), and deterministic DNS cutover in Amazon Route 53.
What You Will Need
-
AWS access: IAM permissions to create and manage AWS DMS (
aws_dms_replication_subnet_group,aws_dms_replication_instance, endpoints, tasks), AWS MGN, Amazon EC2, Amazon VPC subnets, AWS KMS CMKs, Amazon Route 53, and Amazon CloudWatch. - Source database access: Permission to read source transaction logs and extend log retention (such as Oracle Archivelog or PostgreSQL WAL) during the initial full load and CDC phase.
- Network connectivity: TLS-enabled connectivity between source servers/databases and the target AWS VPC/staging subnets.
-
Tooling (if using the Terraform module): Terraform
>= 1.5.0and thehashicorp/awsprovider~> 5.0.
Choosing the Right AWS Migration Service
| AWS Migration Service | Replication Level | Supported Sources | Optimal Target Workload | Cutover Downtime Profile |
|---|---|---|---|---|
| AWS DMS | Logical / Transaction Log (CDC) | Oracle, SQL Server, MySQL, PostgreSQL, MongoDB | Amazon RDS, Amazon Aurora, DynamoDB, Redshift | Sub-second to 60 seconds (connection pointer switch) |
| AWS Application Migration Service (MGN) | Block-Level Continuous Replication | Physical servers, VMware, Hyper-V, Azure, GCP (Linux & Windows) | Amazon EC2 (Any AMI) | Minutes (final block delta sync & boot) |
| AWS Schema Conversion Tool (SCT) | Schema & Code Transformation | Commercial RDBMS (Oracle, SQL Server) | PostgreSQL, MySQL on AWS | N/A (pre-migration code mapping) |
| AWS DataSync | File & Object Network Transfer | NFS, SMB file shares, on-prem object storage | Amazon S3, Amazon EFS, Amazon FSx | Near zero (incremental final delta scan) |
Step-by-Step Procedure
Step 1: Discovery, Dependency Mapping, and Readiness Assessment
Use AWS Application Discovery Service alongside network telemetry to map application dependencies, identify undocumented database connections, and rightsize target AWS instances. Categorize workloads with the 7 Rs framework before provisioning replication pipelines:
- Rehost: Move VMs to Amazon EC2 via AWS MGN without application changes.
- Replatform: Move self-hosted databases to Amazon RDS or Amazon Aurora without core code rewrites.
- Refactor: Decompose monoliths into containers on Amazon EKS or serverless functions on AWS Lambda.
Step 2: Continuous Database Replication with AWS DMS (CDC)
AWS DMS performs an initial full data load followed by continuous CDC directly from source transaction logs without locking operational tables:
- Size the replication instance: Provision a Multi-AZ DMS replication instance in private subnets with enough memory to buffer transaction bursts.
- Preserve source transaction logs: Extend source log retention (e.g., Oracle Archivelog or PostgreSQL WAL) so logs are not purged before DMS finishes the initial full load.
-
Track replication lag: Monitor the CloudWatch metrics
CDCLatencySourceandCDCLatencyTargetuntil lag remains sub-second prior to scheduling cutover.
Step 3: Server Rehosting with AWS MGN
Deploy AWS MGN replication agents on source application servers so disk blocks replicate continuously over TLS into an isolated staging VPC:
- Validate application startup and health checks in AWS using MGN non-disruptive test drills before production cutover.
- Use automated MGN conversion to convert boot volumes and inject AWS virtualization drivers on target EC2 instances.
Step 4: Cutover Window and Rollback Readiness
- Lower the Amazon Route 53 DNS TTL to 60 seconds ahead of the cutover window.
- Quiesce source web/application servers into read-only mode so in-flight sessions complete without creating new writes.
- Wait for AWS DMS to flush final CDC transactions until target write offsets match source commit positions (zero pending changes).
- Update Route 53 records to route traffic to your AWS Application Load Balancers.
- Activate a pre-provisioned reverse AWS DMS CDC task streaming changes from AWS back to the source database so you can revert DNS without losing transactions if cutover validation fails.
Step 5: Post-Cutover Validation and Cleanup
Monitor CloudWatch alarms, database connection pools, and synthetic transaction probes for 48 hours after cutover. Once workload stability is confirmed, decommission temporary DMS/MGN replication instances to avoid idle charges.
Terraform Blueprint: AWS DMS Replication Infrastructure
The following Terraform configuration from the original guide provisions a private subnet group and a Multi-AZ, KMS-encrypted AWS DMS replication instance:
# Terraform Module: Hardened AWS DMS Replication Infrastructure
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
# Replication Subnet Group across private subnets
resource "aws_dms_replication_subnet_group" "dms_subnets" {
replication_subnet_group_description = "Private subnet group for DMS replication tasks"
replication_subnet_group_id = "enterprise-dms-subnet-group"
subnet_ids = ["subnet-0a1b2c3d4e5f6g7h8", "subnet-0h7g6f5e4d3c2b1a0"]
tags = {
Environment = "Migration"
ManagedBy = "Terraform"
}
}
# Production DMS Multi-AZ Replication Instance
resource "aws_dms_replication_instance" "dms_instance" {
replication_instance_id = "prod-zero-downtime-migration-instance"
replication_instance_class = "dms.r5.xlarge"
allocated_storage = 200
multi_az = true
publicly_accessible = false
kms_key_arn = "arn:aws:kms:ap-south-1:123456789012:key/migration-cmk"
replication_subnet_group_id = aws_dms_replication_subnet_group.dms_subnets.id
tags = {
Environment = "Production-Migration"
Purpose = "Zero-Downtime-CDC"
}
}
Configuration Notes & Items Flagged for Review
-
Replace placeholder IDs: Update
subnet_idsandkms_key_arnwith your own private VPC subnet IDs and KMS Customer Managed Key ARN before runningterraform apply. -
Additional resources required: The original snippet covers only the DMS subnet group and replication instance. You still need to configure the
dms-vpc-roleIAM role, source/targetaws_dms_endpointresources,aws_dms_replication_task(and reverse task for rollback), MGN launch templates, and Route 53 record updates for your environment.
How to Verify the Result
-
Before cutover: Confirm
CDCLatencySourceandCDCLatencyTargetin CloudWatch are sub-second and MGN staging launch tests pass health checks. - At cutover: Confirm AWS DMS task statistics show zero pending changes and target commit offsets match the quiesced source database.
- After cutover: Verify Route 53 resolves to the AWS load balancer endpoints and monitor CloudWatch alarms, database connection pools, and synthetic probes for 48 hours before retiring replication instances.
AI disclosure: This DEV.to edition was prepared with AI assistance from Maximyz Cloud's published guide and verified against the original WordPress source.
Top comments (0)