With Spot Instances, you can save up to 90% by bidding on spare Amazon EC2 instances. They are functionally identical to On-Demand and Reserved Instances, and will run whenever your bid exceeds the current Spot Price, which fluctuates based on demand and supply of spare capacity.
Spot makes it easy for you to manage your fleet of Spot Instances automatically, so you can minimize cost while maximizing application performance.
Spot Instance termination notices
Spot Instances now get two-minute warnings before they are due to be terminated via the Instance Metadata Service. See our blog post to learn more.
Spot is ideal for EC2 instance-flexible and interruption-tolerant tasks that fall into the following three categories:
- Acceleratable tasks. These tasks can be sped up by adding additional computing power. Maintain baseline capacity with On Demand or Reserved Instances, then run additional Spot Instances when prices are low to accelerate performance. (e.g., using Spot task nodes and On-Demand master and core nodes in an Elastic MapReduce job).
- Large scale tasks. These tasks may require computing scale that you can't access any other way. With Spot, you can cost-effectively run thousands or more instances in AWS regions around the world.
- Distributed Big Data tasks. These tasks are distributed so they are easier to manage and can be architected to run on Spot with minimal loss of data (e.g. Mesos, Spark…).
Spot Instances are spare Amazon EC2 instances that you can bid on. The Spot price fluctuates in real-time based on supply and demand. When your bid exceeds the Spot Price and spot capacity is available, your Spot instance is launched and will run until the Spot market price exceeds your bid (a Spot interruption).
To use Spot Instances, you place a Spot Instance request that specifies the instance type, the Availability Zone desired, the number of Spot Instances desired, and the maximum price you are willing to pay per instance hour (your bid).
The key differences between Spot Instances and On-Demand Instances are that Spot Instances start only when your bid exceeds the current spot price, the hourly Spot price varies, and Amazon EC2 may terminate individual Spot Instances.
- Spot Usage and Availability: Spot instances are sold by region, instance type, availability zone and networking (EC2-Classic or VPC). The price is based on the supply and demand of spare capacity. Sometimes, no matter how high you bid, there may be no Spot instances available for sale.
- Bidding on Spot Instances: If you bid below the current Spot price, no instance is launched and your request remains in a "pending" state. If you bid equal to the current Spot price, your instance may or may not run depending on availability.
- You will never pay more than your bid price per hour: When your bid is above the Spot price, a Spot Instance is launched and you will be charged the current Spot price until it exceeds your bid price. If you terminate your instance, you will pay for any partial hour, as you would for On-Demand instances.
- Spot Instance Termination ("interruption"): When the Spot price is greater than your bid, your Spot Instance is terminated and you will not be charged for the partial hour that your instance ran when it was terminated by Amazon EC2. For example, if your Spot Instance is interrupted 59 minutes after it starts, we will not charge you for those 59 minutes.
Below are a few best practices to keep in mind when making use of Spot Instances.
- Choose a reasonable Spot bid price: Your bid price should never be more than you are willing to pay to run a Spot Instance.
- Design Instance-Flexible Applications: If your application can use multiple instance types and availability zones, distributing your application across multiple pools can significantly increase availability. Consider other instance types, including previous generation instances which often have lower demand and sometimes lower prices.
- Look for Stable Spot Prices: Analyze the 90 day spot price history for spot instances with lower price variance, which indicates a more reliable supply of instances that are less prone to interruption. The Spot Price history for the past 90 days is available via the Amazon CLI and the AWS Management Console.
- Architect for the potential of interruption: Split your work into small tasks (via Grid, Hadoop, or queue based architectures) or take frequent snapshots (e.g., using Amazon EBS volumes to store your data).
- Track when Spot Instances run and terminate: You can monitor the status of your Spot Instances via Spot bid statuses (via the AWS Management Console or Amazon EC2 APIs) and termination notices (on the instance itself).
Many applications work well with Spot Instances. They all share the important quality of fault tolerance and are resilient against unpredictable Spot Instance interruptions. Here are some application types that may be "Spot-able":
Complex analytics such as log scanning or simulations, typically performed as batch jobs, can be completed cost-effectively with Spot Instances.
Financial Modeling and Analysis
Financial Services firms use Spot Instances to reduce the time and cost to perform complex analysis ranging from wealth management simulations to Counterparty Value Analytics.
Geographic information system (GIS) providers use Spot to speed up and reduce the cost of batch processing jobs such rendering and satellite image processing.
Image and Media Encoding
Media and Entertainment companies can cost-effectively render and encode media assets using Spot Instances, scaling their infrastructures based on demand.
Load, integration, canary, and security testing all benefit from the elasticity and price savings associated with Spot Instances.
Web crawling processes can easily and cost-effectively scale-out on Spot Instances by leveraging Amazon Elastic MapReduce or other tools to get work done faster and typically cheaper.
A number of features make it easy to use Spot Instances with your Amazon EC2 applications.
Spot Fleet: You can target multiple instance types to request that your Spot Instances be fulfilled in the lowest priced instance pool where capacity is available. Spot fleet requests also work to maintain your target capacity if your Spot Instances are interrupted by Spot prices over time.
Price History: You can access the Spot price history for each Spot instance pool (instance type, operating system, Availability Zone, and networking platform) via the AWS Management Console and the Amazon EC2 APIs. Reviewing Spot price histories helps you determine which instance types to bid on and how to bid. (Note: Past pricing patterns may not repeat in the future.)
Bid Statuses: Spot bid statuses provide detailed information about the state of your Spot instance requests to help you answer questions like: Why hasn't my bid been fulfilled yet? Is my Spot instance marked for termination? Why was my Spot instance terminated?
Termination Notices: Spot instance termination notices provide a two-minute warning to your Spot instance before it is due to be terminated by Amazon EC2, giving your applications time to prepare for a graceful shut down (e.g., by checkpointing important data to persistent storage).
Persistent Spot Requests: You can ensure that your Spot instance request it is automatically resubmitted whenever its instance is terminated—by you or by Amazon EC2—until you cancel the Spot instance request.
Auto Scaling Integration: Spot Instances with Auto Scaling enables you to automatically scale the number of Spot Instances you run based on your demand or according to a schedule you define. For more information on Spot Instance integration with Auto Scaling, see Launching Spot Instances in Your Auto Scaling Group in the Auto Scaling Developer Guide.
AWS CloudFormation Integration: Using AWS CloudFormation, you can create and manage a collection of related AWS resources including Spot Instances. For a sample High Performance Computing framework using CloudFormation that can use Spot Instances, see the cfncluster demo. For more information on using Spot Instance integration with CloudFormation, see the Using CloudFormation with Spot Instances Quick Start Tutorial in the Amazon EC2 User Guide.
Amazon Elastic MapReduce Integration: Amazon Web Services customers have the ability to run their Amazon Elastic MapReduce applications on Spot Instances, significantly reducing the cost of processing vast amounts of data on managed Apache Hadoop clusters. Customers can run their Elastic MapReduce applications entirely on Spot Instances to enjoy the largest potential cost savings or they can easily mix Spot Instances with On-Demand and/or Reserved Instances to protect against cluster failure due to Spot Instances being outbid. For additional information on using the feature, including how to use it with the Java SDK and Ruby CLI, please visit the Spot Instances section of the Amazon Elastic MapReduce Developer Guide.
The Spot Price is set by Amazon EC2 and fluctuates depending on the supply of and demand of Spot Instance capacity. Spot instance-hours are billed based on the Spot price at the start of each instance-hour.
To see the latest pricing see the Spot Instance Pricing Table.
You can request Spot Instances via the AWS Management Console or Amazon EC2 APIs. Using the AWS Management Console:
- Log in to the AWS Management Console, then click the EC2 icon.
- Click on “Spot Requests” in the navigation pane on the left.
- Click on “Request Spot Instances” and follow the Launch Instance Wizard. When configuring your instance, you will be asked to enter the number of Spot Instances you would like and your bid price, and you can configure other Spot-specific options. When you have completed the launch wizard, you can see your Spot requests in the "Spot Requests" pane and--after they are fulfilled--any Spot Instances in the "Instances" pane.
Scribd allows users to turn PDF, Microsoft Office Word and Microsoft Office PowerPoint files into Web documents using a solution built on Amazon EC2 and Amazon S3. Scribd used Amazon EC2 spot instances for a recent batch conversion job, saving 63%, or $10,500, compared to what it would have spent on on-demand instances for the same job.
Ooyala is a leader in online video technology for publishing, analytics, and monetization across all connected devices. Its comprehensive video technology gives content owners deep insights that help drive increased viewer engagement and revenue from video. Its use of Amazon Elastic Compute Cloud (Amazon EC2), including Spot, Reserved, and On-Demand Instances and Amazon Simple Storage Service (Amazon S3) has enabled the company to decrease time to market and virtually eliminate wait time for users.
DNAnexus provides a unified system of data management and sequence analysis for DNA sequencing centers and researchers. DNAnexus uses Amazon Elastic Compute Cloud (Amazon EC2) Spot Instances to conduct all of its DNA analysis, while Amazon EC2 On-Demand Instances handle the company’s interactive services, such as its client front end portal and visualization tools. DNAnexus also relies on Amazon Simple Storage Service (Amazon S3) to meet the company’s extensive storage demand, which will grow from terabytes into petabytes of data.
Numerate is a Bay Area biotechnology platform company focused on making the drug design process more data-driven, efficient, and predictable. The company has incorporated Amazon EC2 as a production computational cluster and Amazon S3 for cache storage. Numerate enjoys around 50% cost savings by using Amazon EC2 Spot Instances after spending just 5 days of engineering effort.
BackType develops products and services that help companies understand their social impact by measuring online conversations. To manage a complex system that processes data in both batch and real-time, the company uses Amazon EC2 Spot Instances to save up to 66% over On-Demand Instances and Amazon Simple Storage Service (Amazon S3) for storage.
Video Tutorial: Common Spot Use Cases
In this video, we will walk through example spot instance use cases. As a part of this video, we will cover several customer examples including Numerate, Clarity Solutions, Ooyala, and BrowserMob and how they leverage Spot Instances in their architectures.
Guide: Getting Started with Spot Instances
For a more detailed walk through of using Spot Instances and more information on how to get the most out of Spot Instances, please read this guide.
Guide: Getting Started Programming Guide for Spot Instances
This code tutorial provides a quick overview of how to bid, describe, and cancel Spot instances programmatically.
Guide: Advanced Programming Guide for Spot Instances
This quick code tutorial provides a quick overview of more advanced provisioning topics and interruption management techniques for Spot Instances.
Guide: How to Track Spot Instance Activity with the Spot Notifications Sample Application
This code tutorial and sample enables you to generate and manage Amazon SNS notifications for changes in the state of your Amazon EC2 Instances, current Spot Instance Requests, and Spot Prices within a particular region. By leveraging this code sample, you can now setup your applications running on Spot Instances to more easily manage the potential of interruption.