AWS News Blog

New – EC2 Spot Blocks for Defined-Duration Workloads

Voiced by Polly

Update July 2021 – Spot Instances with a defined duration (also known as Spot blocks) are no longer available to new customers as of July 1, 2021. For customers that have previously used the feature, we will continue to support Spot Instances with a defined duration until December 31, 2022. If your workload is interruption tolerant, we recommend that you use Spot Instances without setting a defined duration. If your workload is not interruption tolerant we recommend that you use On-Demand instances for the required duration of your workload. For the most up to date information please see our documentation here.

I do believe that there’s a strong evolutionary aspect to the continued development of AWS. Services start out simple and gain new features over time. Our customers start to use those features, provide us with ample feedback, and we respond by enhancing existing features and building new ones. As an example, consider the history of Amazon Elastic Compute Cloud (Amazon EC2) payment models. We started with On-Demand pricing, and then added Reserved Instances (further enhanced with three different options). We also added Spot instances and later enhanced them with the new Spot Fleet option. Here’s a simple evolutionary tree:

Spot instances are a great fit for applications that are able to checkpoint and continue after an interruption, along with applications that might need to run for an indeterminate amount of time.  They also work really well for stateless applications such as web and application servers and can offer considerable savings over On-Demand prices.

Some existing applications are not equipped to generate checkpoints over the course of a multi-hour run. Many applications of this type are compute-intensive and (after some initial benchmarking) run in a predictable amount of time. Applications of this type often perform batch processing, encoding, rendering, modeling, analysis, or continuous integration.

New Spot Block Model
In order to make EC2 an even better fit for this type of defined-duration workload, you can now launch Spot instances that will run continuously for a finite duration (1 to 6 hours). Pricing is based on the requested duration and the available capacity, and is typically 30% to 45% less than On-Demand, with an additional 5% off during non-peak hours for the region. Spot blocks and Spot instances are priced separately; you can view the current Spot pricing to learn more.

You simply submit a Spot instance request and use the new BlockDuration parameter to specify the number of hours your want your instance(s) to run, along with the maximum price that you are willing to pay. When Spot instance capacity is available for the the requested duration, your instances will launch and run continuously for a flat hourly price. They will be terminated automatically at the end of the time block (you can also terminate them manually). This model is a good for situations where you have jobs that need to run continuously for up to 6 hours.

Here’s how you would submit a request of this type using the AWS Command Line Interface (AWS CLI):

$ aws ec2 request-spot-instances \
  --block-duration-minutes 360 \
  --instance-count 2 \
  --spot-price "0.25" ...

You can also do this by calling the RequestSpotInstances function (Console support is in the works).

Here’s the revised evolutionary tree:

Available Now
You can start to make use of Spot blocks today. To learn more, read about Using Spot Blocks.

— Jeff;

Jeff Barr

Jeff Barr

Jeff Barr is Chief Evangelist for AWS. He started this blog in 2004 and has been writing posts just about non-stop ever since.