How to Safely Decommission AWS Application Migration Service (MGN) and Stop Replication Charges
Many AWS customers are left with Application Migration Service (MGN) resources still running after a migration is complete, abandoned, or inherited with an account. These leftover source servers keep replication active and continue to incur charges, most visibly the "MGN-Replication:Paid_replication" line item. This article is a single, end-to-end runbook to safely stop these charges, clean up all residual resources, and optionally fully de-initialize MGN, with both Console and CLI steps.
Overview
After a migration is complete, AWS Application Migration Service (MGN) source servers often remain configured in the console, quietly generating replication charges. A common line item is:
$0.042 per Replication-hour for MGN-Replication:Paid_replication in US East (N. Virginia)
This guide walks through safely decommissioning MGN resources to stop these charges, and optionally fully de-initializing MGN to return an account to a clean, uninitialized state.
💲 Pricing note: The
$0.042/hrfigure is an example for US East (N. Virginia) and is current as of July 2026. Pricing changes over time and varies by region, verify current pricing at aws.amazon.com/mgn/pricing.
Key reassurance: Disconnecting source servers does NOT terminate your launched (cutover) EC2 instances. Those are your production workloads and remain untouched. Only the MGN-managed replication resources are removed.
When to use this guide
- A migration has completed (or been abandoned) and you no longer need MGN replication.
- You inherited an AWS account with pre-existing MGN configuration you want to clean up.
- You want to stop
MGN-Replication:Paid_replicationand associated staging costs.
⚠️ Before you begin: Confirm that all target/cutover EC2 instances are running and healthy, and that you will not need to re-run replication or fail back to the original source servers. Disconnecting stops replication immediately.
What Generates the Cost?
The $0.042/hr Paid_replication charge comes from the replication server instances MGN runs in your staging area subnet, one set per actively replicating source server. Associated costs include:
| Resource | Cost driver |
|---|---|
| Replication server instances (EC2) | Per replication-hour ($0.042/hr in us-east-1) |
| Staging EBS volumes | Replicated disk storage (GB-month) |
| EBS snapshots | Point-in-time snapshot storage (GB-month) |
| Data transfer | Replication traffic |
Disconnecting a source server stops the replication-hour and staging EBS charges, per the AWS documentation, all MGN-created replication resources are terminated/deleted within 90 minutes. Snapshots may linger and require manual cleanup (Step 3).
Step 1 - Disconnect Source Servers
Disconnecting immediately stops data replication and triggers cleanup of MGN-created replication resources.
🌐 Region note: MGN is a regional service. Every CLI command below requires
--regionand must be repeated for each region where MGN was initialized. If you're unsure which regions have MGN configured, check the MGN console region selector or run the commands across your active regions.
Console: MGN Console → Source servers → select server → Actions → Disconnect from service
CLI:
# List active (non-archived) source servers first aws mgn describe-source-servers --filters isArchived=False \ --query "items[*].sourceServerID" --region REGION # Disconnect each source server aws mgn disconnect-from-service --source-server-id s-1234567890abcdef0 --region REGION
⏱️ Wait ~90 minutes. All AWS resources created by MGN for replication (replication instances, staging EBS) are terminated/deleted within 90 minutes. Launched Test/Cutover instances are NOT terminated. If the agent can still reach the service, it self-uninstalls within ~10 minutes.
Step 2 - Archive & Delete Source Servers
Console: MGN Console → Source servers → select a disconnected server → Actions → Mark as archived. Archived servers can then be removed via Actions → Delete server.
CLI:
# Archive each disconnected source server aws mgn mark-as-archived --source-server-id s-1234567890abcdef0 --region REGION # Delete the archived source server (fully removes it from the console) aws mgn delete-source-server --source-server-id s-1234567890abcdef0 --region REGION
Step 3 - Clean Up Residual Resources
Disconnect auto-removes replication instances and staging volumes, but EBS snapshots and staging security groups may remain.
Console:
- EC2 Console → Snapshots → filter by tag
aws:mgn:source-server-id→ select → Actions → Delete snapshot. - EC2 Console → Security Groups → search
AWS Application Migration→ delete unused MGN staging security groups. - VPC Console → Subnets / Your VPCs → remove MGN-dedicated staging subnets/VPCs (only if not shared).
CLI:
# Find MGN-tagged EBS snapshots aws ec2 describe-snapshots --owner-ids self \ --filters "Name=tag-key,Values=aws:mgn:source-server-id" \ --query "Snapshots[*].[SnapshotId,VolumeSize]" \ --output table --region REGION # Delete each snapshot aws ec2 delete-snapshot --snapshot-id snap-0abc123def456789 --region REGION # Check for leftover MGN staging security groups aws ec2 describe-security-groups \ --filters "Name=group-name,Values=*AWS Application Migration*" \ --query "SecurityGroups[*].[GroupId,GroupName,VpcId]" \ --output table --region REGION
🔎 If no snapshots are returned: Older MGN setups may tag snapshots differently (e.g.
AWSApplicationMigrationServiceCreated) or not at all. If the tag filter above returns nothing, try filtering by description instead — look for snapshots whose description contains "MGN" or "Application Migration" before deleting.
Delete replication staging subnets/VPCs only if they were purpose-built for MGN and are not shared with other workloads.
Step 4 - Delete the Replication Configuration Template
All source servers and jobs must be deleted first (the API enforces this order).
Console: MGN Console → Settings → Replication template → select the template → Delete. (Available once all source servers and jobs are removed.)
CLI:
# List templates aws mgn describe-replication-configuration-templates \ --query "items[*].replicationConfigurationTemplateID" --region REGION # Delete each template aws mgn delete-replication-configuration-template \ --replication-configuration-template-id rct-1234567890abcdef0 --region REGION
Step 5 - Verify Zero Cost
- Cost Explorer → filter Service = AWS Application Migration Service and EC2 - Other (for EBS/snapshots) → confirm charges trend to $0.
- Confirm the MGN console shows no source servers.
- Confirm no replication instances remain running in the staging subnet.
⏳ Billing lag: Cost Explorer data can take 24–48 hours to reflect the drop to zero after cleanup. Don't be alarmed if charges still appear immediately after decommissioning — verify again after a day or two.
Console tip: In the MGN Console, the Source servers list should be empty, and Settings → Replication template should show no template once decommissioning is complete.
Step 6 - Fully De-Initialize MGN (Optional)
To completely reverse MGN initialization and return the account to an uninitialized state, clean up all resources in the order below, then delete the service-linked role. The order is enforced — a parent resource cannot be deleted while child resources exist (otherwise the API returns a ConflictException).
Each step below can be done in the MGN Console (Applications, Waves, Source servers, and Settings → Replication template sections) or via the CLI shown here.
1. Delete Waves & Applications (in every region MGN was used):
Console: MGN Console → Waves → select → Actions → Delete wave; then Applications → select → Actions → Delete application.
CLI:
aws mgn list-waves --region REGION aws mgn delete-wave --wave-id {WaveID} --region REGION aws mgn list-applications --region REGION aws mgn delete-application --application-id {ApplicationID} --region REGION
2. Disconnect, Archive & Delete Source Servers (Steps 1–2 above).
3. Delete MGN Jobs:
Console: MGN Console → Source servers → Job history (or the Launch history view) → review jobs. Jobs age out automatically; use the CLI to delete explicitly.
CLI:
aws mgn describe-jobs --region REGION aws mgn delete-job --job-id {MGNJobId} --region REGION
4. Delete Replication Configuration Template(s) (Step 4 above).
5. Delete the service-linked role (the final step = full de-initialization):
Console: IAM Console → Roles → search AWSServiceRoleForApplicationMigrationService → Delete.
CLI:
aws iam delete-service-linked-role \ --role-name AWSServiceRoleForApplicationMigrationService
Note: Cleaning up these resources causes MGN to stop working in that account (the intended outcome). To re-enable MGN later, simply create a new Replication Configuration Template, the service-linked role is auto-recreated. Remember to repeat the waves/applications cleanup in all regions where MGN was used.
Summary / Key Takeaways
- Disconnecting a source server stops the
Paid_replicationcharge, replication resources auto-delete within 90 minutes. - Launched EC2 (cutover) instances are never affected by disconnect/archive/delete.
- Order matters: Disconnect → Archive → Delete servers → Delete jobs → Delete replication template → (optional) Delete service-linked role.
- Full de-initialization = clean up all resources, then delete
AWSServiceRoleForApplicationMigrationService. - Always verify in Cost Explorer to confirm charges have stopped.
References
- Language
- English
Relevant content
asked a year ago
asked 2 years ago
