What inheriting a poorly documented environment taught me about dependency mapping, lift-and-shift and testing before cutover.
One of the more interesting infrastructure projects I've worked on started in what I'd call a Wild West environment.
Servers were running and the business depended on them. But there wasn't enough documentation for me to feel safe making big changes. What was running? What talked to what? And what would break if one server moved?
The goal was to migrate infrastructure with AWS Application Migration Service (AWS MGN) and Azure Migrate. Before that, though, I had a more basic job. I had to understand what I was migrating.
So I didn't start by building cloud resources or installing replication agents. I documented the existing environment and wrote a migration plan. Then I used both services for a lift-and-shift and ran test cutovers.
Looking back, the tools were the easy part. Turning a barely documented environment into something I could move in a controlled way took much more work. Here's how I approached it.
Discovery comes before migration
Wild West doesn't mean broken. It means that changing things without knowing the current state is risky. In a migration, that risk gets expensive fast.
Picture moving an app server successfully, then finding out it relies on a database that wasn't in the plan. Or moving a workload into AWS when its sign-in depends on an internal directory service the new network can't reach. The migration tool reports success. The app may even boot. The service is still unusable.
That's why my first task was discovery. For every server, I wanted these answers:
| Category | What I need to know |
|---|---|
| Compute | Server names, operating systems, CPU, memory |
| Storage | Disk sizes, utilisation, mount points, disk types |
| Networking | IP addresses, subnets, routes, firewall rules |
| Applications | Running services, versions, listening ports |
| Dependencies | Databases, APIs, authentication services |
| Security | Access controls, certificates, privileged accounts |
| Operations | Backups, monitoring, scheduled jobs |
| Business context | Owners, criticality, downtime tolerance |
On Linux, a few commands gave me most of the picture:
# OS and kernel
cat /etc/os-release
uname -r
hostnamectl
# Compute
lscpu
free -h
uptime
# Storage
lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS
df -hT
findmnt
cat /etc/fstab
# Networking and listening services
ip addr show
ip route show
sudo ss -tulpn
# Active TCP connections
sudo ss -tnp state established
The storage checks matter more than they look. A server can have several disks, and an app may keep its data somewhere other than the root filesystem. Miss one, and you migrate the operating system while leaving the data behind.
Active connections need a warning too. One snapshot is not a dependency map. Some connections only appear during scheduled jobs, backups or sign-in requests. So discovery should cover a stretch of normal activity, and not a single moment.
On Windows, PowerShell does the same job:
Get-ComputerInfo
Get-CimInstance Win32_ComputerSystem
Get-CimInstance Win32_OperatingSystem
Get-Disk
Get-Volume
Get-NetIPConfiguration
Get-NetRoute
# Running services
Get-Service | Where-Object {$_.Status -eq "Running"}
# Established connections
Get-NetTCPConnection -State Established |
Select-Object LocalAddress, LocalPort,
RemoteAddress, RemotePort, OwningProcess
# Scheduled tasks
Get-ScheduledTask | Where-Object {$_.State -ne "Disabled"}
Scheduled tasks are easy to forget. An app can look fine after migration, and then a nightly job fails at 2am. These commands show how I'd run and extend discovery. They aren't a word-for-word record of everything I ran on the original project.
Turning raw output into a plan
A pile of terminal output isn't a migration plan. I turned it into three documents.
An inventory of what exists. It also marks which workloads are production-critical and which can sit down for longer.
| Server | OS | CPU | RAM | Storage | Function |
|---|---|---|---|---|---|
| APP-01 | Linux | 4 vCPU | 8 GB | 100 GB | Application |
| DB-01 | Linux | 8 vCPU | 32 GB | 500 GB | Database |
| WEB-01 | Windows | 4 vCPU | 16 GB | 150 GB | Web server |
| AUTH-01 | Windows | 2 vCPU | 8 GB | 100 GB | Authentication |
A dependency matrix of who talks to whom.
| Source | Destination | Protocol | Port | Purpose |
|---|---|---|---|---|
| WEB-01 | APP-01 | HTTPS | 443 | Application requests |
| APP-01 | DB-01 | TCP | 5432 | Database connection |
| WEB-01 | AUTH-01 | TCP | 636 | Directory authentication |
Both tables use fictional servers, just to show the structure. The matrix makes one risk obvious. Move APP-01 without a path to DB-01, and the app breaks. It also feeds the migration order and the firewall rules in the target.
A current-state diagram. Spreadsheets hide relationships that a picture shows at a glance. The point isn't to have diagrams. It's to know what must keep working while things move.
Why I chose lift-and-shift
There are a few ways to move an app to the cloud. You can rehost it, replatform it onto managed services, or refactor it completely.
I went with lift-and-shift (rehosting) using MGN and Azure Migrate. Refactoring has its place. Swapping a self-managed database for Amazon RDS or Azure SQL Database could cut operational work. But every extra change adds a variable. With thin documentation, a cloud move plus a redesign makes failures very hard to trace. Was it the cloud, the app change, the database or the new deployment setup?
So I split the work into phases:
- Understand the existing environment
- Migrate and get stable
- Optimise the cloud setup
- Modernise apps where it makes sense
Rehosting doesn't freeze the architecture forever. It just means modernisation happens later, on a stable base you understand better.
Prepare the target first
A migration tool can replicate a server. It won't design a secure cloud environment for you.
On AWS, I'd get the VPCs, subnets, route tables, security groups, IAM roles, VPN or private connectivity, CloudWatch and backup policies ready. On Azure, the equivalent is VNets, subnets, NSGs, user-defined routes, managed identities, private connectivity, Azure Monitor and Recovery Services vaults.
The design depends on the workload. A database server shouldn't get a public IP just because it's being migrated. A web app doesn't need direct internet exposure if it sits behind a load balancer.
With AWS MGN there's another thing to plan. The replication staging area and the final environment do different jobs. Staging holds the replication servers and replicated storage. Test and production subnets hold the launched EC2 instances. Keep them separate, so a test instance can't touch the live production network by accident.
Using AWS MGN
MGN rehosts workloads into Amazon EC2 with continuous block-level replication. AWS documentation now also calls it AWS Transform MGN, but I'll stick with MGN here. Instead of building an image by hand, moving it and hoping it boots, MGN handles much of the replication and conversion.
For agent-based migrations, the AWS Replication Agent goes on each source server. Before installing it, I'd check:
- OS compatibility and free disk space
- Permissions to install
- Network access to AWS and the needed firewall rules
- Source disk layout
- Available replication bandwidth
A typical agent-based setup uses TCP 443 for service communication and TCP 1500 for replication traffic. Check the current AWS documentation for the exact requirements. A quick test from the source:
# Linux
nc -vz <replication-server-address> 1500
# Windows
Test-NetConnection `
-ComputerName <replication-server-address> `
-Port 1500
That only proves a port is reachable. It doesn't validate the whole replication setup.
Bandwidth catches people out. Replicating 500 GiB over an effective 100 Mbps link takes roughly 12 hours in theory. Add protocol overhead, competing traffic and outages, and it runs longer. And if the app writes new data faster than the pipeline can ship it, the lag keeps growing. So I wouldn't plan a window from disk size alone. I'd watch replication health and the backlog too.
Replication finishing doesn't mean the server will launch the way you want. MGN uses launch settings and EC2 launch templates for instance type, subnet, security groups, EBS, IAM profile, private IPs and tags. I'd review these before any test launch.
Also, don't copy the old specs blindly. A 16 GB server might have been overprovisioned. Or it might need more in the new storage setup. Historical CPU, memory, disk and network numbers should drive the choice. And the security groups should match the real dependencies from discovery. Opening every port just to make the migration work is a bad trade.
Using Azure Migrate
Azure Migrate covers discovery, assessment and migration into Azure. That's broader than MGN, which focuses on rehosting into AWS.
The method depends on the source. Supported VMware environments can use agentless migration, which avoids installing software on every guest. Hyper-V uses host-based replication. Physical servers and other platforms generally use a replication appliance and the Mobility service agent. The right one depends on the operating system, permissions and network.
The assessment helps with Azure readiness, VM sizing, cost estimates and storage. But I'd still review it by hand. A server that looks quiet during the assessment might only get busy at month-end. If that period isn't captured, the suggested VM size will be too small. The same goes for disks. Capacity and performance aren't the same thing. A workload may need only 200 GB but still need a lot of IOPS.
Before a test migration, I'd check the target subscription, resource group, virtual network, subnet, VM size, disk setup and access. As with AWS, the target has to support the app, and not just the operating system.
Neither service is better across the board. Both automate a lot of the replication and conversion. Neither knows your business requirements, who owns the app, how much downtime it can take or what data consistency you need. That part is still on the engineer.
Test cutovers saved me from surprises
I didn't want the first boot in the destination to happen during the real migration. So I ran test cutovers. Both services can launch test workloads while the source keeps running.
But a server that boots isn't a service that works. The app can fail to reach its database. DNS can fail to resolve. A Windows service can fail because it can't reach a domain controller. A Linux app can fail because a disk didn't mount. A test cutover is where you find those.
On a migrated Linux server, I'd start with the system and storage:
systemctl --failed
lsblk
df -hT
findmnt
ip addr show
ip route show
Then the app service, DNS and connectivity (the service name depends on the workload):
sudo systemctl status nginx
sudo journalctl -u nginx --since "30 minutes ago"
getent hosts database.internal.example.com
nc -vz database.internal.example.com 5432
curl --fail --show-error https://app.example.com/health
On Windows:
Get-NetIPConfiguration
Get-Volume
Get-Service | Where-Object {$_.Status -eq "Running"}
Resolve-DnsName database.internal.example.com
Test-NetConnection `
-ComputerName database.internal.example.com `
-Port 1433
Get-WinEvent -FilterHashtable @{
LogName = 'System'
Level = 2
StartTime = (Get-Date).AddHours(-1)
} -MaxEvents 30
A passing health check is a start. It isn't proof that the app works. Infrastructure checks tell you the server is healthy. Only the application owners can confirm the business workflows behave correctly.
Watch out for two production servers
Here's a risk I take seriously. Say a server runs a job every hour. The migrated test copy starts with the same config and can reach the production database. Now both run the same job. You get duplicate processing.
The same goes for queue consumers, payment processing, email services and background workers. A cloned server may even try to register with production monitoring or authentication under the original machine identity.
So I isolate test environments. That can mean dedicated test subnets, restricted security groups or NSGs, separate DNS and controlled access to dependencies. Scheduled jobs and workers may need switching off before app testing starts. The aim is to validate the migrated workload without starting a second live system by accident.
Migration waves
With many servers, I wouldn't move everything at once. Waves keep the risk down and make the work easier to manage. An illustrative order:
| Wave | Workloads | Purpose |
|---|---|---|
| 0 | Non-critical test servers | Prove the tooling |
| 1 | Development workloads | Test networking and operations |
| 2 | Internal applications | Validate shared dependencies |
| 3 | Production applications | Controlled business cutover |
| 4 | Remaining critical workloads | Finish the migration |
The real order should follow dependencies, and not how important a server feels. If three apps share one database, they may need to move together. Otherwise you'd need temporary links between source and destination, with extra latency and security work. Without the discovery documents, waves turn into random groups of servers.
The production cutover
The test cutover shows whether the migration is technically possible. The production cutover hands over responsibility. For that I'd write a runbook with the steps, owners, validation criteria and rollback conditions. A simplified one:
- Confirm the change window is approved
- Check replication health, with no unresolved errors
- Confirm backups can be recovered
- Stop or quiesce the source apps so no uncontrolled writes happen
- Verify the final sync is within the agreed recovery point
- Launch the destination workload
- Validate infrastructure, then the application
- Redirect traffic
- Monitor against the agreed thresholds
- Get stakeholder acceptance
On MGN, I'd confirm the source is ready for cutover and that no lag remains once writes have stopped. On Azure Migrate, I'd review the replication state and use the planned migration workflow for that source type.
Healthy replication doesn't prove a database is in a transactionally consistent state. Apps that need stronger guarantees may need extra application-level steps.
IP addresses usually change too. That affects hardcoded addresses, firewall allowlists, DNS records and outside integrations, so discovery helps here again. Before cutover, I'd list every place that references the old address. I prefer apps that use DNS names over fixed IPs. But a DNS change doesn't move every client at once. Caching and open connections slow it down. So I'd check TTLs early and expect some traffic to keep landing on the source. For stateful apps, both sides must never accept conflicting writes during that window.
What happens if it fails?
A migration plan shouldn't only describe the day everything works.
The destination might boot but run badly. A dependency might be out of reach. Sign-in might fail. Or an app owner might spot a critical function nobody tested. The rollback has to be defined before the migration starts.
It's also not as simple as turning the old server back on. If the new app has already taken transactions, the source doesn't have them. And neither MGN nor Azure Migrate should be treated as automatic reverse replication. Recovery has to cover changes made after cutover, which might mean reconciling data, restoring a database or setting up reverse replication separately.
That's why I'd settle two numbers up front. RTO (Recovery Time Objective) is how long the service can stay unavailable. RPO (Recovery Point Objective) is how much data loss the business can accept, measured in time. They tell you whether a migration and rollback approach is acceptable at all.
Migration isn't the end
A lift-and-shift can carry over every old problem. An overprovisioned server stays overprovisioned. Poor monitoring doesn't improve because the server now lives in AWS or Azure. Patchy backups don't fix themselves.
Once workloads are stable, I'd go after these:
- Infrastructure as Code. Bring networking, security groups, NSGs, IAM, monitoring and backup policies under Terraform. Be careful with resources created by migration tools. Make sure the Terraform config matches the real state before you apply, or you could change or replace a live production resource.
- Security. Review network exposure, privileged access, patching, encryption and workload identity. The new environment shouldn't inherit every weakness of the old one.
- Monitoring. CPU, memory, disk, network, availability and errors. CloudWatch on AWS, Azure Monitor on Azure.
- Cost. Once there's real performance data, review VM sizes, disks and unused resources. I wouldn't sign up for long-term reservations before the usage is steady.
- Modernisation. Only now does it make sense to ask whether an app should move to a managed database, containers or serverless. It's a separate decision, and no longer a complication in the middle of a migration.
What this project taught me
The most valuable part wasn't learning to use AWS MGN or Azure Migrate. It was seeing how much has to happen before those tools help.
Documentation is engineering work. In a migration it shapes the architecture, the network, the order of moves and the recovery plan. Without it, you're deciding on assumptions.
Tools don't replace judgement. They won't tell you which workloads should move together, whether the target is secure or whether the app can handle downtime.
Test migrations are worth the effort. I'd rather spend extra time testing than find a missing dependency inside a production window.
And a migrated server isn't a migrated service. A server can boot, with its disks attached and its network up. If users can't do the work they depend on, the migration isn't finished.
Final thoughts
When I started, the environment was Wild West infrastructure. It had to be understood, documented and prepared before anything moved. So I set out the current state, built a structured plan, used AWS MGN and Azure Migrate for lift-and-shift, and ran test cutovers before touching production.
The technology is rarely the only challenge. Often the real work is knowing the environment well enough to change it without adding risk. MGN can replicate servers. Azure Migrate can assess and move workloads. Terraform can build the infrastructure. None of them can rescue a plan that ignores dependencies, operations or data consistency.
A successful cloud migration starts long before the replication agent goes on. It starts with knowing what you have, why it's there and what must keep working when you move it.
The goal isn't just to get servers into the cloud. It's to go from an environment you don't fully understand to one you can run and improve with confidence.
That's the difference between moving servers and engineering a migration.
References
- AWS Application Migration Service: Migration Workflow
- AWS MGN Quick Start Guide
- AWS MGN Launch Settings
- Azure Migrate: Agentless and Agent-Based Migration Methods
- Azure Migrate: Test Replicating Virtual Machines
- Azure Migrate: Migrating Physical and Virtual Machines
Top comments (1)
Great walkthrough on moving from ad-hoc manual cutovers to structured AWS MGN pipelines! Having repeatable replication & staged cutover validation eliminates most migration-day surprises.