Compute
Compute Engine
Virtual machines running in Google's data centers
AWS equivalent
EC2
AWS → GCP: Key Differences
- ▸
Machine types use a different naming convention: e2 (cost-optimized), n2 (balanced), c2 (compute), m1 (memory). No 'instance families' like t3/m5.
- ▸
Preemptible VMs ≈ Spot Instances — up to 80% cheaper, can be terminated with 30s notice. Spot VMs are newer with similar but slightly different behavior.
- ▸
Sustained use discounts apply AUTOMATICALLY after running 25%+ of a month — no reserved instance purchase needed.
- ▸
Live migration: GCP migrates your VM to another host during maintenance without rebooting. AWS reboots.
- ▸
Custom machine types: create exactly the vCPU/RAM combination you need instead of picking from fixed sizes.
Key Concepts to Know
- 1
Managed Instance Groups (MIGs) = Auto Scaling Groups in AWS. Can be regional (multi-zone) or zonal.
- 2
Startup scripts = EC2 user data. Can be stored in GCS and referenced at launch.
- 3
Persistent disks (pd-standard, pd-balanced, pd-ssd) ≈ EBS. Local SSDs are ephemeral but extremely fast.
- 4
Sole-tenant nodes: run VMs on dedicated physical hardware — for compliance or licensing reasons.
- 5
OS images: public (Debian, Ubuntu, CentOS, Windows) or custom. Can be shared across projects.
DCE Interview Tips
- ★
Know when to recommend Compute Engine vs Cloud Run vs GKE — use Compute Engine for workloads needing full OS control, legacy apps, or specific software that can't be containerized.
- ★
Understand MIG autoscaling policies: CPU utilization, HTTP load balancing, custom metrics.
- ★
Be able to explain cost optimization: preemptible VMs for batch, committed use discounts for stable workloads, rightsize recommendations.
Common Gotchas
- !
GCP charges per-second (after 1 min minimum) vs AWS per-hour historically — better for short-running workloads.
- !
External IPs cost money even when not in use if reserved. Release them when not needed.
- !
Default service account has broad Editor role — always create dedicated service accounts with least privilege.