AWS › AWS Batch

How does AWS Batch support using Spot Instances to reduce compute costs for batch workloads?

Intermediate

Answer

AWS Batch can be configured to use Spot Instances within a managed compute environment, taking advantage of significantly discounted spare EC2 capacity for workloads that can tolerate interruption, and AWS Batch automatically handles the process of retrying a job on different capacity if the Spot Instance running it is reclaimed, making it an excellent low cost option for fault tolerant batch processing jobs.
aws batch create-compute-environment --compute-environment-name spot-env --type MANAGED --compute-resources '{"type":"SPOT","bidPercentage":50,"maxvCpus":100}'
Real-world example A media rendering company runs its overnight video rendering jobs using AWS Batch with a Spot Instance compute environment, cutting compute costs by more than half compared to using regular On Demand instances for the same workload.

Common follow-ups: What happens to a job if its Spot Instance is interrupted mid execution?;How do you decide on an appropriate bid percentage for Spot Instances in Batch?