AWS EC2 Support
EC2 Spot interruption handling: run on Spot without outages.
Spot capacity can be taken back by EC2 with a two-minute warning. Workloads that expect this run on Spot reliably at a lower price than On-Demand, and workloads that do not break. We design for the interruption instead of hoping it will not happen.
When You Need This
The situations where this work pays for itself.
Signs it is time
- You want to cut compute cost for stateless, batch or containerized workloads
- Spot instances in your Auto Scaling group keep disappearing and users notice
- You use Spot with one instance type in one Availability Zone
- You need to checkpoint long jobs or drain load balancer traffic cleanly
- EKS or ECS nodes run on Spot and pods die abruptly
What you get
- Workload review marking what can and cannot use Spot
- Auto Scaling or Karpenter configuration with diversified pools
- Interruption handler and draining runbook
- A test showing the service survives an interruption
How we do it
A clear, safe process you can follow along with.
1. Decide which workloads qualify
Good fits are stateless web tiers behind a load balancer, queue workers, CI runners, batch and data processing that can retry. Single-instance databases and anything that cannot lose a node in two minutes stay On-Demand.
2. Diversify across instance types and zones
We build the Auto Scaling group with a mixed instances policy using many instance types, sizes and generations across all Availability Zones, so one capacity pool running dry does not take the service down. Narrow, single-type Spot is the main cause of repeated outages.
3. Choose the allocation strategy
We use the price-capacity-optimized strategy for most workloads, which favors pools with lower interruption likelihood at a good price. We keep an On-Demand base for the minimum capacity and let Spot cover growth above it.
4. Enable capacity rebalancing
With capacity rebalancing, Auto Scaling can launch a replacement when it receives the EC2 instance rebalance recommendation, before the actual two-minute notice, and then retire the at-risk instance.
5. Handle the interruption notice
The notice appears in instance metadata at spot/instance-action (read with an IMDSv2 token) and as an EventBridge event, EC2 Spot Instance Interruption Warning. A small handler deregisters from the load balancer, stops taking work, flushes state and checkpoints. On EKS we use the Node Termination Handler or Karpenter to cordon and drain.
6. Tune for graceful shutdown
We align the target group deregistration delay, queue visibility timeouts and container stop timeouts with the two minutes available, and make jobs idempotent so a retry is safe.
7. Test and monitor
We rehearse with AWS Fault Injection Service Spot interruption actions or a manual interruption, and add dashboards for interruptions, replacement time and fulfilled capacity.
Mistakes we help you avoid
Common ways this goes wrong, and what we do instead.
One instance type in one zone
It concentrates risk in a single capacity pool.
No On-Demand floor
If Spot capacity is unavailable the whole service may run short. We keep a baseline.
Ignoring the two-minute budget
Long shutdown hooks are cut off. We move state out of the instance instead.
Using lowest-price as the only strategy
Cheapest pools are often the most interrupted. We favor capacity-aware strategies.
Frequently Asked Questions
How much warning do I get before a Spot interruption?
EC2 sends a two-minute notice through instance metadata and EventBridge. A rebalance recommendation can arrive earlier, but it may not arrive before an interruption.
Can databases run on Spot?
Generally not as the primary. Read replicas, caches that can be rebuilt and analytics clusters with replication can fit, if the data layer tolerates losing a node.
Does Spot work with ECS and EKS?
Yes. ECS capacity providers can use Spot Auto Scaling groups, and Fargate has Fargate Spot. On EKS, managed node groups support Spot capacity and Karpenter handles interruptions natively.
Want Help With EC2 Spot interruption handling: run on Spot without outages?
Schedule an appointment. Tell us about your environment and we will outline the safest, highest-value approach.
Schedule Appointment › No commitment required