This chapter covers the three primary application modernisation strategies on Google Cloud: rehost, refactor, and rebuild. Understanding these approaches is critical for the GCDL exam, as questions on migration strategies appear in roughly 10-15% of the total exam, primarily in Domain 4 (Apps) under Objective 4.1. You will learn the definitions, use cases, trade-offs, and how Google Cloud services support each strategy. The exam tests your ability to recommend the appropriate strategy based on business requirements, technical constraints, and cost considerations.
Jump to a section
Imagine you run a restaurant with a kitchen that works but is outdated. You have three options. Option 1: Rehost — you pack all your equipment, utensils, and recipes exactly as they are, and move the entire kitchen to a new building. The new building has better infrastructure (power, water, gas), but your old stove and fridge still run the same way. You gain better facilities but no operational improvements. Option 2: Refactor (Replatform) — you move to a new building but also upgrade some appliances. You replace your old gas stove with an induction cooktop, and your fridge with a smart model. Your recipes remain mostly the same, but you adjust cooking times and temperatures to suit the new equipment. You gain efficiency without rewriting the menu. Option 3: Rebuild (Rearchitect) — you tear down the old kitchen and design a completely new one. You replace the stove with a wok station, add a sushi bar, and install robotic arms for prep. You rewrite all recipes and train staff on new workflows. This gives maximum efficiency and new capabilities but requires the most time and cost. In cloud migration, rehost (lift-and-shift) moves workloads with minimal changes, refactor (replatform) optimizes for cloud services like managed databases, and rebuild (rearchitect) redesigns applications using microservices and serverless. Each approach balances speed, cost, and long-term benefits.
What Are Application Modernisation Strategies?
Application modernisation refers to the process of adapting existing applications for cloud deployment to leverage cloud benefits like scalability, reliability, and cost efficiency. Google Cloud categorises modernisation into three main approaches: rehost, refactor, and rebuild. These are part of the "6 Rs" of migration (Rehost, Replatform, Refactor, Rearchitect, Retire, Retain), but the GCDL exam focuses on the three active transformation strategies. The choice depends on factors like time-to-market, cost, desired cloud benefits, and organisational readiness.
Rehost (Lift-and-Shift)
Rehost involves moving an application from on-premises or another cloud to Google Cloud with minimal changes. The application runs on Compute Engine virtual machines (VMs) or on-premises-equivalent infrastructure. No code changes are made; the application is packaged and migrated as-is. This is the fastest migration path and requires the least effort. It is suitable for:
Legacy applications that cannot be easily modified.
Organizations that need immediate cloud benefits like data center exit.
Workloads that are not yet ready for deeper modernisation.
How it works internally: - The source VM or physical server is imaged using tools like Migrate for Compute Engine (formerly Velostrata) or third-party tools. - The image is transferred to Google Cloud and used to create a Compute Engine instance with equivalent resources (vCPU, memory, disk). - Networking is configured to match on-premises settings (IP addresses, firewall rules, DNS). - The application is tested for functionality; performance tuning may involve adjusting machine types or adding load balancers. - Once validated, traffic is cut over to the cloud instance.
Key components and defaults: - Compute Engine machine types: n1-standard-4 (4 vCPU, 15 GB RAM) is a common starting point. - Persistent disk sizes: defaults to 10 GB for boot disk, but can be resized. - Networking: VPC networks with subnets, firewall rules, and Cloud NAT for outbound internet. - Migrate for Compute Engine supports both agent-based and agentless migration. - Cutover time: typically hours to days depending on data volume.
Verification commands:
# List migrated instances
gcloud compute instances list
# Check instance details
gcloud compute instances describe [INSTANCE_NAME]
# Verify disk size
gcloud compute disks listInteraction with related technologies: - Cloud Load Balancing can be added to distribute traffic. - Cloud CDN can accelerate content delivery. - Cloud Monitoring and Logging provide observability. - Google Cloud's sole-tenant nodes can be used for licensing compliance.
Refactor (Replatform)
Refactor involves making moderate changes to an application to take advantage of cloud-managed services without altering the core architecture. Common changes include moving from a self-managed database to a managed service like Cloud SQL or Cloud Spanner, or using Cloud Storage instead of local file systems. Code changes are limited to configuration and driver updates. This approach offers better scalability, reduced operational overhead, and cost savings through managed services.
How it works internally: - Identify components that can be replaced by managed services (e.g., database, message queue, caching). - Modify application configuration to point to the new service endpoints. - Update libraries or drivers if needed (e.g., JDBC driver for Cloud SQL). - Migrate data to the managed service using tools like Database Migration Service or storage transfer. - Test functionality; performance may improve due to managed service optimisations.
Key components and defaults: - Cloud SQL: supports MySQL, PostgreSQL, SQL Server; default tier db-n1-standard-2 (2 vCPU, 7.5 GB RAM). - Cloud Spanner: global, strongly consistent; node count minimum 1. - Cloud Memorystore for Redis: default tier basic, capacity 1 GB. - Cloud Pub/Sub: default topic retention 7 days. - Database Migration Service: supports homogeneous migrations (e.g., MySQL to Cloud SQL MySQL).
Verification commands:
# Check Cloud SQL instances
gcloud sql instances list
# Connect to Cloud SQL via proxy
gcloud sql connect [INSTANCE] --user=root
# Verify Cloud Storage bucket
gsutil ls gs://[BUCKET_NAME]Interaction with related technologies: - Cloud SQL can be configured with read replicas for scaling. - Cloud Spanner integrates with App Engine and Compute Engine. - Cloud Memorystore can be used as a session store for web applications. - VPC peering is required for private access to managed services.
Rebuild (Rearchitect)
Rebuild involves redesigning the application architecture to fully leverage cloud-native features like microservices, serverless, containers, and managed services. This often requires rewriting significant portions of code. The result is a highly scalable, resilient, and cost-efficient application. Use cases include:
Applications that need to scale massively (e.g., global user base).
Monolithic applications that are difficult to maintain or scale.
Greenfield projects or complete rewrites.
How it works internally: - Decompose the monolithic application into smaller, independent services (microservices). - Each service is developed, deployed, and scaled independently. - Services communicate via APIs (REST, gRPC) or message queues (Cloud Pub/Sub). - Use containers (Google Kubernetes Engine) or serverless (Cloud Run, Cloud Functions) for deployment. - Data is often moved to managed databases or object storage per service. - Implement CI/CD pipelines using Cloud Build and Cloud Deploy.
Key components and defaults: - Google Kubernetes Engine (GKE): default cluster version latest stable, node pool with e2-medium machines. - Cloud Run: default max instances 100, container concurrency 80. - Cloud Functions: default timeout 60 seconds, memory 256 MB. - Cloud Endpoints for API management. - Cloud Build: default machine type e2-medium, 10-minute timeout.
Verification commands:
# Deploy to Cloud Run
gcloud run deploy [SERVICE] --image gcr.io/[PROJECT]/[IMAGE] --platform managed
# List GKE clusters
gcloud container clusters list
# Invoke Cloud Function
gcloud functions call [FUNCTION_NAME] --data '{"message":"Hello"}'Interaction with related technologies: - Cloud Load Balancing for ingress traffic to microservices. - Cloud Service Mesh (Anthos) for observability and security. - Cloud CDN for static assets. - Cloud Tasks for asynchronous processing. - Secret Manager for configuration secrets.
Comparison Table
| Aspect | Rehost | Refactor | Rebuild | |--------|--------|----------|---------| | Effort | Low | Medium | High | | Time to cloud | Days to weeks | Weeks to months | Months to years | | Code changes | None | Minimal | Significant | | Cloud benefits | Basic (infrastructure) | Moderate (managed services) | Full (scalability, resilience) | | Cost savings | Low (mainly data center exit) | Medium (eliminate self-management) | High (pay-per-use, auto-scaling) | | Risk | Low | Medium | High | | Best for | Legacy apps, quick wins | DB upgrades, middleware | New development, major upgrades |
Exam-Important Details
Rehost is also called "lift-and-shift".
Refactor is often called "replatform" — note that the GCDL exam uses "refactor" and "replatform" interchangeably.
Rebuild is also called "rearchitect".
The exam may present scenarios with specific business drivers: if the goal is "fastest time to cloud" → rehost; if "reduce operational overhead" → refactor; if "maximize scalability and agility" → rebuild.
Google Cloud's Migration Services include Migrate for Compute Engine (rehost), Database Migration Service (refactor), and GKE/Cloud Run (rebuild).
Trap: Candidates often choose rehost when the scenario mentions "cost savings" — but rehost alone may not reduce costs significantly; refactor or rebuild often yield greater savings.
Advanced Considerations
Hybrid approaches: A common pattern is to rehost first, then refactor or rebuild later (strangler fig pattern).
Google Cloud's App Modernisation Program offers tools like Cloud Advisory for recommendations.
Anthos can help refactor on-premises applications without full migration.
For rebuild, consider using Cloud Code for IDE integration and Skaffold for continuous development.
Conclusion
Choosing the right modernisation strategy is a key decision in cloud adoption. The GCDL exam expects you to match business requirements to the appropriate approach. Remember: rehost for speed, refactor for balance, rebuild for transformation. Use Google Cloud's managed services to maximise benefits at each level.
Assess Application and Define Goals
Begin by inventorying all applications, dependencies, and technical debt. Identify business drivers: time-to-cloud, cost reduction, scalability, or innovation. For the exam, if the goal is 'fastest migration' → rehost; if 'reduce management overhead' → refactor; if 'full cloud-native benefits' → rebuild. Document compliance and licensing constraints.
Select Migration Strategy
Based on assessment, choose rehost, refactor, or rebuild. For rehost, use Migrate for Compute Engine to create VM images. For refactor, identify which managed services replace current components (e.g., Cloud SQL for self-managed MySQL). For rebuild, design microservices architecture and choose container/serverless platform.
Migrate or Transform Workload
Execute the migration: rehost involves copying VM disks and configuring networking; refactor involves data migration and updating connection strings; rebuild involves rewriting code and deploying to GKE or Cloud Run. Use tools like Database Migration Service for refactor, and Cloud Build for rebuild CI/CD.
Validate and Optimize
Test application functionality and performance. For rehost, adjust machine types or add load balancers. For refactor, monitor managed service metrics (e.g., Cloud SQL CPU utilization). For rebuild, set up autoscaling, monitoring, and logging. Use Cloud Monitoring dashboards and error reporting.
Cut Over and Decommission Legacy
Redirect traffic to new cloud environment using DNS changes or load balancer updates. For rehost, update internal DNS records. For refactor and rebuild, use gradual traffic shifting (e.g., canary deployments). Once stable, decommission on-premises resources. Document the new architecture.
Enterprise Scenario 1: Data Center Exit for a Retail Company A large retailer needs to close its data center within six months due to lease expiry. They have hundreds of legacy Windows-based applications that are critical but poorly documented. The IT team chooses rehost using Migrate for Compute Engine. They create VM images of each server, transfer them to Google Cloud, and configure equivalent networking. The migration takes 3 months, with cutover occurring over a weekend. Post-migration, they add Cloud Load Balancing and Cloud Monitoring. The main challenge is licensing: some Microsoft SQL Server licenses require dedicated hosts (sole-tenant nodes). Performance is similar to on-premises, but they gain data center exit. Cost savings are minimal initially but they plan to refactor later.
Enterprise Scenario 2: Modernizing a Monolithic CRM A mid-size software company runs a monolithic CRM application on-premises using a self-managed PostgreSQL database. The application is struggling with scaling during peak hours. They choose refactor: move the database to Cloud SQL for PostgreSQL with read replicas, and migrate the application to Compute Engine with autoscaling managed instance groups. Code changes are limited to updating the database connection string and using Cloud SQL Auth proxy. The migration takes 2 months. Cloud SQL handles failover automatically, reducing downtime. They see 30% cost reduction by eliminating DBA overhead and using committed use discounts.
Enterprise Scenario 3: Building a Global E-Commerce Platform A startup wants to launch a globally scalable e-commerce platform. Their existing prototype is a monolithic Node.js app with MongoDB. They choose rebuild: decompose into microservices (user service, product service, order service) using Node.js and deploy on Cloud Run. Data is moved to Firestore and Cloud SQL. They use Cloud Pub/Sub for async communication and Cloud CDN for static assets. The rebuild takes 6 months. The new platform autoscales from zero to thousands of requests per second. Cost is pay-per-use, and they avoid idle capacity. The main challenge is managing distributed transactions and eventual consistency. They use Cloud Tasks for order processing and Cloud Spanner for inventory to ensure strong consistency.
What Goes Wrong When Misconfigured - Rehost: forgetting to update firewall rules leads to connectivity issues. Not resizing disks causes storage bottlenecks. - Refactor: using wrong Cloud SQL tier causes performance degradation or high costs. Not enabling private IP exposes database to internet. - Rebuild: over-engineering microservices leads to complexity. Not setting proper IAM roles causes permission errors. Missing circuit breakers causes cascading failures.
What the GCDL Exam Tests
Objective 4.1: "Identify the appropriate application modernisation strategy (rehost, refactor, rebuild) based on business requirements." The exam presents scenario-based questions where you must match the strategy to the driver. Key indicators: - "Fastest migration" or "minimal changes" → rehost - "Reduce operational overhead" or "use managed databases" → refactor - "Scalability", "agility", "cloud-native" → rebuild
Common Wrong Answers and Why
Choosing rebuild when the goal is quick migration. Candidates see "modernisation" and assume rebuild, but rehost is faster. The exam explicitly tests time vs. effort trade-offs.
Selecting refactor when the application is legacy and cannot be changed. Refactor requires some code changes; if the scenario says "no code changes allowed", rehost is the only option.
Picking rehost when the goal is cost savings. Rehost usually doesn't reduce costs significantly; refactor or rebuild provide better savings through managed services and autoscaling.
Assuming rebuild always requires containers. Rebuild can use serverless (Cloud Functions, Cloud Run) as well. The exam may test that rebuild includes both containers and serverless.
Specific Numbers and Terms
Migrate for Compute Engine is the primary rehost tool.
Database Migration Service is for refactor (homogeneous migrations).
GKE and Cloud Run are for rebuild.
The "6 Rs" include Rehost, Replatform, Refactor, Rearchitect, Retire, Retain. The exam focuses on the three active ones.
Refactor is synonymous with "replatform" on the exam.
Rebuild is synonymous with "rearchitect".
Edge Cases and Exceptions
Hybrid approach: The exam may describe a scenario where an organization rehosts first and then refactors later. This is a valid strategy, and the question might ask for the initial approach (rehost).
Retire/Retain: If an application is obsolete, the best strategy is to retire it. If it cannot be moved (e.g., due to compliance), retain it. These are not modernisation strategies but are part of the 6 Rs.
Licensing: Some software licenses require dedicated infrastructure. Rehost on sole-tenant nodes addresses this. The exam may test this constraint.
How to Eliminate Wrong Answers
Identify the primary business driver: time, cost, scalability, or operational overhead.
Match the driver to the strategy: time → rehost; overhead → refactor; scalability → rebuild.
Look for keywords: "lift-and-shift" = rehost; "managed services" = refactor; "microservices" or "serverless" = rebuild.
If the scenario says "no code changes", eliminate refactor and rebuild.
If the scenario says "maximize scalability", eliminate rehost (though you can add autoscaling to rehosted VMs, rebuild is better).
Rehost (lift-and-shift) moves applications with no code changes; fastest but least cloud benefits.
Refactor (replatform) uses managed services like Cloud SQL with minimal code changes.
Rebuild (rearchitect) redesigns applications using microservices and serverless for maximum cloud benefits.
The GCDL exam tests matching strategy to business driver: time → rehost, overhead → refactor, scalability → rebuild.
Migrate for Compute Engine is the primary tool for rehost; Database Migration Service for refactor; GKE/Cloud Run for rebuild.
Refactor and replatform are synonymous; rebuild and rearchitect are synonymous on the exam.
A hybrid approach (rehost then refactor) is valid and common.
These come up on the exam all the time. Here's how to tell them apart.
Rehost (Lift-and-Shift)
No code changes required.
Fastest migration (days to weeks).
Uses Compute Engine VMs.
Minimal cloud benefits; basic IaaS.
Low risk of application breakage.
Refactor (Replatform)
Minimal code changes (config/drivers).
Moderate migration time (weeks to months).
Uses managed services like Cloud SQL.
Moderate cloud benefits; reduced ops overhead.
Medium risk; requires testing of new services.
Refactor (Replatform)
Core architecture unchanged.
Code changes limited to configuration.
Data migration via Database Migration Service.
Cost savings from eliminating self-management.
Suitable for existing applications with minor updates.
Rebuild (Rearchitect)
Architecture redesigned (microservices).
Significant code rewrite required.
Uses GKE, Cloud Run, or Cloud Functions.
Full cloud benefits: auto-scaling, resilience, pay-per-use.
Best for new development or major overhauls.
Mistake
Rehosting always reduces costs immediately.
Correct
Rehosting typically does not reduce costs significantly; it may even increase costs due to cloud egress and licensing. Cost savings come from rightsizing, committed use discounts, and eventual refactoring. The primary benefit of rehost is speed of migration.
Mistake
Refactoring requires rewriting the entire application.
Correct
Refactoring involves minimal code changes, mostly configuration and driver updates. The core application logic remains unchanged. For example, switching from self-managed MySQL to Cloud SQL only requires updating the JDBC connection string and using Cloud SQL Auth proxy.
Mistake
Rebuilding always means using containers on GKE.
Correct
Rebuilding can use serverless options like Cloud Run or Cloud Functions, not just containers. The key is a cloud-native architecture (microservices, managed services, auto-scaling). Containers are one option, but serverless is also valid.
Mistake
Rehost is the best strategy for all legacy applications.
Correct
Rehost is best when speed is critical and the application cannot be changed. However, if the goal is to reduce operational overhead or improve scalability, refactor or rebuild are better. Rehosted applications still require patching and management of VMs.
Mistake
You cannot mix strategies; you must choose one.
Correct
A common pattern is to rehost first for quick cloud adoption, then refactor or rebuild over time (strangler fig pattern). The exam may present scenarios where a phased approach is appropriate.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Rehost (lift-and-shift) moves applications to Compute Engine VMs with no code changes, using tools like Migrate for Compute Engine. Refactor (replatform) makes minimal changes to use managed services like Cloud SQL, reducing operational overhead. Rehost is faster but offers fewer cloud benefits; refactor is slower but provides better scalability and cost savings.
Choose rebuild when you need maximum scalability, agility, and cloud-native features like auto-scaling and microservices. Rebuild is appropriate for greenfield applications or when the existing architecture is monolithic and cannot scale. If the goal is to reduce operational overhead without major code changes, refactor is better.
Yes, you can rehost a database by migrating the database server as a VM using Migrate for Compute Engine. However, refactoring to a managed database service like Cloud SQL or Cloud Spanner is recommended for better availability, scalability, and reduced management overhead. The exam tests that refactoring databases is a common refactor scenario.
For rehost: Migrate for Compute Engine. For refactor: Database Migration Service (for databases), and Cloud Storage Transfer Service (for files). For rebuild: Google Kubernetes Engine (GKE), Cloud Run, Cloud Functions, and Cloud Build for CI/CD. The exam expects you to know these tools.
No. Rehosting can sometimes increase costs due to cloud egress, licensing, and lack of rightsizing. Refactoring or rebuilding often yield greater long-term savings through managed services and autoscaling. The exam may test that cost savings are not guaranteed with rehost.
The strangler fig pattern involves gradually replacing parts of a monolithic application with new microservices over time. It often starts with rehosting the monolith, then refactoring or rebuilding specific components. This allows incremental modernisation with reduced risk. The exam may reference this pattern in scenario questions.
Yes, Anthos allows you to refactor applications on-premises using containers and managed services, providing a consistent hybrid environment. This is a valid modernisation strategy that doesn't require full migration. The exam may test Anthos as a refactor tool for on-premises workloads.
You've just covered App Modernisation Approaches: Refactor, Rehost, Rebuild — now see how well it sticks with free GCDL practice questions. Full explanations included, no account needed.
Done with this chapter?