Spot Instances Explained: How Discounted Cloud Compute Really Works

Spot Instances Explained: How Discounted Cloud Compute Really Works

Spot instances explained in one sentence: they are spare cloud capacity sold at a large discount, on the condition that the provider can take the capacity back when it needs it. The discount is real and substantial, with AWS advertising savings of up to 90 percent against on-demand prices, and the catch is equally real: your machine can disappear with as little as two minutes of warning. The central question is whether that trade is worth it, and the answer is yes for workloads that can be interrupted and resumed, and no for anything that must keep running without a break.

A spot instance is the same hardware as an on-demand instance of the same type. Only the purchase terms differ. You pay less because you accept that the provider may reclaim the capacity, and you design your workload so that a reclaimed machine is an inconvenience rather than a disaster.

Key takeaways

  • Spot instances explained simply: spare capacity sold cheaply, reclaimable by the provider at short notice.
  • AWS advertises discounts of up to 90 percent against on-demand prices; Google Cloud advertises up to 91 percent for Spot VMs.
  • AWS gives a two-minute interruption notice, while Azure and Google Cloud give around 30 seconds.
  • Spot suits batch jobs, CI/CD, rendering, and stateless work, but not databases or single-instance services.
  • Checkpointing, diversification across instance types, and automation turn spot from a gamble into a reliable pattern.

What a spot instance actually is

Cloud providers build data centres with more capacity than their on-demand customers use at any given moment, because demand peaks and troughs through the day. Rather than leaving that spare capacity idle, they sell it at a discount. That is the whole idea behind spot capacity: unused machines, offered cheaply, with no guarantee they will keep running.

The discount exists because the provider keeps the right to reclaim the capacity. When on-demand demand rises, or when the provider needs the machines for its own purposes, spot instances are interrupted first. You are not buying a machine; you are renting spare capacity that someone else may need back.

All three major clouds sell spot capacity. AWS calls it EC2 Spot Instances, Google Cloud calls it Spot VMs, and Microsoft calls it Azure Spot Virtual Machines. The mechanics differ in detail, but the bargain is the same in each case. Best for: teams with flexible, interruptible workloads who want to cut compute spend without changing their architecture.

How spot pricing works

Spot pricing is set by the provider, not by an auction. AWS sets a Spot price for each instance type in each Availability Zone and adjusts it gradually, based on long-term trends in supply and demand. The price never exceeds the on-demand price for the same instance type, and your instance runs while capacity is available.

Google Cloud takes a simpler approach: Spot VM prices change at most once a day, and the discount is fixed for a given machine type rather than drifting with the market. Azure lets you set a maximum price you are willing to pay, and the VM is evicted if the current price rises above it. Setting the maximum price to minus one means the VM is never evicted for price reasons, and you never pay more than the standard rate.

The important point is that the discount varies by instance type, region, and time. Popular instance types in busy regions may offer only a small discount, while less popular types in quieter regions may be dramatically cheaper. Checking the current discount for your specific instance type matters more than any headline figure. Best for: workloads that can choose from several instance types and regions, since flexibility is what unlocks the largest discounts.

Spot against the other ways to buy compute

Purchase option Discount against on-demand Commitment Can it be interrupted?
On-demand None None No
Spot Large, varies by type and region None Yes, at short notice
Reserved Instances Moderate to large One or three years No
Savings Plans Moderate to large One or three years, spend commitment No
Dedicated Hosts None, usually more expensive On-demand or reserved No

The table shows the real trade. Spot is the only option that combines a large discount with no commitment, and it is also the only option that can be interrupted. Reserved Instances and Savings Plans buy their discount with a one- or three-year commitment, which suits steady workloads but wastes money if usage falls.

A sensible estate mixes all of them. Steady, always-on workloads belong on Reserved Instances or Savings Plans. Variable but important workloads belong on demand. Flexible, interruptible workloads belong on spot. Teams that put everything on one purchase option are either overpaying or taking risks they do not need to take. For a wider view of how these choices fit into a cost strategy, see our cloud cost optimisation guide. Best for: finance and engineering teams deciding how to split a workload across purchase options.

Rows of server racks in a data centre with blinking status lights
Spot capacity is the spare compute inside data centres like this one, sold at a discount because the provider can reclaim it when demand rises.

How interruption works on each cloud

AWS issues a Spot Instance interruption notice two minutes before it stops or terminates your instance, delivered through instance metadata and as an EventBridge event. AWS recommends checking for the notice every five seconds. If you choose hibernation as the interruption behaviour, you still receive the notice, but the hibernation process begins immediately, so there is no two-minute window.

When AWS interrupts an instance, it can stop it, hibernate it, or terminate it, depending on the behaviour you configured. The default is termination. Stopping preserves the instance for a later restart, while hibernation preserves the contents of memory on the root volume, so the instance can resume where it left off.

Azure gives a shorter warning. Spot VMs are evicted with up to 30 seconds of notice through Scheduled Events, and the eviction policy decides what happens next: Deallocate, the default, stops the VM but keeps its disks, while Delete removes the VM and its disks. Azure Spot VMs carry no service-level agreement and no high-availability guarantee.

Google Cloud Spot VMs also work on short notice. On preemption, Compute Engine sets a metadata signal and then sends a shutdown signal that starts a shutdown period of up to 30 seconds, during which a shutdown script can run. The older preemptible VMs were always stopped after 24 hours; Spot VMs have no maximum runtime unless you set one. Best for: engineers building interruption handling, who need to know exactly how much warning each cloud gives.

Which workloads fit spot, and which do not

Spot fits workloads that are stateless, checkpointed, or easy to restart. Batch processing, data transformation, rendering, video transcoding, CI/CD builds and tests, and large-scale analytics are the classic examples. A job that runs for an hour and can resume from a checkpoint loses minutes when an instance is reclaimed, not hours.

Spot also works well for stateless web workers behind a load balancer, where losing one machine out of many changes nothing for users. Kubernetes clusters often run a mix, with critical services on on-demand nodes and flexible workloads on spot node pools, so a reclaimed node simply reschedules its pods elsewhere.

Spot does not fit stateful work. A database that holds the only copy of your data, a single-instance service with no redundancy, or a long-running job with no checkpointing will suffer badly from an interruption. The rule is simple: if losing the machine means losing work or losing users, do not run it on spot alone. Best for: batch and stateless workloads, CI/CD pipelines, and any job that saves its progress regularly.

Designing for interruption

The first design rule is checkpointing. Long jobs should save their state regularly, to object storage or a persistent volume, so that a reclaimed instance costs minutes of rework rather than hours. A job that checkpoints every few minutes can be interrupted almost anywhere and resume cleanly.

The second rule is diversification. AWS recommends being flexible across at least ten instance types for a workload, because spot capacity is priced per instance type in each Availability Zone. Spreading a fleet across types and zones means a capacity shortage in one pool affects only part of the fleet, and the rest keeps running.

The third rule is to listen for the warning. AWS publishes an earlier rebalance recommendation when an instance is at elevated risk of interruption, and Auto Scaling groups and EC2 Fleet can act on it before the two-minute notice arrives. Polling the instance metadata for the interruption notice, and draining connections when it appears, turns a hard stop into a graceful shutdown.

The fourth rule is automation. Spot Fleets, Auto Scaling groups with mixed instance types, and Kubernetes cluster autoscalers can replace reclaimed capacity automatically. The goal is a system where an interruption is a routine event that the platform handles, not an incident that wakes someone up. For the broader cost discipline that spot fits into, see our cloud cost management guide. Best for: platform teams building self-healing infrastructure that treats interruptions as normal.

Decision framework

  • Use spot when the workload can be interrupted and resumed without losing work or affecting users.
  • Check the current discount for your exact instance type and region before committing, not the headline figure.
  • Be flexible across at least ten instance types and several Availability Zones to spread interruption risk.
  • Checkpoint long jobs regularly so a reclaimed instance costs minutes, not hours.
  • Handle the interruption notice: poll instance metadata, drain connections, and shut down gracefully.
  • Set the interruption behaviour deliberately: terminate for stateless work, stop or hibernate when resume matters.
  • Mix purchase options: steady workloads on commitments, flexible workloads on spot, critical workloads on demand.
  • Test interruption handling deliberately, using the provider’s own interruption simulation, before relying on spot in production.

Frequently asked questions

What is a spot instance?

A spot instance is a virtual machine sold from a cloud provider’s unused capacity at a large discount, on the condition that the provider can reclaim it when it needs the capacity back. It is the same hardware as an on-demand instance of the same type; only the purchase terms differ.

How much can spot instances save?

AWS advertises discounts of up to 90 percent against on-demand prices, and Google Cloud advertises up to 91 percent for Spot VMs. The actual discount varies by instance type, region, and time, so check the current price for your specific workload rather than relying on the headline figure.

How much warning do you get before a spot instance is reclaimed?

AWS gives a two-minute interruption notice, delivered through instance metadata and as an EventBridge event. Azure and Google Cloud give around 30 seconds. If you choose hibernation on AWS, the notice still arrives but hibernation begins immediately, so there is no two-minute window.

Can spot instances run databases?

Not safely as a single instance. A database that holds the only copy of your data should not run on spot, because an interruption could cause data loss or downtime. Databases with replication across several nodes can use spot for replicas, but the primary should stay on reliable capacity.

Do spot instances have a maximum runtime?

AWS Spot Instances and Azure Spot VMs have no maximum runtime. Google Cloud Spot VMs also have no maximum runtime, but the older preemptible VMs were always stopped after 24 hours. If you still use preemptible VMs, Spot VMs are the replacement without the 24-hour limit.

Latest articles

Scroll to Top