Home / Databases / SQL Server

DatabasesHow-toIntermediate

Lift and shift SQL Server to Amazon EC2: MGN, native backups or an AG replica

Rehost SQL Server on EC2 with full control. Covers instance and EBS design, three move methods (AWS Application Migration Service for whole servers, backup/restore via S3, and an AG replica over Direct Connect), licensing choices, and HA after the move.

Deepak Bhardwaj2 min read

Applies toSQL Server 2012+ on Windows Server to SQL Server on Amazon EC2

1. Instance and storage design

Item Recommendation
Instance family r6i/r7i (memory), m6i/m7i (general), x2iedn (very high memory per core, licensing efficient), z1d (high frequency)
Data / log volumes gp3 (set IOPS and throughput) or io2 Block Express for high, consistent IOPS; separate volumes for data, log, tempdb
tempdb Instance-store NVMe (on d types) is fast, but ephemeral — recreate the folder at start-up
AMI AWS SQL Server license-included AMI, or Windows + your media (BYOL)
Optimize CPUs Reduce cores/threads to cut SQL licences while keeping memory

2. Method A: AWS Application Migration Service (MGN)

Replicates the whole server block by block and launches it as EC2.

  1. Install the AWS Replication Agent on the source server.
  2. Continuous replication to a staging area; launch test instances and validate.
  3. Cutover: stop SQL Server services (or the app) for consistency, wait for replication, launch the cutover instance.

Good for "move as-is" waves. SQL Server version and configuration stay the same.

3. Method B: native backup/restore through S3

BACKUP DATABASE Sales TO DISK = 'D:\mig\Sales_full.bak' WITH COMPRESSION, CHECKSUM;
aws s3 cp D:\mig\Sales_full.bak s3://sql-mig-bucket/sales/
# on EC2
aws s3 cp s3://sql-mig-bucket/sales/Sales_full.bak E:\restore\

Restore WITH NORECOVERY, ship logs the same way, final log at cutover, WITH RECOVERY. SQL Server 2022 can also back up/restore directly to S3 (BACKUP ... TO URL = 's3://...' with an S3 credential).

This method lets you upgrade the version during the move (restore 2016 backups on SQL Server 2022).

4. Method C: AG replica over Direct Connect

Add the EC2 instance as an async replica of the on-premises AG (or a distributed AG), run it as DR, then fail over — the AWS version of the hybrid AG post. Lowest downtime for Tier 1.

5. Instance-level objects

Use dbatools Copy-DbaLogin, Copy-DbaAgentJob, Copy-DbaLinkedServer; join EC2 to AD (on-premises AD over Direct Connect, or AWS Managed Microsoft AD with a trust).

6. HA and backups on AWS

  • AG across two Availability Zones (multi-subnet, no load balancer needed), or FCI with FSx (see the FCI on EC2 post).
  • Backups: native backups to S3 (TO URL on 2022), AWS Backup with VSS-consistent snapshots of EC2, or your existing backup tool.
  • Monitoring: CloudWatch agent (Windows and SQL counters), CloudWatch Application Insights for SQL Server.

Tip

Use MGN for speed, but plan a second step for each server: upgrade, right-size or move to RDS. Lift-and-shift locks in the on-premises sizing and licences unless you revisit them.