Understanding Amazon EC2 Spot Instances

Share this Post

When using compute services for running fault-tolerant applications and workloads with flexible start and end-times on AWS, Amazon EC2 Spot Instances offer a pricing option that’s worth a closer look.

In this article, we explain what AWS spot instances are, what they can be used for, and how the pricing works. We discuss the differences between spot instances, on-demand instances and reserved instances, and which one provides the best pricing option for your applications in the cloud.

What Are EC2 Spot Instances?

EC2 spot instances allow you to use excess EC2 capacity that is not being used, at a discount of as much as 90%. Spot instances can be interrupted when EC2 needs the capacity back.

When Should You Use Spot Instances?

Spot instances should only be used for stateless, fault-tolerant, non-production applications that can withstand occasional interruptions in processing. Use cases include development and test servers, web services, API backends, big data analytics/Hadoop data processing, image rendering, and massively parallel computations. Spot instances are not suitable for sensitive workloads or databases.

How Does EC2 Spot Instance Pricing Work?

With EC2 spot instances, you create a Spot Instance request by selecting the maximum price you want to pay, per hour, per instance, in a specific Availability Zone. The spot instance will run if there is available capacity and when your price exceeds the current Spot price.

The price will fluctuate not to exceed the current on-demand instance rate. You can choose a one-time spot request, fleet of spot instances or a spot block.

If you’ve made a persistent spot instant request, AWS will automatically resubmit the request once the initial request terminates.

What is a Spot Fleet?

A spot fleet is a set of spot instances that’s launched to meet the target capacity that you request based on your application needs, your launch criteria and your maximum price. On-demand instances can be included in the fleet request.

A spot instance pool is a set of excess EC2 instances with the same instance type, OS, Availability Zone, and network platform.

What is a Spot Instance Interruption?

If Amazon EC2 needs additional capacity, or the current spot price exceeds your maximum stated price, the spot instance will be terminated or stopped with a two-minute warning. Stopped interruptions will be restarted with a persistent spot instance request.

What is a Spot Block?

You can launch a spot instance with a specified duration, between one and six hours. This is known as a spot block. Spot blocks will not be interrupted and will keep running continuously for that time. The cost depends on the duration and available capacity, which be 30-45% less than the on-demand price, plus 5% off during the region’s non-peak hours. When submitting a spot instance request, you will need to specify the duration in hours and your maximum price. Instances that are in your price range will launch when capacity is available and will continue to run at an hourly rate. At the end of the time block they will be terminated automatically or can be terminated manually,

How Do EC2 Spot Instances Differ from On-Demand?

The key differences between these two types of instances include launch time, available capacity, hourly price and instance interruption.

  • Launch Time – For both, there must be available capacity. Spot requires an active request, while on-demand requires a manual launch request.
  • Available Capacity – The spot process continues to make automatic requests until capacity is available. The on-demand process will only give an insufficient capacity error.
  • Cost – The on-demand hourly rate is fixed. The spot instance price fluctuates based on the demand. As demand for excess EC2 instances increases, the price goes up.
  • Interruption – While both instances can be stopped and started by the user, EC2 Spot instances may be interrupted if the current price goes above your maximum, if demand increases or if capacity becomes unavailable.

While spot instance pricing provides significant savings over on-demand, the limited use cases and the risk of interruption are not viable for many cloud infrastructures. Reserved Instances, on the other hand, provide significant savings for a wide range production environments with steady growth.

For a comparison of all Amazon EC2 pricing options review our earlier article.

Why Should You Still Use Reserved Instances?

By reserving a set of instances for one to three years in advance, you can achieve significant cost savings.

AWS reserved instances are ideal for these use cases:

  • Mission critical applications that run on Multi-Available Zone database deployments
  • Applications and production environments where the servers must always be available
  • Steady state use that involves predictable workloads

Understanding how to build and manage a strategic RI portfolio is critical for optimizing your cloud deployment and cost savings.

The table below illustrates how spot pricing compares with on-demand and reserved instances pricing for a general purpose m5 instance type.

Optimizing Your AWS Costs with a Fully Automated Tool

Spot instances reduce the cost of compute services at a significant rate, yet they can be interrupted at any time. As a result, they are only appropriate for flexible applications that are fault tolerant. Spot instances are not suitable for production environments that need to be available 24/7. For those type of applications Reserved instances offer a better pricing alternative for substantial savings. Yet, managing Reserved Instances is complex and requires constant monitoring and optimization that will require dedicated time and effort. The fully automated optimization tool by Parquantix eliminates the complexity and cost of managing Reserved Instances to maximize your savings on AWS.

Contact us to schedule a 30-minute consultation:
  • This field is for validation purposes and should be left unchanged.