Cloud Economics
How to schedule cloud workloads on Spot Instances
Schedule cloud workloads on Spot Instances when the work can restart, resume from a checkpoint, or wait for replacement capacity. Keep deadline-sensitive work and essential services on standard capacity. With Amazon EKS, define placement by node group. With Google Cloud Compute Engine, check the preemption settings on the Spot VM. Test recovery before increasing the share of work on Spot.
Amazon EKS documents how to place Pods on separate Spot and On-Demand managed node groups within the same Kubernetes cluster. Google Cloud Compute Engine documents how to set the preemption notice duration when creating a Spot VM. Decide what must keep running if Spot capacity disappears, and move only the workloads that can handle the resulting delay.
Decide which work can wait
For each workload, write down how much progress an interruption can erase and how long the workload can wait for another machine. Include the time to start a replacement, load inputs or restore a checkpoint, and finish within the deadline. AWS recommends checkpointing workloads that are costly to restart, and Google Cloud lists fault-tolerant batch jobs and stateless applications as Spot candidates.
| Workload | Starting placement | Condition to check |
|---|---|---|
| Queued batch jobs | Spot | An interrupted task can be retried independently, and the queue can wait for replacement capacity. |
| Long CI, rendering, or deep learning jobs | Spot after a recovery test | The job can resume from a durable checkpoint with acceptable replay. AWS Spot allocation strategies |
| Replicated stateless API | On-Demand node group for baseline traffic, Spot for extra replicas | The baseline can handle the traffic you need to serve while Spot replicas are unavailable. |
| Database or worker with a hard deadline | Standard capacity | Keep work there when an interruption or a wait for replacement would breach the service requirement. Amazon EKS managed node groups · Google Cloud Spot VMs |
Make the fallback explicit for each queue. A background batch job can wait. A job with a delivery deadline may need to move to standard capacity while there is still time to finish. Set that threshold from the job’s deadline and measured recovery time. Include startup and replay when estimating that threshold, especially for jobs that load large inputs before they can resume.
Plan for the interruption you can actually handle
The EC2 timings come from the November 30, 2026 snapshots of the interruption notice and rebalance recommendation documentation. The Compute Engine timings come from the Spot VM documentation last updated November 10, 2026. Distinguish a warning about potential capacity loss from the time available to shut down your process.
| Signal | Documented behavior | Scheduling response |
|---|---|---|
| Amazon EC2 Spot interruption notice | EC2 emits a best-effort notice two minutes before stopping or terminating an instance. Hibernation begins immediately when its notice is issued. EC2 interruption notices | Stop accepting new work and finish only cleanup that can fit within the time available. |
| Amazon EC2 rebalance recommendation | EC2 sends a best-effort signal of elevated interruption risk. It can arrive ahead of the interruption notice or alongside it. EC2 rebalance recommendations | Begin draining work or request replacement capacity when the signal arrives. |
| Google Cloud Compute Engine Spot VM preemption | The default dedicated advance notice is zero seconds. Google Cloud documents an optional 120-second notice configured at VM creation and a separate best-effort shutdown period of up to 30 seconds. Google Cloud Spot VMs | Verify the VM’s notice setting and keep shutdown work short. |
For an EC2 queue worker, stop claiming jobs when you receive a rebalance recommendation or an interruption notice. For a Compute Engine worker configured with advance notice, watch for the preemption signal in VM metadata. Compute Engine starts a configured shutdown script when it sends the ACPI soft-off signal. If you rely on that script, test how much it can save before the VM stops.
AWS recommends checkpointing workloads with a high restart cost. Save checkpoints outside the worker during normal processing so a replacement can pick up from one if the worker exits before a final save. In your recovery test, interrupt the worker before that save and check that running the job again produces the expected output.
Configure Amazon EKS node groups and EC2 capacity pools
Create separate Spot and On-Demand managed node groups. Use the EKS node label eks.amazonaws.com/capacityType with ON_DEMAND for Pods that need the baseline and SPOT for Pods intended to run exclusively on interruptible nodes. If batch work may use On-Demand capacity near a deadline, define that fallback in your job submission policy and test it with the Spot group unavailable.
Give the Spot group multiple compatible instance types. When using Cluster Autoscaler, AWS recommends choosing instance types with the same vCPU and memory resources within the group. The EKS documentation says newly created managed Spot groups use price-capacity-optimized on Kubernetes 1.28 or later and capacity-optimized on 1.27 or earlier. Check an existing group’s strategy directly, since the EKS documentation says the strategy is not changed for node groups created with capacity-optimized before managed node groups started to support price-capacity-optimized. Amazon EKS managed node groups
For most EC2 Fleet or Spot Fleet workloads, AWS recommends price capacity optimized, which identifies the pools with the most available capacity for the request and selects the lowest-priced pools within that set. AWS says capacity optimized suits workloads that are costly to restart, such as long CI, image and media rendering, and deep learning. AWS also recommends checkpointing those workloads to make price capacity optimized a good fit for them. Test checkpoint restore before moving more jobs onto Spot.
When it receives a rebalance recommendation, Amazon EKS attempts to launch a replacement Spot node. If the replacement becomes ready first, EKS cordons and drains the at-risk node. If the interruption notice arrives first, EKS starts draining the at-risk node on a best-effort basis while the replacement is still pending. AWS recommends Pod termination grace periods of 30 seconds or less and avoiding long preStop hooks because Pods can receive less than the full EC2 notice window. Measure the time your Pods actually get.
Test recovery and measure completed work
Run a representative job, interrupt its worker mid-run, and verify the replacement can read its last checkpoint and publish a complete result. Google Cloud documents how to simulate preemption by stopping or deleting a test VM according to its configured termination action. When Compute Engine stops Spot VMs in a managed instance group, the group keeps trying to recreate them from its instance template and succeeds when the required resources are available. Include delayed replacement in your recovery test. Keep the job queued while replacement capacity is unavailable, then verify it resumes and finishes once another worker starts.
For the rollout, compare compute spend per completed job over equivalent observation windows. Include compute consumed by failed attempts and baseline capacity, and record deadline misses beside the cost figure. Use measured restart and replay time to decide whether to expand Spot placement for that workload. For a broader budget comparison, see the cloud comparison tool and the guide to hidden GPU rental costs.
What Tuan-Anh Tran’s 2020 retrospective reported
In a February 20, 2020 retrospective, Tuan-Anh Tran described testing Kubernetes on Spot in 2016 and later setting up a production Kubernetes cluster on AWS. The production setup used a termination daemon to notify containers and let applications shut down gracefully. It spread workloads across instance groups and availability zones, mixed Spot and Reserved Instances, and kept extra capacity to absorb interruptions. His employer’s core team migrated to the cluster in 2017. The post was shared on Hacker News on February 25, 2020.
In the section recounting the 2017 migration, Tran reported overall EC2 savings of around 60–70% for that deployment, with Reserved Instances and extra capacity included. Treat the figure as the author’s result and use your own recovery tests and completed-job costs to size a rollout. The distinction between a pricing snapshot date and an evidence date applies here too.
Sources
- The story behind my talk on cloud cost optimization at scale (Tuan-Anh Tran, February 20, 2020)
- Hacker News discussion of the Kubernetes and Spot case (Hacker News, February 25, 2020)
- Spot Instance interruption notices (AWS EC2 User Guide, snapshot fetched November 30, 2026)
- EC2 instance rebalance recommendations (AWS EC2 User Guide, snapshot fetched November 30, 2026)
- Allocation strategies for Spot Instances (AWS EC2 User Guide, snapshot fetched November 30, 2026)
- Managed node groups (Amazon EKS User Guide, snapshot fetched November 30, 2026)
- Spot VMs (Google Cloud Compute Engine documentation, updated November 10, 2026)
How this note was produced
Drafted with AI assistance from committed ByteCosts pricing snapshots and deterministic cost formulas. Figures are grounded in the linked sources (last updated 2026-11-30). Read our editorial & automation policy, inspect the methodology, or report a discrepancy.
How to schedule cloud workloads on Spot Instances. ByteCosts. Updated 2026-11-30. https://bytecosts.com/blog/spot-instance-workload-scheduling/