Spot Instances allow you to name your own price for Amazon EC2 computing capacity. You simply bid on spare Amazon EC2 instances and run them whenever your bid exceeds the current Spot Price, which varies in real-time based on supply and demand. The Spot Instance pricing model complements the On-Demand and Reserved Instance pricing models, often providing the most cost-effective computing capacity, depending on your application.
Spot Instances can significantly lower your computing costs for time-flexible, interruption-tolerant tasks. Spot prices are often significantly less than On-Demand prices for the same EC2 instance types (see current Spot prices below). Additionally, for some distributed, fault-tolerant tasks (like web-crawling or Monte Carlo applications), you may be able to simultaneously accelerate your computing and save money by opportunistically running Spot Instances.
Using Spot Instances can generate savings that you can keep, invest elswhere, or pass on to your customers. Because Spot prices are typically far below (recently 86% lower, on average) On Demand prices, you can lower the cost of your interruption-tolerant tasks and, potentially, accelerate those applications when there are many Spot Instances available.
There are four general categories of time-flexible and interruption-tolerant tasks that work well with Spot Instances:
- Optional tasks. These tasks are nice-to-have but not strictly required. When Spot prices are low, you can run your optional tasks, and when they rise too high you can stop them.
- Delayable tasks. These tasks have deadlines that allow you to be flexible about when you run your computations (e.g., weekly batch jobs or media transcoding).
- Acceleratable tasks. These tasks can be sped up by adding additional computing power. You can run Spot Instances to accelerate your computing when the Spot price is low while maintaining a baseline layer of On-Demand or Reserved Instances (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.
Spot Instances are spare Amazon EC2 instances for which you can name your own price. The Spot Price is set by Amazon EC2, which fluctuates in real-time according to Spot Instances supply and demand. When your bid exceed the Spot Price, your Spot instance is launched and your instance will run until the Spot Price exceed your bid (a Spot interruption) or you choose to terminate them. (See Understanding Spot Requests below for more details about how Spot bids are fulfilled.)
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).
To determine how that maximum price compares to past Spot Prices, the Spot Price history for the past 90 days is available via the Amazon EC2 API and the AWS Management Console. See the video to the right for more information.
Please note the following important points:
- Spot Instances perform exactly like other Amazon EC2 instances while running. Spot Instances are simply spare Amazon EC2 instances and perform the same as On-Demand and Reserved Instances.
- You will never pay more than your maximum bid price per hour. By bidding the maximum you're willing to pay per hour, you set the ceiling on your Spot Instance hourly costs.
- If your Spot Instance is interrupted by Amazon EC2, you will not be charged for the interrupted hour. For example, if your Spot Instance is interrupted 59 minutes after it starts, we will not charge you for that 59 minutes. However, if you terminate your instance, you will pay for any partial hour of usage as you would for On-Demand Instances.
- There is always a possibility that your Spot Instance might be interrupted. A high max bid price may reduce the probability that your Spot Instance will be interrupted, but cannot prevent interruption. (For example, regardless of how high you bid, if we can no longer offer spare Amazon EC2 capacity of your Spot Instance's type, your Spot Instance will be terminated.)
There are a number of best practices to keep in mind when making use of Spot Instances:
- Choose a reasonable Spot bid price: While the Spot price may have historically been below your bid price, if conditions change you could end up paying your bid price for hours at a time. Your bid price should never be more than you are willing to pay to run a Spot Instance.
- Architect for the potential of interruption: Because Spot Instances can be terminated without warning, you should architect your application to be resilient against Spot Instance interruptions. A couple of ways to do this include splitting your work into small tasks (via Grid, Hadoop, or queue based architectures) or frequently checkpointing you work-in-progress (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":
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.
>> View Customer Case Studies
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.
>> View Customer Case Studies
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.
>> View Customer Case Studies
A number of features make it easy to use Spot Instances with your Amazon EC2 applications.
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 the Auto Scaling with Spot Instances Quick Start Tutorial in the Amazon EC2 Developers 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.
You can request Spot Instances via the AWS Management Console or Amazon EC2 APIs. Using the AWS Management Console:
- Log in to the 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 “Pricing History” to see historical pricing by instance type, operating system, and networking mode. (Reviewing Spot pricing history helps you determine what instance types and Availability Zones to bid on, and how much to bid.)
- 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.
The key differences between Spot Instances and On-Demand Instances are that Spot Instances may not start immediately, the hourly Spot price varies, and Amazon EC2 may terminate individual Spot Instances. Here is an example that explains how Spot requests are fulfilled, resulting in running Spot Instances, and how they are interrupted, resulting terminated Spot Instances.
Placing your request. Say you want to place a Spot request for one m1.small Linux instance in the us-east-1a Availability Zone. You check the Spot Price history for that instance type and see that it fluctuates between $0.030/hr and $0.060/hour, and is currently $0.050/hr. You decide to bid a maximum price of $0.045/hr because you want to keep your costs low and don't need the instance to start immediately. Because your bid is below the current Spot Price, no instance is launched and your request remains in a "pending" state.
Spot request fulfillment. Two hours later, the Spot Price drops to $0.045/hr. At this point, your request may or may not start running. This is because your bid price exactly equals the current Spot price and there may be more requests at this price than can be fulfilled. Let’s assume your instance does not start. Thirty minutes later, the Spot price drops to $0.039/hr. Because this is below your bid price, a Spot Instance will soon be launched and you pay $0.039/hr for the instance’s first hour.
Rising Spot prices while your instance is running. Three hours later the Spot price increases to $0.043/hr. You will now pay $0.043/hr if you continue to run the instance. You would not expect your instance to be shut down by Amazon EC2 because the Spot Price is still lower than your maximum price.
Spot instance termination ("interruption"). One hour later, the Spot price increases to $0.045/hr. At this point, your instance may or may not get terminated (based on available supply), and in this case it continues to run. You will be charged $0.045/hr for continuing to run this instance. Finally, the Spot price increases to $0.055/hr. Because this is greater than your maximum price, your Spot Instance is terminated by Amazon EC2. You will not be charged for any partial hour that your instance ran when it was terminated by Amazon EC2.
Spot Instances enable you to bid for unused Amazon EC2 capacity. Instances are charged the Spot Price, which is set by Amazon EC2 and fluctuates periodically depending on the supply of and demand for Spot Instance capacity. To use Spot Instances, you place a Spot Instance request, specifying the instance type, the Region desired, the number of Spot Instances you want to run, and the maximum price you are willing to pay per instance hour. To determine how that maximum price compares to past Spot Prices, the Spot Price history is available via the Amazon EC2 API and the AWS Management Console. If your maximum price bid exceeds the current Spot Price, your request is fulfilled and your instances will run until either you choose to terminate them or the Spot Price increases above your maximum price (whichever is sooner).
Spot instance-hours are billed based on the Spot price at the start of each instance-hour. If your Spot Instance is interrupted in the middle of an instance-hour (because the Spot price exceeded your max bid price), you are not billed for that partial hour of Spot use. (However, if you terminate the Spot instance, you are charged for the partial hour of use.)
The following table displays the Spot Price per Region and instance type (updated every 5 minutes). In addition to Linux/Unix and Windows, we also offer Spot Instances for Amazon EC2 running SUSE Linux Enterprise Server. Spot Instances are not currently supported in the AWS GovCloud Region.
If you would like to go straight to a view of the latest Spot Instance pricing:
- Log in to the AWS Management Console, then click the “Amazon EC2” tab.
- Click on “Spot Requests” in the navigation pane on the left.
- Click on “Pricing History” to open a view of pricing selectable by instance type.
(Amazon EC2 is sold by Amazon Web Services, Inc.)
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.
foursquare® is a location-based social network in which its more than 10 million users check in via a smartphone app or SMS to exchange travel tips and to share their location with friends. To perform analytics across more than 3 million daily check-ins, Foursquare Labs, Inc. uses Amazon Elastic MapReduce with Amazon EC2 Spot Instances.
So-net Entertainment Corporation, one of Japan’s largest Internet Service Providers and Media and Entertainment companies, reduced their analytics costs by over 50% using Amazon Elastic MapReduce and Amazon EC2 Spot Instances.
Trendsmap.com displays real-time mapping of word trends on Twitter. The Website is a product of Stateless Systems, a Melbourne, Australia-based Web workshop. When Stateless Systems needs access to short term processing of large volumes of data for Trendsmap.com, it calls up Amazon EC2 Spot Instances. Amazon EC2 Spot Instances allow Stateless Systems to save money by bidding on unused instances to temporarily augment the Website’s computing resources.
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.
Fliptop helps brands convert their e-mail lists into social profiles. The company uses numerous solutions from Amazon Web Services (AWS), including Amazon Elastic MapReduce with Spot Instances, enabling them to quickly scale their capacity for agency and corporate clients to millions of contact lookups per day and decrease their data processing costs by over 50%.
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: 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.
Video Tutorial: How to Launch a Cluster on Spot
Chris Dagdigian from BioTeam provides a quick overview of how to start a Cluster from scratch in around 10-15 minutes on Amazon EC2 Spot Instances using StarCluster. StarCluster is an opensource tool that was created by a lab at MIT that makes it easy to setup a new Oracle Grid Engine Cluster. During this presentation, Chris walks through the process of installing, setting up, and running simple jobs on a cluster. Additionally, Chris leverages Spot Instances, so that you can potentially get work done faster and potentially save up to 93% off of the On-Demand price. If you are interested in this tutorial, you may also want to see our StarCluster CloudFormation Template.