GCP for DevOps — Compute
Chapter 3 — Compute
Google Compute Engine (GCE) provides virtual machines running on Google’s infrastructure. For DevOps engineers, Compute Engine is where you run build agents, bastion hosts, custom workloads, and managed instance groups for auto-scaling applications.
What You Will Learn
- Creating and managing Compute Engine instances
- Machine types, images, and boot disks
- Firewall rules for network access control
- Startup scripts for automated provisioning
- Managed Instance Groups (MIGs) for auto-scaling
Chapter Contents
| # | Topic | Description |
|---|---|---|
| 1 | Compute Engine Basics | Creating and managing VMs |
| 2 | Machine Types & Images | Choosing the right VM configuration |
| 3 | Firewall Rules | Controlling network traffic |
| 4 | Startup Scripts | Automated VM provisioning |
| 5 | Managed Instance Groups | Auto-scaling and self-healing |
| 6 | Practice Exercises | Hands-on labs |
Compute Engine Architecture
┌─────────────────────────────────────────────────────────┐
│ GCP Project │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ VPC Network │ │
│ │ │ │
│ │ ┌──────────────────┐ ┌──────────────────┐ │ │
│ │ │ us-central1-a │ │ us-east1-b │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌──────────────┐ │ │ ┌──────────────┐ │ │ │
│ │ │ │ VM Instance │ │ │ │ MIG (3 VMs) │ │ │ │
│ │ │ │ (bastion) │ │ │ │ (web-app) │ │ │ │
│ │ │ └──────────────┘ │ │ └──────────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌──────────────┐ │ │ ┌──────────────┐ │ │ │
│ │ │ │ VM Instance │ │ │ │ Persistent │ │ │ │
│ │ │ │ (build-agent)│ │ │ │ Disk (SSD) │ │ │ │
│ │ │ └──────────────┘ │ │ └──────────────┘ │ │ │
│ │ └──────────────────┘ └──────────────────┘ │ │
│ └─────────────────────────────────────────────────┘ │
│ │
│ Firewall Rules ─── Startup Scripts ─── Service Accts │
└─────────────────────────────────────────────────────────┘
Key Concepts
| Concept | Description |
|---|---|
| Instance | A virtual machine running on GCE |
| Machine type | CPU + memory configuration (e.g., e2-medium) |
| Image | OS template for the boot disk |
| Boot disk | The primary disk attached to a VM |
| Persistent Disk | Network-attached block storage |
| Instance template | Reusable VM configuration for MIGs |
| MIG | Managed Instance Group — auto-scaling, self-healing |
| Preemptible / Spot VM | Short-lived discounted VMs (up to 91% off) |
Start with → Compute Engine Basics