Cloud providers have spare capacity that changes minute by minute, and they sell it at a deep discount on one condition: they can take it back. AWS calls this Spot Instances, Google Cloud has Spot VMs (and the older preemptible VMs), and Azure has Spot Virtual Machines. The discount can be large compared with on-demand prices, but the server can be reclaimed with little warning.
How much warning you get
- AWS Spot: a two-minute interruption notice, available to the instance through its metadata and as an event.
- Google Cloud Spot and preemptible VMs: about 30 seconds' notice before the machine is stopped.
- Azure Spot VMs: a short notice through scheduled events, typically around 30 seconds.
That is enough time to save a checkpoint or finish writing a file. It is not enough to drain a busy checkout gracefully.
Jobs that suit interruptible capacity
| Job | Suitable? | Why |
|---|---|---|
| Nightly report generation | Yes | Can restart; nobody waits on it live. |
| Image resizing for a product catalogue | Yes | Work splits into small, repeatable pieces. |
| Build and test runners | Usually | A failed build can be rerun. |
| The storefront web server, alone | No | An interruption is an outage. |
| A single database | No | Data and availability risk. |
Making a job interruption-tolerant
- Break the work into small units recorded in a queue or a list, so a restart picks up where it stopped.
- Write results to durable storage as you go, not only at the end.
- Listen for the notice and use it to save state.
- Allow several instance types and zones; flexibility makes reclaimed capacity less likely to stop the whole job.
- Have an on-demand fallback for deadlines that matter.
A hypothetical mix
Shop M runs its storefront on two on-demand servers, perhaps covered by a commitment for the steady baseline, and runs its weekly catalogue image job on spot capacity. If the job is interrupted, it resumes from the last finished batch. The storefront never depends on spot, so the worst case is a report that arrives an hour late. That split, steady load committed, peaks on demand and restartable work on spot, is a sensible default for small teams.
A caution: discounts on spot capacity vary with demand, by region and by instance type, so the saving is never guaranteed. Check recent price history in the provider's console before planning around it. More in the article list and the topics page.
Estimating the saving honestly
When you compare spot capacity with on-demand, include the cost of interruptions. A job that is reclaimed halfway through and restarted has used extra hours, and a pipeline that needs more engineering to tolerate interruptions has a time cost too. For a small catalogue job that runs once a week, the engineering is modest and the saving repeats. For a one-off task, plain on-demand capacity is often the simpler choice. Write both options down with your own numbers before deciding; the cost estimator can show the on-demand side of that comparison.