Compute Engine is Google Cloud's Infrastructure-as-a-Service (IaaS) product. It lets you create and manage virtual machines (called instances) running on Google's global infrastructure. If you need full control over the OS, software stack, and configuration, Compute Engine is your starting point.
Machine Types
Machine types define the vCPU count, memory, and performance profile of a VM. GCP organises them into machine families:
| Family | Series | Best For |
|---|---|---|
| General Purpose | N4, N2, N2D, E2, T2D | Web servers, dev environments, databases |
| Compute Optimized | C3, C2, C2D | High-performance computing, gaming, science |
| Memory Optimized | M3, M2, M1 | Large in-memory databases (SAP HANA) |
| Accelerator Optimized | A3, A2, G2 | GPU workloads, ML training |
| Storage Optimized | Z3 | High IOPS, low-latency local storage |
You can also create custom machine types — specifying any combination of vCPUs and memory — so you only pay for what you actually need.
Disk Options
Every Compute Engine instance needs a boot disk. Additional persistent disks can be attached:
| Disk Type | Performance | Use Case |
|---|---|---|
| Balanced Persistent Disk (pd-balanced) | Good | Most workloads — good price/performance balance |
| SSD Persistent Disk (pd-ssd) | High IOPS | Databases, latency-sensitive apps |
| Standard Persistent Disk (pd-standard) | Low | Sequential access, backups, cold data |
| Extreme Persistent Disk (pd-extreme) | Very High IOPS | Highest-performance DB workloads |
| Local SSD | Fastest (ephemeral) | Temp data, scratch space — data lost on stop |
Preemptible and Spot VMs
GCP offers two cost-saving VM options for fault-tolerant workloads:
- Preemptible VMs: Up to 80% cheaper than regular VMs. GCP can terminate them with a 30-second warning. Maximum lifespan: 24 hours. Good for batch jobs, data processing.
- Spot VMs: The successor to Preemptible VMs. No 24-hour limit; otherwise same preemption model. Up to 91% cheaper.
Instance Templates and Managed Instance Groups
For scalable, resilient architectures:
- Instance Template: A reusable configuration (machine type, disk, network, startup script) for creating identical VMs.
- Managed Instance Group (MIG): A group of VMs created from a template. Supports autoscaling, autohealing (replacing failed instances), and rolling updates. Essential for production workloads.
Billing and Discounts
- Per-second billing (after a 1-minute minimum) — granular cost control.
- Sustained Use Discounts (SUD): Automatic discounts of up to 30% for VMs that run for more than 25% of a month.
- Committed Use Discounts (CUD): Up to 57% discount for 1-year or 3-year commitments.