Spot Instances
What Are Spot Instances?
Spot Instances let you use AWS’s unused EC2 capacity at up to 90% discount compared to On-Demand prices. However, they can be interrupted with only 2 minutes’ notice when AWS needs the capacity back.
When to use Spot Instances
Spot Instances are best for fault-tolerant, stateless, or parallelizable workloads.
Batch Processing / Data Analysis - jobs can be checkpointed or restarted without data loss e.g. image rendering, video encoding, big data ETL, log processing
CI/CD workloads - build/test jobs can be restarted easily if interrupted e.g. code builds, test environments, packaging
Machine Learning (ML) Training - ML training jobs can often resume from checkpoints or be parallelized
Stateless Web Services in Auto Scaling Groups - You can mix Spot with On-Demand or Reserved Instances to save costs while maintaining availability e.g. backend services or APIs with horizontal scaling.
When not to use Spot Instances
Avoid Spot Instances when you need:
guaranteed availability - e.g. customer-facing applications, databases, or critical services
stateful applications - applications that rely heavily on persistent storage or specific instance states may not be suitable, unless you have robust mechanisms for handling interruptions
low-latency requirements - i.e. spot interruptions might introduce unacceptable latency or recovery time
Best Practices
AWS Guidance on best practices for using Spot Instances.
Case Study
This blog about How the Home Office’s Immigration Technology department reduced its cloud costs by 40% includes their adoption of Spot Instances for non-production services, as well as other approaches.