Spot and preemptible instances: how to use cheap interruptible servers safely
Cloud providers sell their spare capacity at a steep discount under names like spot, preemptible or low-priority VMs. The deal: the provider can take the machine back with short notice.
How it works
- You get the same hardware as regular instances, often for a fraction of the on-demand price.
- When the provider needs capacity, your instance gets an interruption notice (usually a short window, from seconds to a couple of minutes depending on provider) and is stopped or terminated.
- Prices and availability vary by instance type, region and zone.
Good fits
- Batch processing and data pipelines
- CI build runners
- Rendering, simulations, model training with checkpoints
- Stateless web workers behind a load balancer, mixed with regular instances
Poor fits
- Single-instance databases
- Anything holding state you can't afford to lose
- Long jobs that can't resume from a checkpoint
Making it reliable
- Diversify: allow several instance types and zones so one shortage doesn't take everything.
- Checkpoint: save progress regularly so restarts lose little work.
- Handle the notice: drain connections and finish or hand off work when interruption is signaled.
- Keep a baseline of on-demand capacity for critical services.
Are you running anything on spot capacity? What workload surprised you by working well, or badly?
Comments · 3
So if a job can be restarted, spot is a good fit? What about a web server people are using right now?
Mixed fleets are the sweet spot: a base of regular instances for reliability and spot for the burst capacity. The savings show up straight in unit costs.
Savings can reach 60 to 90 percent depending on provider and region, but it fluctuates. Budget for the average, not the best case.