Amazon EC2 Spot Instances

Spot Instances are a new way to purchase and consume Amazon EC2 Instances. They allow customers to bid on unused Amazon EC2 capacity and run those instances for as long as their bid exceeds the current Spot Price. The Spot Price changes periodically based on supply and demand, and customers whose bids exceeds it gain access to the available Spot Instances. Spot Instances are complementary to On-Demand Instances and Reserved Instances, providing another option for obtaining compute capacity.

For customers with flexibility in when their applications can run, Spot Instances can significantly lower their Amazon EC2 costs. Additionally, Spot Instances can also provide access to large amounts of additional capacity for applications with urgent needs.

What's New
Start Launching Amazon EC2 Spot Instances in a Virtual Private Cloud
You can now bid for unused Amazon EC2 capacity and run those instances within your own Amazon VPC. By integrating Amazon VPC with Spot Instances, you can provision a private virtual network that you control, including selection of IP address range, creation of subnets, and configuration of route tables and network gateways. To learn more, please visit the Developer's Guide.
Leverage Spot Instances with Elastic MapReduce
Customers can now run their Elastic MapReduce applications using on Spot Instances. To see how customers have reduced their data analytics costs by over 50% through the use of Spot Instances, please view the foursquare®, Fliptop and So-net case studies. If you'd like to get started, please view the Spot/EMR Getting Started Video.
Featured Customer Use Case
CycleComputing Runs a 30,000 Core Molecular Modeling Workload on Spot for $1279/hour
Cycle Computing created a 30,000 core cluster (over 3,700 c1.xlarge) on Spot Instances to perform molecular modeling. CycleComputing performed more than 95,078 hours of compute work. To learn more about CycleComputing's run and use of Spot click here
Featured 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 between 50%-66%. To view more documentation, videos, and tutorials, please click here.



This page contains the following categories of information. Click to jump down:



How Spot Instances Work

Spot Instances enable you to bid for unused Amazon EC2 capacity. Instances are charged the Spot Price set by Amazon EC2, which 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 Availability Zone 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 for the past 90 days 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).

Deciding on Your Spot Bidding Strategy

It’s important to note two points:

  1. You will often pay less per hour than your maximum bid price. The Spot Price is adjusted periodically as requests come in and available supply changes. Everyone pays that same Spot Price for that period regardless of whether their maximum bid price was higher. You will never pay more than your maximum bid price per hour.
  2. If you’re running Spot Instances and your maximum price no longer exceeds the current Spot Price, your instances will be terminated. This means that you will want to make sure that your workloads and applications are flexible enough to take advantage of this opportunistic capacity. It also means that if it’s important for you to run Spot Instances uninterrupted for a period of time, it’s advisable to submit a higher maximum bid price, especially since you often won’t pay that maximum bid price.

Spot Instances perform exactly like other Amazon EC2 instances while running, and like other Amazon EC2 instances, Spot Instances can be terminated when you no longer need them. If you terminate your instance, you will pay for any partial hour (as you do for On-Demand or Reserved Instances). However, if the Spot Price goes above your maximum price and your instance is terminated by Amazon EC2, you will not be charged for any partial hour of usage.



Spot Features

There are a number of features that make it easier to write applications that take advantage of Spot Instances:

Persistent Requests: Spot Instance requests can be one-time or persistent. A one-time request will only be satisfied once; a persistent request will remain in consideration after each instance termination. This means that with a persistent request, after your request has been satisfied and your instance has been terminated—by you or by Amazon EC2—your request will be submitted again automatically with the same parameters as your initial request. A persistent request will continue submitting the request until you cancel it. A persistent request is useful when you have a large amount of computing that you want to get done but only below a certain price. By using a persistent request, you can launch instances any time the Spot Price is below your maximum price and steadily work through your task.

Launch Groups and specifying Availability Zones: If you want to run a cluster of instances that always launch and terminate simultaneously, there are two options which can be useful. First, you can specify a Launch Group in your request. This will tell Amazon EC2 to launch those instances only if all the instances in the request can be satisfied. Second, you can choose to specify an Availability Zone Group that ensures your instances will be launched together in a single Availability Zone. These restrictions can be useful for many applications; however, if not required, avoiding them will increase the chance that your request can be fulfilled.

Price History: Amazon EC2 provides a history of the Spot Price for each instance type in each Availability Zone via the AWS Management Console and the Amazon EC2 APIs. Spot Price history is valuable in helping you to determine how frequently your request would have been fulfilled in the past, given the maximum you are willing to pay to run your job. Alternately, it can be used to help determine how high to set your maximum price to increase the likelihood that your instance will continue to run given past Spot Price history.

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.

Launching Amazon EMR Job Flows with Spot Instances

Amazon VPC Integration: You can bid for unused Amazon EC2 capacity and run those instances within your own Amazon VPC. By integrating Spot Instances with Amazon VPC, you can provision a private virtual network that you control, including selection of IP address range, creation of subnets, and configuration of route tables and network gateways. For more information on Spot Instance integration with Amazon VPC, please check out the Spot Instances in Amazon VPC Quick Start Tutorial in the Amazon EC2 Developers Guide.

Launching Spot Instances in Amazon VPC

Would you like to recommend a feature?



Example Use Cases

There are a large number of use cases that work well for Spot Instances. The characteristic that unites all of these applications is that they have fault tolerance, so that an application can handle the potential for interruption if their Spot request is outbid. Common techniques customers use to manage interruption are covered in a video tutorial (click here to view the tutorials section). Example applications well-suited to take advantage of Spot Instance's low price and elasticity include:
Common Spot Use Cases
Analytics Analytics
Complex analytics such as log scanning or simulations that are typically performed as batch jobs now can be completed more cost-effectively on Spot instances.
>> View Customer Case Studies
Big Data Big Data
Processing massive amounts of data such as genomes, Twitter feeds, or trends on the web is cost-effective and easy by leveraging Spot instances with other tools like Elastic MapReduce.
>> View Customer Case Studies
Financial Modeling and Analysis Financial Modeling and Analysis
Financial Services firms leverage Spot Instances to reduce the time and cost when performing complex analysis ranging from wealth management simulations to Counterparty Value Analytics.
Geospatial Analysis Geospatial Analysis
Geospatial tools providers leverage Spot to speed up and reduce the cost of batch processing jobs such rendering and complex analytics problems.
>> View Customer Case Studies
Image Processing and Media Encoding 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
Scientific Computing Scientific Computing
Scientific researchers and high performance computing customers leverage Spot to cost-effectively perform simulations ranging from drug discovery to genomics research.
>> Learn more!
Testing Testing
Load, integration, canary, and security testing all benefit from the elasticity and price savings associated with Spot Instances.
>> View Customer Case Studies
Web Crawling Web Crawling
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

Do you have an interesting use case you'd like to share?



Understanding Spot Requests and Spot Price

Spot Instances are available for EC2 instance types on Linux/UNIX, SUSE Linux and Microsoft Windows Server operating systems. The key differences between Spot Instances and On-Demand Instances are that your instance may not start immediately, the hourly price is variable, and Amazon EC2 may terminate individual Spot Instances. This section describes how these work with a simple example.

Understanding when your instance will start

Let’s assume you decide to place a Spot request for one Standard Small (m1.small) instance in the US East – Northern Virginia us-east-1a Availability Zone. You can see from the Spot Price history in the AWS Management Console or by using the Amazon EC2 API that the Spot Price in that Availability Zone has recently fluctuated about every 1-2 hours between $0.030/hr and $0.060/hour, and is currently $0.050/hr. You decide you want to bid a maximum price of $0.045/hr. You create your request by using the AWS Management Console or making a request through the Amazon EC2 API. Because your maximum price is less than the current Spot Price, no instance is launched and your request remains in a pending state.

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 maximum 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 maximum price, a Spot Instance will soon be launched and you will expect to pay $0.039/hr for the instance’s first complete hour.

Understanding when your instance could get terminated

Continuing our example, 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.

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, four hours later, 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 consumed since it was terminated by Amazon EC2.



Using Spot Instances

Spot Instances can be requested using the AWS Management Console or Amazon EC2 APIs. To start with the AWS Management Console:

  1. Log in to the AWS Management Console, then click the “Amazon EC2” tab.
  2. Click on “Spot Requests” in the navigation pane on the left.
  3. Click on “Pricing History” to open a view of historical pricing selectable by instance type. This will help you choose a maximum price for your request. Pricing shown is specific to the Availability Zone selected. If no Availability Zone is selected, you will see the prices for each Availability Zone in the Region.
  4. Click on “Request Spot Instances” and proceed through the Launch Instance Wizard process, choosing an AMI and instance type. Enter the number of Spot Instances you would like to request, your maximum price and whether the request is persistent or not. After choosing your key pair and security group(s), you are ready to submit your Spot Instance request.

Getting Started with Spot Instances

For detailed information on how to request Spot Instances through the Amazon EC2 API, see the Amazon EC2 API Reference in the latest EC2 Technical Documentation.

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 Introduction to Spot Instances.

To learn more about the differences between On-Demand, Reserved and Spot Instances, go to Amazon EC2 Instance Purchasing Options.



Architecting Applications to Use Spot Instances

There are a number of best practices to keep in mind when making use of Spot Instances:

Architect for the Potential of Interruption: Because Spot Instances can be terminated without warning, it is important to build your applications in a way that allows you to make progress even if your application is interrupted. There are many ways to accomplish this, two of which are splitting your work into small increments (via Grid, Hadoop-based, or queue-based architectures) or adding checkpoints to you application and saving your work frequently. Using Amazon EBS volumes to store your data is one easy way to protect your data. No matter the architecture you decide, if your application can handle interruption, then you have the opportunity to significantly reduce your instance costs.

Introduction to Managing Interruption

Test Your Application: When using Spot Instances, it is important to make sure that your application is fault tolerant and will correctly handle interruptions. While we attempt to cleanly terminate your instances, your application should be prepared to deal with an immediate shutdown. You can test your application by running an On-Demand Instance and then terminating it suddenly. This can help you to determine whether or not your application is sufficiently fault tolerant and is able to handle unexpected interruptions.

Track when Spot Instances Start and Terminate: The simplest way to know the current status of your Spot Instances is to monitor your Spot requests and running instances via the AWS Management Console or Amazon EC2 API.

Choose a Maximum Price for Your Request: Remember that the maximum price that you submit as part of your request is not necessarily what you will pay per hour, but is rather the maximum you would be willing to pay to keep it running. You should set a maximum price for your request that is high enough to provide whatever probability you would like that your instances run for the amount of time that you desire within a given timeframe. Use the Spot Price history via the AWS Management Console or the Amazon EC2 API to help you set a maximum price.


Pricing

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).

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:

  1. Log in to the AWS Management Console, then click the “Amazon EC2” tab.
  2. Click on “Spot Requests” in the navigation pane on the left.
  3. Click on “Pricing History” to open a view of pricing selectable by instance type.

(Amazon EC2 is sold by Amazon Web Services LLC.)


Featured Case Studies

Analytics

GoSquared
GoSquared provides real-time Website analytics for over 8,000 Websites around the world. Amazon EC2 Spot instances help form a portion of the backbone necessary for GoSquared’s high performance real-time applications.
Scribd
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.

Big Data

foursquare
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
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.

Geospatial Analysis

Trendsmap.com
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.

Media Encoding and Image Processing

Litmus
Litmus is a tool that takes snapshots of customers’ email in various email clients and consolidates the images for their customers. Litmus enjoys a 57% cost savings by using Amazon EC2 Spot Instances for their compute needs.
Ooyala
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.

Scientific Research

DNAnexus
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.
Eagle Genomics
Eagle Genomics uses Amazon’s EBS, EC2, RDS, S3, Load Balancing and Auto Scaling, as well as command-line tools, to handle and analyze genomic data for pharmaceutical, agricultural and animal health companies, as well as academic centers. Eagle Genomics has recently been using Spot instances in the development of a novel microRNA discovery pipeline for the ARK Genomics at the Roslin Institute, Edinburgh, UK.
Numerate
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.
University of Melbourne / University of Barcelona
In support of the Belle Experiment, an international High Energy Physics (HEP) experiment, a joint team from the University of Barcelona and the University of Melbourne uses Amazon EC2 and the DIRAC distributed computing software framework to define and steer the execution of experiment simulation and data reprocessing. Moving to Amazon EC2 Spot Instances enabled the University of Melbourne to save 56% per instance hour with negligible changes to their application.

Testing

BrowserMob
BrowserMob is a Neustar service that provides Website load testing and monitoring for companies that need to ensure online performance. The service combines Amazon Elastic Compute Cloud (Amazon EC2) On-Demand Instances and Spot Instances to perform its load testing. BrowserMob uses Amazon Simple Queue Service (Amazon SQS) while operating its monitoring services and Amazon Relational Database Service (Amazon RDS) for data backup while using Spot Instances.

Web Crawling

Backtype
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
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%.

Interested in being featured as a case study?



Featured Documentation, Videos, and Tutorials

Video Tutorial: How to Launch a Spot Instance
Watch this video tutorial to learn how to launch your first Spot Instance. This tutorial covers placing a bid, determining when the instance is fulfilled, and canceling/terminating the instance.
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.
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.
Video Tutorial: How to Manage Interruption
Watch this video to learn how some customers manage the interruption of their Spot instances.
Video Tutorial: Deciding on Your Spot Bidding Strategy
Watch this video to learn the tips and tricks for bidding on your Spot Instances. We cover several different bidding strategies that we have seen customers leverage with success.
Video Tutorial: Launching Amazon Elastic MapReduce Job Flows with Spot Instances
Watch this video to learn how to launch Amazon Elastic MapReduce job flows on your Spot Instances. We cover launching a Spot cluster and shutting one down in the AWS Management Console.
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 between 50%-66%.
Video Tutorial: Launching Spot Instances in Amazon VPC
Watch this video to learn how to launch your Spot instances in Amazon VPC. This tutorial covers placing a bid, determining when the instance is fulfilled, and canceling/terminating the instance.

Do you have interesting content or tutorials on Spot you'd like to share with the community?



Resources

©2011, Amazon Web Services LLC or its affiliates. All rights reserved.