Associate Cloud Engineer ยท Compute Engine: choosing, launching and scaling
Spot VMs, custom machine types and discounts
Spot VM behavior (preemption, no max runtime, 30-second notice), when it fits, custom machine types and extended memory, and sustained-use or committed-use pricing at the level needed to choose.
Key points
- Spot VMs: heavily discounted, but Compute Engine can reclaim them at any time.
- Preempted Spot VM: stopped by default; no maximum runtime unless you set one.
- For fault-tolerant, checkpointed work.
- Custom machine types: pick the exact vCPU and memory count.
- Sustained-use discounts: automatic on some machine series.
- Committed-use discounts: 1 or 3 year commitment for steady load.
Source: https://docs.cloud.google.com/compute/docs/instances/spot
Practice questions
By default, what happens to a Spot VM when Compute Engine preempts it?
- It is stopped
- It is deleted
- It is live-migrated to another host
- It restarts on its own in another zone
Show answer
Answer: A. It is stopped
The default termination action is STOP, so the VM moves to a terminated state and can be started again. It is not live-migrated or restarted by itself, and it is deleted only if you set DELETE.
Which workloads are a good fit for Spot VMs?
- Batch analytics that checkpoints its progress
- Stateless workers in a pool where other workers keep running
- The only primary database, with no replica
- A licence server that must always be reachable
- A single VM serving a customer-facing checkout
Show answer
Answer: A. Batch analytics that checkpoints its progress, B. Stateless workers in a pool where other workers keep running
Checkpointed batch work and stateless workers with spare capacity elsewhere tolerate loss of a VM. A lone primary database and an always-on licence server cannot.
True or false: a Spot VM is always stopped after 24 hours.
Show answer
Answer: False
False. Spot VMs have no maximum runtime unless you configure one. The 24-hour limit belonged to the older preemptible VMs.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
