Legacy modernization strategies, and when each one fits
There are seven legacy modernization strategies worth knowing: rehost, replatform, refactor, rearchitect, rebuild, replace and retire. They run from cheapest and least invasive (move it as-is) to most expensive and risky (build it again). The right legacy modernization approach is rarely one of them for the whole system – it’s a different choice for each component, based on business value and how much it changes.
The lists come from Gartner and from AWS’s migration guidance, and the labels vary slightly between them. The version below is the one I use with SaaS teams, with the conditions where each option earns its cost.
Start with why, not with which R
Before picking a strategy, write down the problem you’re actually solving. “The code is old” isn’t one. These are:
- Risk: an unsupported runtime, a data center lease ending, a dependency with unpatched vulnerabilities, or one engineer who understands the system.
- Cost: hosting or license fees that have outgrown the business, or a platform that charges a premium for convenience you no longer need.
- Speed: features take months because every change is risky, which is a technical debt problem.
- Capability: the system can’t do something the business now needs – multi-tenancy, an API, real-time updates, enterprise SSO.
- Hiring: nobody wants to work on it, and the people who can are expensive or leaving.
Risk and cost problems are often solved by the cheaper strategies. Speed and capability problems usually need refactoring or rearchitecting. Mixing these up is how teams end up rebuilding a system when moving it to a new host would have done.
1. Rehost (lift and shift)
Move the application to new infrastructure without changing the code – from on-premise servers to cloud VMs, or from one provider to another. It’s fast and low-risk, and it solves infrastructure problems: an expiring lease, hardware end-of-life, a hosting provider you need to leave.
It doesn’t make the application any easier to change, and a lift-and-shift to the cloud often costs more than the hardware it replaced because nothing is sized for cloud pricing. Do it when the deadline is driven by infrastructure, then plan the next step.
2. Replatform (lift, tinker and shift)
Move with small, targeted changes that take advantage of the new platform: a self-managed database moved to managed Postgres, containers instead of hand-built servers, a runtime upgrade done as part of the move. Leaving Heroku for containers on a cloud provider is a typical replatform – the code barely changes, but the operational model does.
This is the best value option for many SaaS teams. It cuts operating cost and toil without touching the business logic. This is what my Heroku migration and cloud migration work covers.
3. Refactor
Improve the internal structure of the code without changing what it does: extract modules, add tests around hotspots, upgrade the framework a major version at a time, remove dead code. It’s continuous and low-risk, and it’s how most healthy codebases stay healthy.
Refactoring fits when the architecture is broadly sound but the code has decayed. It doesn’t fit when the fundamental structure is wrong – a single-tenant data model in a product that now needs strong tenant isolation, for example. Reducing technical debt covers the mechanics.
4. Rearchitect
Change the structure significantly: draw module boundaries in a monolith, extract a service that has genuinely different scaling or ownership needs, move from synchronous jobs to an event-driven design, or rebuild tenancy. Usually done incrementally with the strangler fig pattern so the product keeps shipping.
Rearchitecting is the right call when a structural limit is blocking the business – the system can’t scale past a certain customer size, or a capability the roadmap needs can’t be added cleanly. It’s expensive, so tie it to that limit and not to architectural fashion. Moving to microservices because it sounds modern is the classic mistake; see microservices vs monolith.
5. Rebuild
Rewrite the component from scratch, keeping its scope and specification. This is the most expensive and riskiest option, and the one teams reach for most eagerly. It can be right for a small, well-understood component whose code is beyond repair, or when the language or platform itself is a dead end. For a whole product, it almost always takes longer than planned and loses behavior customers relied on. The detailed case is in rewrite vs refactor.
6. Replace
Swap a custom-built component for a commercial or open-source product. Home-grown auth replaced with an identity provider, a custom billing engine replaced with Stripe Billing, an internal search replaced with a managed search service. This is often the most underrated option.
The test is whether the component is a differentiator. If customers buy your product because of it, keep building it. If it’s plumbing every SaaS needs, buying it frees your team for the work that matters. The trade-offs are lock-in, recurring cost and fitting your process to someone else’s model. Build vs buy goes deeper.
7. Retire
Switch it off. Every legacy system has features that a handful of customers use, admin tools nobody opens, and integrations with partners who left years ago. Check usage data, talk to the account managers, migrate the few users who care, and delete the code. Retiring is the cheapest modernization there is, and it shrinks the scope of every other strategy. I always look for retirement candidates first.
How to choose: a component-by-component approach
Legacy system modernization strategies work best applied per component, not per system. My process:
- Inventory the components – major modules, services, data stores, jobs and integrations.
- Score each on two axes: business value (revenue, differentiation, customer dependence) and change rate (how often the roadmap needs to touch it).
- Map to a strategy. Low value and low change: retire or rehost. Low value, high change: replace with a product. High value, low change: replatform and leave the code alone. High value, high change: refactor, and rearchitect where a structural limit is in the way.
- Sequence by risk and dependency. Infrastructure deadlines first, then retirements (they shrink everything else), then the high-value work.
- Set exit criteria for each piece – what “done” means, and how you’ll measure it.
Common mistakes
- Picking one strategy for the whole estate, usually “rebuild”.
- Modernizing the parts that are easy rather than the parts that cost money.
- Starting a multi-year program with no slice in production for six months.
- Underestimating data migration, which is usually harder than the code.
- Ignoring the team. A strategy the current engineers can’t execute or maintain isn’t a strategy.
If you want a second opinion on which strategy fits which part of your system, that’s exactly what the first two-week sprint of a legacy modernization engagement is for. And if your system is small and your team is strong, you may not need outside help at all – the framework above is most of what I’d bring.
Questions
What are the 7 Rs of legacy modernization?
The commonly cited options are rehost, replatform, refactor, rearchitect, rebuild, replace and retire. Gartner and AWS publish different lists – Gartner’s seven include encapsulate and leave out retire, and AWS’s 7 Rs include repurchase, retain and relocate – but they cover the same range, from moving a system as-is to switching it off.
What is the best legacy modernization approach?
There isn’t one for a whole system. Apply a strategy per component based on business value and how often it changes. Most successful programs combine retiring unused features, replatforming stable parts, replacing commodity components and incrementally rearchitecting the core.
Is rehosting worth it?
Rehosting is worth it when an infrastructure deadline forces a move – an expiring contract, unsupported hardware or a provider you must leave. It rarely reduces cost or speeds up development on its own, so treat it as a first step and plan the replatform or refactor that follows.
How long does legacy application modernization take?
It ranges from weeks for a replatform to years for rearchitecting a large core system. The important thing is that each piece delivers value within weeks. Programs that go six months without anything in production are at high risk of being canceled before they finish.
Need to pick a strategy you can defend?
I’ll map your system component by component with your team, recommend a strategy for each, and ship the first change inside a two-week sprint.
GMT+2 · Full EU overlap · US East mornings