Getting Started with Amazon EC2 Spot Instances

Amazon EC2 Spot Instances offer spare compute capacity in the AWS cloud at steep discounts compared to On-Demand Instances.

Spot Instances let you save up to 90% on big data, containers, CI/CD, HPC and other fault-tolerant workloads. Or, scale your workload throughput by up to 10x and stay within the existing budget.

What are Spot Instances?

How to Get Started

Getting started with Spot Instances is simple. First, identify key workloads best suited to run on Spot Instances. Then launch a Spot Instance in minutes via the AWS Management console, integrated AWS services, such as Amazon EMR, Amazon ECS, AWS Batch, and EC2 Auto Scaling, or the EC2 Fleet API. Visit the Amazon EC2 User Guide, and read the best practices and resources below.

1. Know Before You Launch Spot

  1. Watch this video to see which workloads are best suited to run on Spot Instances.
  2. Learn how the Spot pricing model works, offering low, predictable prices, with typical savings of 70-90% over On-Demand pricing.

2. Create Your First Spot Instance

  1. Learn how Spot Instances work to launch your first Spot Instance from the AWS Management Console, AWS SDK/CLI or via the AWS APIs.
  2. Learn how to launch Spot Instances for workloads such as CI/CD, Big Data, Containers, and Rendering.

3. Implement Best Practices

  1. Watch this video to learn a few simple rules to follow when launching Spot Instances to maximize compute cost savings. Learn more.
  2. Learn how to minimize the impact of interruptions here.

How Spot Instances Work

Use Case Examples

Containerized Workloads with Spot Instances

Containers are stateless, fault-tolerant and a great fit for Amazon EC2 Spot Instances. Watch this webinar to learn how to efficiently deploy containerized workloads with Kubernetes and easily manage clusters at any scale for a fraction of the cost. Spot Instances can be used with Amazon Elatic Container Service, Amazon Elastic Kubernetes Service or Kubernetes to run any containerized workload, from distributed system to applications that map millions of miles a day. Learn more.

Save Costs Running Kubernetes Clusters with EC2 Spot Instances

Running Amazon EMR on EC2 Spot Instances

Big Data Workloads on Spot Instances

Spot Instances provide acceleration, scale, and deep cost savings to run time-critical, hyper-scale workloads for rapid data analysis. Use Spot Instances with Amazon EMR, Hadoop or Spark to process massive amounts of data. Watch this video to get started with Amazon EC2 Spot and Amazon EMR for easy fast and cost-effective data processing. Visit the Amazon EMR on Spot Instances page for additional resources on how to run your big data workloads with Amazon EMR and Spot Instances. 


CI/CD Workloads on Spot Instances

Configure Jenkins with the EC2 Spot Plug-In to automatically scale a fleet of Spot Instances depending on the number jobs to be completed. Increase cost savings by leveraging older generation instances for CI, as these processes do not require a lot of power for testing. Load, integration, canary, and security testing all benefit from the elasticity and price savings associated with Spot Instances. Learn more.

Did You Know That There Is an Amazon EC2 Spot Fleet Plugin for Jenkins?

Studio in the Cloud

Rendering Workloads on Spot Instances

Due to the fault-tolerant nature of rendering workloads, they are a great fit to run on Spot Instances and benefit from the deep cost savings Spot Instances provide. Watch this presentation at 2019 SIGGRAPH to learn how you can get started with AWS Thinkbox, and Spot Instances to scale rendering workloads for a fraction of the cost in the cloud. Learn how Scripps Networks Interactive leveraged Spot Instances and AWS ThinkBox to cut CGI rendering time by 95% here.


Web Applications and Services on Spot Instances

Identify new cost-saving initiatives or scale to tens of thousands of instances for different web services and applications ranging from ad servers to real time bidding servers. Watch this webinar to learn how to deploy web based applications at scale by using EC2 Auto Scaling. Learn how to use EC2 Launch Templates to power and deploy an EC2 Auto Scaling group using a combination of On-Demand and Spot Instances behind a load balancer to cost optimize your workload. To learn more about running web applications on Spot Instances, read this blog

How to Build Scalable Web Based Applications for Less with Amazon EC2 Spot Instances

AWS Batch on EC2 Spot Instances: How to Accelerate Batch Processing for Less

Batch Processing on Spot Instances

Process your batch workloads for a fraction of the cost with Spot Instances. Watch this video to learn how you can get started running your batch processing workloads on AWS Batch with Spot Instances. To further optimize your batch workloads running on Spot Instances, learn about the Spot capacity-optimized allocation strategy in this blog. Visit the AWS Batch with Spot Instances page for additional resources. 


Machine Learning on Spot Instances

Train your AI/ML faster and for less cost with Spot Instances. Watch this video to learn how you can run inference training jobs with Elastic Inference and save up to 90% on compute costs with Spot Instances. Learn best practices around how to set up Cloudformation and launch templates to build for automation. To learn how to run your AI/ML workloads faster and for less on Amazon SageMaker with Managed Spot Training, follow this self-guided tutorial

Reduce Inferencing Cost by Up to 90% Using Amazon Elastic Inference and Amazon EC2 Spot Instances

Spot Best Practices

Your instance type requirements, budget requirements, and application design will determine how to apply the best practices for your application. Here are a few recommendations.

1. Spot Rules

Learn two simple rules to follow to maximize compute cost savings:
  1. Spot Capacity Pools have separate prices and change infrequently
  2. Amazon EC2 will give you a 2 minute warning when we need the capacity back

2. Instance Flexibility

Test your application on different instance types when possible. Because prices fluctuate independently for each instance type in an Availability Zone, you can often get more compute capacity for the same price when you have instance type flexibility. Watch this video to learn more.

 

3. Fleet API

When running Spot Instances in an EC2 Auto Scaling group, use the capacity-optimized allocation strategy to access Spot capacity pools with the most available capacity. Capacity-optimized instructs the EC2 Auto Scaling group to launch Spot Instances with the deepest capacity pools, lowering the possibility of interruptions. 


Handling Interruptions

Automating 2 min Notifications (4:11)

Spot Instances receive a two-minute notice when these instances are about to be reclaimed by EC2, because EC2 needs the capacity back. To reduce the impact of interruptions, follow the best practices mentioned above.

Watch this video to automate the 2 minute notifications you receive when the Spot Instances are interrupted by Amazon EC2. You can also review the Spot Instance Advisor for average frequency of interruption for different Spot Pools.