Most cloud migration projects fail not because the technology is too hard, but because the strategy is too vague. I've been part of migrations where leadership said "move everything to the cloud" without defining what "move" actually meant for each workload, and the result was six months of rework, blown budgets, and applications that ran worse than they did on-premises. The 6 Rs framework — Rehost, Replatform, Repurchase, Refactor, Retire, and Retain — gives you a shared language to decide workload by workload what the right move is. In this article, I’ll walk through each strategy as I’ve applied it in production environments, when it makes sense, what it costs operationally, and how to choose without over-engineering the decision. If you are planning your first major cloud migration, understanding the 6 rs early will save you from treating every application the same.
Rehosting: Lift-and-Shift When Speed Beats Elegance
In my experience, rehosting is the most misunderstood of the 6 Rs. It is often dismissed as "lazy migration," but when you have a data center lease expiring or 200 VMs that need to be out of a colocation facility in 90 days, rehosting is the most responsible choice. Rehosting means moving an application to the cloud with minimal to no code changes. You take the VM, the OS, the app, and you run it on EC2, or you use a service like AWS Application Migration Service (MGN) to replicate block-level changes continuously until cutover.
The goal is not optimization. The goal is to get out of the old environment quickly and then iterate once you are on cloud infrastructure where you have better observability, backup, and scaling primitives.
What Rehosting Actually Moves
A typical rehost I run involves an agent on the source server that replicates to the target VPC. The network, security groups, and IAM roles are prepared ahead of time with Terraform, and the application itself is untouched. You are not fixing technical debt; you are relocating it. That is intentional. For a legacy Java app running on RHEL 7 with a local MySQL instance, you will end up with the same app running on an EC2 instance in a private subnet, backed by EBS, with CloudWatch agents installed. Performance will be similar, and that is the point — you reduce migration risk.
I’ve found that rehosting works best for applications that are stable, not actively developed, and have poorly documented dependencies. If nobody wants to touch the code, don’t touch the code. Move the server and document the dependencies after you have VPC Flow Logs and better monitoring.
When I Recommend Rehosting Over Other Options
I recommend rehosting when three conditions are true: the migration timeline is under 6 months, the application is not customer-facing or directly tied to revenue growth, and your team does not yet have strong cloud operational maturity. It gives your operations team time to learn auto scaling, patching, and backup in AWS without also learning Kubernetes or refactoring databases at the same time. One warning: rehosted workloads will often cost more in the first three months because you are running 1:1 infrastructure without rightsizing. Plan a 30-60 day optimization sprint after cutover to change instance types, enable Compute Optimizer, and convert to Graviton where possible.
# Rehosting a legacy app server with Terraform
# This mirrors an on-prem VM as an EC2 instance - no app changes
resource "aws_instance" "legacy_app" {
ami = "ami-0c55b159cbfafe1f0" # RHEL 7 hardened AMI
instance_type = "m6i.xlarge" # Start 1:1, rightsizing comes later
subnet_id = aws_subnet.private_a.id
vpc_security_group_ids = [aws_security_group.legacy_app.id]
root_block_device {
volume_type = "gp3"
volume_size = 100
encrypted = true
}
user_data = file("${path.module}/bootstrap-cw-agent.sh")
tags = {
Name = "legacy-app-rehost"
MigrationStrategy = "rehost"
Environment = "production"
}
}
resource "aws_security_group" "legacy_app" {
name_prefix = "legacy-app-"
vpc_id = aws_vpc.main.id
ingress {
from_port = 8443
to_port = 8443
protocol = "tcp"
cidr_blocks = [var.app_cidr]
}
}
For provisioning details and provider options, I regularly refer to the Terraform Documentation when building these baseline modules so the team can reuse them across dozens of rehosted servers.
Replatforming: Extracting Cloud Value Without Rewriting Everything
Replatforming is where I see the best return for effort for most teams. You make a small, targeted change to use a managed service, but you do not rewrite the application architecture. Think moving a self-managed MySQL on EC2 to Amazon RDS, moving file storage from local disk to EFS or S3, or putting an existing containerized app behind an Application Load Balancer instead of an NGINX VM you manage yourself.
This is sometimes called "lift, tinker, and shift." You keep 90% of the code, but you remove undifferentiated heavy lifting. In my experience, replatforming reduces operational load more than any other R except repurchasing, because you offload patching, backups, and high availability to AWS.
Common Replatforming Moves I Use in Production
The most frequent replatform I perform is database offloading. Instead of rehosting MySQL and then managing replication and backups yourself, you use AWS Database Migration Service to move to RDS with Multi-AZ. Another common one is moving session storage from local disk to ElastiCache for Redis, which immediately makes your EC2 tier stateless and allows for proper auto scaling. For Windows workloads, moving from self-managed Active Directory to AWS Managed Microsoft AD is another low-risk, high-value change.
These changes typically require configuration updates, not code rewrites. Your connection strings change, your IAM roles need new permissions, and you need to test failover, but you are not changing business logic.
The Operational Trade-offs In My Experience
Replatforming is not free. Managed services have opinionated constraints. RDS does not give you superuser access, and some MySQL parameters are restricted. ElastiCache has specific engine versions. I’ve had migrations stall because the application relied on a MySQL plugin that RDS does not support. Always run the AWS Schema Conversion Tool and check the managed service limitations before committing.
Networking also matters more here. When you split an app server and database that used to be on the same VM into EC2 and RDS, you introduce latency and security boundaries. I plan the VPC, subnets, and routing early. If you are consolidating multiple VPCs after several replatforms, review Cloud Networking: VPC Peering, Transit Gateway and PrivateLink to avoid peering sprawl. A Transit Gateway with centralized egress saves a lot of operational pain later.
# Replatforming: Move local MySQL to Amazon RDS
# Application code unchanged except for DB endpoint
resource "aws_db_instance" "app_db" {
identifier = "app-replatformed-db"
engine = "mysql"
engine_version = "8.0.36"
instance_class = "db.r6g.large"
allocated_storage = 100
storage_type = "gp3"
storage_encrypted = true
multi_az = true
db_subnet_group_name = aws_db_subnet_group.private.name
vpc_security_group_ids = [aws_security_group.db.id]
parameter_group_name = "mysql8-custom"
backup_retention_period = 7
deletion_protection = true
tags = {
MigrationStrategy = "replatform"
}
}
# Application now points to RDS endpoint via Secrets Manager
# No local DB to patch, backup, or replicate
Repurchasing: Trading Custom Code for SaaS Accountability
Repurchasing means you stop running something and buy it as a service. The classic example is moving a self-hosted email system to Google Workspace or Microsoft 365, or replacing a custom CRM with Salesforce, or swapping a homegrown logging stack with Datadog or New Relic. In cloud migration terms, repurchasing is often the most economically rational choice, but it is also the most politically difficult.
I worked with a team that maintained a custom-built HR onboarding portal for eight years. It required two developers part-time just to keep it compliant. Repurchasing it with Workday took six months of data migration and integration work, but it eliminated 30% of their annual maintenance load. The decision was not technical; it was about whether that code was core to the business. In most cases, it isn’t.
When evaluating repurchase, I focus on three questions. First, does this application differentiate us in the market? If not, buy. Second, what is the true total cost of ownership including patching, security reviews, and on-call? Custom apps often look cheap until you add security and compliance effort. Third, what is the data exit strategy? With SaaS, your leverage is your data portability. I require that any repurchased service supports bulk export and has a defined data residency option before I sign off.
Repurchasing also changes your architecture in a good way. You remove an entire VPC workload, its pipelines, and its on-call rotation, and you replace it with an API integration and an identity federation task. From an infrastructure perspective, less to run is a win. Just make sure identity and access are part of the plan from day one — federate with SAML or OIDC, enforce MFA, and scope API tokens tightly.
Refactoring and Re-architecting for Cloud-Native Resilience
Refactoring — often called re-architecting — is the only R that involves significant code changes to take advantage of cloud-native capabilities. This is where you break a monolith into microservices, make an application serverless, or rebuild a workflow around queues and events instead of synchronous calls. It is the most expensive and longest-running strategy, and it should be reserved for workloads where agility and scale directly affect revenue or customer experience.
I only recommend refactoring when the application needs capabilities that cannot be achieved through rehosting or replatforming: independent deployability of components, elastic scale to zero, or resilience to AZ failure without manual intervention. If you are refactoring just to be "modern," you will burn budget with little business outcome.
From Monolith to Services Without a Big Bang Rewrite
The refactoring approach that has worked best for me is the strangler fig pattern. You do not rewrite the monolith at once. You identify a bounded context — for example, image processing or payment notifications — and you extract it as a separate service behind an API or event. The monolith stays in place and calls the new service. Over time, more functionality is strangled off until the monolith is small enough to retire.
For new services, I default to containers on ECS or EKS if the team already runs Kubernetes, or to serverless with Lambda and API Gateway if the workload is event-driven and spiky. If your team is considering serverless, it is worth mapping the patterns first — see Serverless Architecture Patterns: API Gateway, Lambda and Step Functions for a practical breakdown of when step functions help and when they add unnecessary complexity.
What Refactoring Really Costs
Refactoring costs are not just engineering hours. You need new CI/CD pipelines, distributed tracing, centralized logging, and a different testing strategy. A monolith that fails as a unit is now a system that can fail partially, so you need to design for retries, idempotency, and observability from the start. I budget 2-3x the initial development estimate for operational hardening, and I plan for parallel run where both old and new systems process traffic until confidence is high.
Here is a simplified containerization step that often starts a refactoring effort. The application itself may not change much initially, but packaging it properly unlocks consistent deployment and scaling.
# Dockerfile for refactoring a legacy Java monolith toward containers
# Multi-stage build keeps final image minimal and secure
FROM eclipse-temurin:17-jdk-jammy AS builder
WORKDIR /app
COPY gradlew build.gradle settings.gradle ./
COPY gradle ./gradle
RUN ./gradlew dependencies --no-daemon
COPY src ./src
RUN ./gradlew bootJar --no-daemon -x test
FROM eclipse-temurin:17-jre-jammy
WORKDIR /app
RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
COPY --from=builder /app/build/libs/app.jar app.jar
USER appuser
EXPOSE 8080
ENTRYPOINT ["java", "-XX:+UseContainerSupport", "-jar", "app.jar"]
The Docker Documentation is the most reliable reference for multi-stage builds and best practices for keeping images lean and without unnecessary privileges. Once containerized, you can run this image on ECS Fargate or EKS without changing the code, then iteratively extract services as needed.
Retire and Retain: The Two Rs Teams Forget to Use Strategically
Retire and retain do not involve moving anything, which is why they are often ignored in migration planning. That is a mistake. In every portfolio assessment I’ve done, 10-20% of applications can be retired. They are duplicate tools bought by different teams, projects that never went live, or systems kept alive for one report that could be generated elsewhere. Retiring them before migration saves migration budget, licensing, and future operational effort. It is the highest ROI activity in the entire program.
To identify retire candidates, I use discovery data from the last 90 days: no logins, no inbound connections, no batch jobs with business owner confirmation. If nobody can name the owner, that is a strong signal. I require a formal sign-off and a 30-day archive of data to S3 Glacier before decommissioning. In one migration of 340 applications, we retired 47. The cost avoidance alone funded the migration tooling for the remaining 293.
Retain means you consciously decide not to migrate yet. You keep the application on-premises or in its current hosting environment for a defined reason: technical constraints like hardware dependencies, compliance where data cannot leave a specific data center yet, or business timing where a vendor contract ends in eight months. Retain is not "ignore." It is a documented decision with a revisit date. I log retained apps in a register with justification, owner, and next review quarter. Without that, retain becomes permanent shadow IT.
Both decisions require courage because they feel like non-progress. In reality, they let you focus engineering effort on the 60-70% of workloads where cloud adds measurable value. I also use retain strategically for mainframe or low-latency trading systems where a hasty rehost would degrade performance. It is better to retain and plan a proper replatform later than to force a poor fit.
A Decision Framework for Matching Each Workload to Its Right R
Choosing among the 6 Rs is not about picking the most exciting option. It is about constraints: time, team skill, business value, and risk tolerance. I run a lightweight assessment for each workload with the application owner, an engineer, and someone from operations. We score five factors on a simple scale and then map to an R. This keeps the conversation evidence-based instead of opinion-based.
The assessment covers business criticality, change tolerance, technical debt, compliance requirements, and operational maturity. A revenue-generating, frequently changed application with high technical debt and a team that knows containers is a refactoring candidate. A stable internal tool with no active development and a hard deadline is a rehost. A commodity function like email or ticketing is a repurchase. I also overlay cost data early — even a rough TCO model prevents surprises when a rehosted Oracle database brings its license with it.
Once a direction is chosen, I align the design with architectural guardrails. Even for rehosted workloads, I validate against the AWS Well-Architected Framework: Applying the Five Pillars in Practice and our landing zone standards. For teams using multiple accounts, applying the patterns in Multi-Account AWS Strategy: Landing Zones, Control Tower and Organization Units at the start prevents rework when you need to add guardrails, centralized logging, and network controls later. It is much cheaper to launch into the right account structure than to refactor accounts after 50 workloads are live.
The table below is the reference I share with stakeholders to calibrate expectations. It is not a rulebook, but it helps set honest conversations about effort, risk, and benefit.
| Strategy | Typical Effort & Duration | Code Changes | Best Fit | Primary Risk If Misapplied |
|---|---|---|---|---|
| Rehost | Low, 2–8 weeks per app | None to minimal | Tight deadlines, stable apps, data center exit | Higher cloud cost without optimization; no agility gain |
| Replatform | Medium, 1–3 months | Configuration only | Databases, caching, messaging that can use managed services | Managed service limits or latency issues if not validated |
| Repurchase | Medium to High, 2–6 months | Replace with SaaS, integrate via API | Commodity functions (CRM, HR, email, ticketing) | Vendor lock-in and data portability gaps |
| Refactor | High, 3–12+ months | Significant re-architecture | Core revenue apps needing scale, resilience, and frequent releases | Long timeline, cost overrun if scope is not bounded |
| Retire | Low, 2–4 weeks | None (decommission) | Unused, duplicate, or obsolete applications | Premature retirement without owner sign-off |
| Retain | Low (assessment only) | None | Regulated, hardware-bound, or pending contract renewal | Drift into indefinite delay without revisit date |
My practical rule is to aim for a portfolio mix, not a single strategy. In a recent 120-application program, we rehosted 45%, replatformed 30%, repurchased 10%, refactored 8%, retired 5%, and retained 2% for later. That mix met the data center exit deadline while still delivering modernization where it mattered. Start with one rehost and one replatform as pilots to build migration runbooks, then use those runbooks to scale. Measure each cutover with clear success criteria: latency, error rate, and operational load on the new platform for the first 30 days.
Frequently Asked Questions
How do we decide between rehosting and replatforming when time is tight?
When the deadline is the primary constraint, I default to rehosting and schedule replatforming as a phase two. Replatforming adds validation steps — testing RDS failover, checking parameter compatibility, updating connection handling — that can extend the timeline by weeks. If you have even four to six weeks of buffer, replatforming the database tier alone usually pays back quickly in reduced patching and backup effort. Make the decision per workload, not per program.
Is refactoring always the best long-term option for cloud migration?
No. Refactoring delivers the most long-term agility, but it is only worth it for applications where agility directly supports business outcomes. For stable internal tools or systems with little active development, the cost of refactoring will never be recovered. I’ve seen teams refactor applications that should have been retired, spending six months modernizing something nobody used. Reserve refactoring for customer-facing or revenue-critical systems where you need independent scaling and faster release cycles.
What skills does our team need before we attempt replatforming or refactoring?
For replatforming, your team should be comfortable with VPC networking, IAM, managed service operations, and infrastructure as code with Terraform or CloudFormation. For refactoring, you also need CI/CD, container or serverless experience, and observability with distributed tracing and centralized logging. If those skills are still developing, start with a rehost pilot to build operational confidence, then bring in a replatform as the second wave while the team trains on the new services.
How do retire and retain help reduce migration risk?
Both reduce scope, which is the most effective risk control. Every application you retire is one you do not need to migrate, test, or operate in the cloud, which saves time and budget. Every application you formally retain with a revisit date prevents a rushed, poorly fitting migration that would create performance or compliance issues. Together, they keep the migration focused on workloads where the cloud actually adds value, rather than moving everything indiscriminately.