Overview and What You Will Learn
In this lab, you will deploy the same simple containerized application three different ways - on Compute Engine, then on Cloud Run - directly experiencing the operational overhead difference between full VM management and a fully managed serverless container platform.
Why This Matters in Production
A team building a simple internal reporting tool deploys it on a full Compute Engine VM they now have to patch, monitor, and manage forever, when Cloud Run would have handled the exact same workload with zero server management and automatic scale-to-zero when nobody's using it. The compute decision is the single most heavily weighted judgment call on the Associate Cloud Engineer exam, and the first real architecture decision most GCP newcomers face.
Core Principles
Each compute option trades control for operational simplicity, and the right choice depends entirely on what the workload actually needs.
+------------------------------------------+| Compute Engine || Full VMs, full OS control || You patch, monitor, and secure the OS |+------------------------------------------+| Google Kubernetes Engine (GKE) || Managed Kubernetes for many coordinated || containerized services |+------------------------------------------+| Cloud Run || Fully managed, serverless containers || Scales to zero, pay only when invoked |+------------------------------------------+| Cloud Functions || Event-driven, single-purpose functions || Shortest-lived, most granular compute unit |+------------------------------------------+Detailed Step-by-Step Practical Lab
- Create a project and enable the necessary APIs:
gcloud projects create gcp-compute-decision-2026 --name="Compute Decision Lab"gcloud config set project gcp-compute-decision-2026gcloud services enable compute.googleapis.com run.googleapis.com- Deploy a simple app on Compute Engine, taking on full responsibility for the OS:
gcloud compute instances create vm-reporting-tool \ --zone=asia-south1-a \ --machine-type=e2-small \ --image-family=debian-12 \ --image-project=debian-cloud # a process manager, and patch the OS yourself - an ongoing responsibility- Deploy the same conceptual app on Cloud Run instead, with zero OS management required:
gcloud run deploy reporting-tool \ --image=asia-south1-docker.pkg.dev/gcp-compute-decision-2026/app-images/reporting-tool:v1 \ --region=asia-south1 \ --platform=managed \ --allow-unauthenticated- Compare what each option required - the VM path needed ongoing OS management, while the Cloud Run path had Google handle it entirely:
# Confirm the Cloud Run service is running with no manual OS setupgcloud run services describe reporting-tool \ --region=asia-south1 \ --format="value(status.conditions[0].status)"Consider when the picture changes: if this reporting tool needed to become five interdependent containerized services - a web frontend, an API, a background worker, a cache, and a queue processor - all needing coordinated scaling and service discovery, that complexity is what justifies moving to GKE instead of either Compute Engine or Cloud Run alone.
Clean up:
gcloud compute instances delete vm-reporting-tool --zone=asia-south1-a --quietgcloud run services delete reporting-tool --region=asia-south1 --quietgcloud projects delete gcp-compute-decision-2026 --quietProduction Best Practices & Common Pitfalls
Common MistakeReaching for GKE by default because it feels like the more "serious" or scalable choice, then discovering the team is now managing cluster upgrades, node pool sizing, and Kubernetes networking complexity for a workload that was really just one simple containerized service Cloud Run would have handled with far less ongoing effort.
TipStart with Cloud Run for any standard stateless containerized web service unless a specific, concrete reason requires Compute Engine's full OS control or GKE's multi-service orchestration. Cloud Run's scale-to-zero and zero-OS-maintenance overhead outweigh the flexibility of a raw VM for the large majority of web workloads.
- Compute Engine is the right choice for a genuine, specific need - legacy software requiring a particular OS configuration, custom kernel modules, or workloads needing hardware-level access GKE and Cloud Run don't expose.
- Cloud Functions fits an even narrower niche than Cloud Run - a single-purpose, event-triggered piece of logic (like "resize this image when it's uploaded") rather than a full application with multiple routes and business logic, which Cloud Run handles more naturally.
Quick Reference & Troubleshooting Commands
| Command | Description |
|---|---|
gcloud compute instances create |
Create a full-control Compute Engine VM |
gcloud run deploy |
Deploy a containerized service to Cloud Run |
gcloud container clusters create-auto |
Create a GKE Autopilot cluster |
gcloud functions deploy |
Deploy a single event-driven Cloud Function |