Skip to content
Book a scoping call

A cloud migration plan with a way back at every stage

A migration plan is a list of stages, each with a check that proves it worked and a way to undo it. This is how to write one before anything moves.

Muhammed Azharudheen K JFounder, CTO & Director

5 min read

Most cloud migrations that go wrong were planned as a single event: a weekend when everything moves and the old servers are switched off on Monday. When something fails in the middle of the night, there is no clean way back. The choice is between pushing through and restoring from backups under pressure.

A better plan treats the move as a series of small stages. Each one moves one part of the system, has a check that proves it worked, and has a rollback point: a known state you can return to quickly if the check fails. Here is how to write that plan.

migration · your-domain.com
Fig. Staged migration

Inventory

The plan can only be as good as the list of what is moving. Build the inventory from the running systems. Old documentation is a starting point at best.

For each server or service, record:

  • What runs on it, including scheduled jobs and background workers
  • What it talks to: databases, file storage, third-party APIs, internal services
  • Which data lives on it, how large it is and how fast it grows
  • Who uses it, and when the quiet hours are
  • Every domain and certificate that points at it, and where its email is routed

The last item causes more cutover-day surprises than any other. A forgotten DNS record for a payment callback, or an MX record that still points at the old server, will not show up in testing and will break on the day. Export the full zone file for every domain and go through it line by line.

Pay particular attention to anything with fixed hours. A ticketing system for a transport operator, or a booking engine before a holiday weekend, has windows when a migration step cannot run at all. Those windows shape the stage plan more than any technical constraint.

Target architecture

Decide where each part lands before moving anything, and agree it in writing. The target architecture answers four questions.

  • Which cloud and which region, chosen for your data rules and for where your users are
  • Which services move as they are, and which change shape: a managed database in place of a self-run one, or object storage in place of a local disk
  • How the network is laid out, including what is reachable from the internet
  • How backups and restores work on the new platform

Define the target environment as code, in Terraform or an equivalent, in your repository. The new environment can then be reviewed in pull requests, rebuilt for a rehearsal and compared against the plan. It also means the first stage of the migration is building the target, which carries no risk to production at all.

Keep the number of changes per stage low. Moving a database to a new provider and upgrading its major version at the same time doubles what can go wrong and halves what a failed check tells you. Move first, then upgrade as a separate stage.

Stage plan with rollback points

The stage plan is the core of the document. Each stage has four parts.

PartWhat to write
ScopeExactly what moves in this stage
CheckThe test that proves it worked: a query, a page load, a job run, a count of records
RollbackThe steps back to the state before the stage, and how long they take
OwnerThe person who decides to continue or roll back

A typical order for a web application:

  1. Build the target environment from code, with monitoring, and leave it empty.
  2. Replicate the database to the new platform, keep it in sync with the old one, and compare record counts and checksums.
  3. Move file storage, syncing new uploads to both locations during the transition.
  4. Deploy the application to the new platform against the replicated data, and test it on a temporary hostname.
  5. Cut over traffic by changing DNS, with the old platform still running and still able to take traffic back.
  6. Decommission the old platform only after the new one has run cleanly through a full business cycle, such as a month-end.

The rollback point for each stage should be simple. For stage 2, it is "stop replication; the old database is still the source of truth". For stage 5, it is "point DNS back at the old load balancer". If a rollback needs a restore from backup, the stage is too large and should be split.

A few days before the cutover, lower the TTL on every DNS record you will change. A record with a long TTL can keep sending some users to the old address for hours after you change it, which makes both the move and any rollback slower than planned.

Cutover day

If the stages above are done well, cutover day is short and a little dull. Rehearse it first: run the whole cutover against a staging copy, time each step, and write the timings into the runbook.

On the day:

  • Announce a change window to users, even if you expect no visible interruption.
  • Freeze deploys to the application for the window.
  • Work through the runbook in order, with one person reading the steps and another carrying them out.
  • Run every check in the stage plan after each step, and record the results.
  • Decide at fixed points whether to continue or roll back. The person who owns that decision is named in advance.

Keep the old platform running and unchanged after the cutover. It is your rollback for as long as you keep it, and a few more weeks of hosting costs little next to losing that option.

After the move

The migration finishes when the old platform is switched off, and that should wait. Watch the new platform through at least one full business cycle: month-end reports, payroll runs, the busiest day of the week. Problems that only appear under those loads are the ones a short test misses.

Then close out the work.

  • Confirm backups run on the new platform, and restore one in a test.
  • Compare the new monthly bill with the estimate, and resize anything larger than it needs to be.
  • Update the runbook and the architecture diagram so they describe the system as it now runs.
  • Remove the old platform's access keys and DNS records, then switch it off.

Every cloud migration we run follows this shape: an inventory of every server and service, a target architecture agreed in writing, a stage plan with a rollback point at each stage, and monitoring on the new platform from the first day. The stage plan is written down and agreed before the first stage starts.

Next step

Working on your cloud operations?

Bring the system, the spreadsheet or the brief. A 30-minute call, then a written scope within one business day.

Accessibility

Text size

Display and motion

Saved in this browser.