How would you migrate an application from on-premises servers to the cloud?
IntermediateScenarioReal-world scenarios
Answer
In one line: Assess the application and its dependencies, choose a migration strategy (rehost, replatform or refactor), build the cloud foundation with Infrastructure as Code, migrate data carefully, test thoroughly, cut over with a rollback plan, and then optimise.
Step 1 — Assess
- Inventory the app: servers, OS, runtime, databases, storage, integrations, network and firewall rules, batch jobs, licences, compliance requirements.
- Map dependencies (what talks to what).
- Note current performance, availability needs (RTO/RPO) and peak load.
Step 2 — Choose a strategy (the "7 Rs")
- Rehost (lift and shift) — move VMs as they are. Fastest, least benefit.
- Replatform — small changes, for example move the database to managed RDS, or containerise the app.
- Refactor/re-architect — redesign for cloud-native (microservices, serverless). Most benefit, most effort.
- Repurchase — switch to SaaS.
- Retire / Retain / Relocate — drop it, keep it on-prem for now, or move it to a cloud-hosted version of the same platform.
Step 3 — Build the landing zone
- Accounts/subscriptions, VPC networking, VPN/Direct Connect to on-prem, IAM, logging, security guardrails — all in Terraform.
Step 4 — Prepare the application
- Containerise if replatforming; create CI/CD pipelines; externalise configuration and secrets; set up monitoring.
Step 5 — Migrate data
- Pick a method by size and downtime tolerance: backup/restore, database replication (AWS DMS, native replication), or bulk transfer for files.
- Keep data in sync until cutover; validate row counts and checksums.
Step 6 — Test
- Functional, performance and failover tests in the cloud environment; security review.
Step 7 — Cut over
- Plan the window; lower DNS TTLs beforehand; freeze writes or do a final sync; switch traffic; watch dashboards closely.
- Keep the old environment ready for rollback for a while.
Step 8 — Optimise
- Right-size, autoscaling, reserved capacity, managed services, decommission old servers.
Tip for interviews: mention migrating in waves (start with a low-risk app), the 7 Rs, and having a tested rollback plan for cutover.
More on Real-world scenarios
The website is slow. How do you troubleshoot it?IntermediateA deployment to production just failed halfway. What do you do?IntermediateDevelopers complain that the CI pipeline takes 40 minutes. How would you speed it up?IntermediateSomeone accidentally committed an AWS access key to a public GitHub repository. What do you do?IntermediateYour production disk is 95% full and the alert just fired. What do you do?IntermediateHow would you set up CI/CD for a brand-new microservice from scratch?Intermediate