Table Of Contents
What Is A Spot Instance? Spot Instances Vs. Reserved Instances: How Do They Compare? Spot Instances Vs. On-Demand Instances: How Do They Compare? When Would You Want To Use Spot Instances? How Are Spot Instances Charged? 

EC2 Spot Instances, according to Amazon, can potentially save you up to 90% of what you’d otherwise spend on On-Demand Instances. 

While it’s been proven that even Reserved EC2 instances are cheaper than their On-Demand counterparts, it turns out Spot Instances are additionally capable of pushing their discounts beyond the reach of the Reserved Instances

Despite these cost benefits, however, Spot Instances come with a string of caveats — which can make them unsuitable for certain operations and processes. Even Amazon itself emphasizes that although this type of EC2 instance can save you a lot of money, there are situations that are best reserved for On-Demand Instances or even Reserved Instances. 

To learn the difference, follow along as we explore the basics of Amazon Spot Instances.

This article provides simple, non-technical explanations of what Spot Instances are, how they operate, their use cases, plus the applicable pricing models. Additionally, we’ll also cover how Spot Instances compare with On-Demand EC2 Instances, as well as Reserved Instances. 

Table Of Contents

What Is A Spot Instance?

A Spot Instance is a specialized Amazon Web Services (AWS) instance that allows you to access and utilize unused EC2 capacity at a steeply discounted rate. Amazon offers them as a means of helping EC2 users optimize their cloud computing costs — by capitalizing on idle EC2 capacity, instead of relying entirely on the rather costlier On-Demand Instances. 

What you end up paying in return is known as a Spot Price, and it’s charged on an hourly basis for each Spot Instance. 

It’s worth noting, however, that while Spot Instances tend to be cheaper than standard On-Demand Instances, their pricing rates are not fixed. Rather, they are constantly adjusted across the Availability Zones based on market demand. 

Users, in the meantime, cannot rely on real-time bidding. As long as the maximum rates for your request are higher than the Spot Price, the system will run your Spot Instance whenever EC2 capacity is available. 

Here’s the kicker, though. As it turns out, AWS reserves the right to reclaim the Spot Instances at any time. You’ll receive a Spot Instance Termination Notice in the form of a two-minute warning, after which the system will proceed to permanently take back the Spot Instances. 

But then again, such service interruptions happen to be pretty rare. Amazon insists that it only performs Spot Instance terminations less than 5% of the time. 

Nonetheless, it might not be a good idea to use Spot Instances in mission-critical environments that require high availability. You should, instead, leverage them for flexible, fault-tolerant workloads that can comfortably handle interruptions. 

Examples include: background processing, batch tasks, data analysis, and optional jobs. 

Otherwise, keep in mind that Spot Instances come with the same build and structure as On-Demand and Reserved Instances. 

What’s more, you can seamlessly launch them using the same tools that you’ve been deploying other instances on — Spot Fleet, Run Instances, Auto Scaling Groups, AWS Management Console, etc. 

finops-automation-series-thumbnails

Spot Instances Vs. Reserved Instances: How Do They Compare?

While both Spot Instances and Reserved Instances are great for cost optimization, they operate under different rules and pricing methodologies. 

As Spot Instances focus on spare EC2 capacity, Reserved Instances give you the benefit of booking ahead of time. You can pay in advance and commit yourself to the Reserved Instances for a span of one to three years. 

In return, AWS applies a favorable pricing discount, which could provide a saving up to 72% of the amount you’d otherwise use up on regular On-Demand Instances. These cost benefits depend primarily on the volume of Reserved Instances, plus the accompanying commitment period. 

For instance, making a three-year reservation would provide a much bigger discount than purchasing the one-year plan. Amazon requires you to pay for everything upfront, usually as a one-time deposit or sometimes in monthly installments. 

When your reservation period lapses, you should be able to access and run the Reserved Instances without the interruptions that come with Spot Instances. 

Now, these factors combined make Reserved Instances ideal for users and applications with predictable computing requirements. This can be extended to include even mission-critical workloads, as the Reserved Instances are always set to maintain 100% availability. 

Spot Instances, on the other hand, are way too dynamic and inconsistent to be used in highly demanding production environments. And although they seem to offer more flexibility, settling for Convertible Reserved Instances will still give you a little wiggle room in case you need to shift between different instance types. 

Spot Instances Vs. On-Demand Instances: How Do They Compare?

On-Demand Instances are the primary EC2 instances on AWS. This is what you run when you are seeking to pay on an hourly basis without committing yourself. 

You could argue the same rules apply to Spot Instances, and you’d be right. However, the thing about On-Demand Instances is, they tend to be readily available on demand. You’re guaranteed to always find an available server at any time of the day or night — except during the rare occasions when there’s extremely high demand. 

On-Demand Instances also give you the privilege of scaling based on your computing needs. Once you make the initial purchase, you can proceed to gradually acquire more capacity as your needs expand. Then when the application demands ultimately start reducing, you’ll be free to scale down the instances accordingly.

And speaking of computing, another great thing about On-Demand Instances is reliability. AWS won’t interrupt your processing to take back EC2 capacities. Instead, you get to keep and run the instances for as long as you want without any interference.

Now that, combined with the accompanying levels of flexibility and availability, make On-Demand Instances exceptionally ideal for dynamic computing. You can count on them to run critical fluid processes while responding in real-time to any changing parameters. 

A good example is a web app that experiences traffic spikes from time to time. Unlike Spot Instances, On-Demand EC2 capacities can effectively cater to the shifting traffic patterns without any downtime. 

You could also leverage On-Demand Instances on critical batch programs that happen to have unpredictable runtime, as well as batch programs that you’re migrating to the cloud. 

As you’d expect, however, these many benefits come at a price. You’ll notice that, on the AWS platform, On-Demand Instances tend to cost much more than both Reserved Instances and Spot Instances. 

When Would You Want To Use Spot Instances?

Spot Instances are not only cheap and cost-effective, but also easy to use and automate. What’s more, you should be able to deploy them at a massive scale, even in ecosystems that involve other AWS services. 

These properties allow Spot Instances to perform particularly well in the following use cases: 

  • Distributed DBs – Spot Instances can comfortably support distributed databases that are capable of retaining data when instance reboots occur. Examples include Mongo, Elasticsearch, and Cassandra — as they can all resume quite easily after an interruption. 
  • Big data – You could also use Spot Instances to process all sorts of big data on AWS EMR, Hadoop, or Spark. 
  • CI/CD operations – When it comes to continuous integration and continuous delivery/deployment, you can have Spot Instances run everything at scale without breaking the bank. 
  • Machine learning – While there’s always the risk that unplanned Spot Instance interruptions might compromise your deep learning and training progress, it’s still possible to successfully execute machine learning projects on Spot Instances. 
  • Stateful applications – Stateful apps are known to generate client data from one session’s activities, and then save it for use in the subsequent sessions. Since such operations rely on data and IP persistence, you could have Spot Instances powering the underlying automated solutions as a means of maintaining workload consistency. If, for example, a spot instance is replaced, the workload should then proceed to resume from the same data point but within your desired Availability Zone. 

How Are Spot Instances Charged? 

The Spot Prices of AWS Spot Instances are normally determined by Amazon itself. How? 

Instead of setting a constant rate, Amazon progressively adjusts the Spot Prices based on not only the supply of the Spot Instances, but also the corresponding market demand. More specifically, it considers the overall long-term trends in the market — not your real-time bids. 

You can track all these Spot Price shifts from Amazon’s Spot Instance pricing history page — after which you could also view the current rates in your region for various Spot Instance types. The Spot Instance Advisor, on the other hand, compares the current Spot Price with the corresponding On-Demand EC2 rates. 

These three resources will help you to at least come up with an appropriate price bid for the Spot Instances, and then leave the rest to Amazon. 

AWS usually picks up from there by keeping tabs on all the set bids. It then proceeds to award Spot Instances to the users whose maximum price bids happen to be higher than the prevailing Spot Price.

Make no mistake about it, though. Qualified bids are not always guaranteed to get Spot Instances. AWS only fulfills your request if spare EC2 capacity is available. 

Nevertheless, if you’re lucky enough to land Spot Instances, you get to run them until you either choose to terminate them, the Spot Price stretches beyond your maximum price, the EC2 capacity becomes unavailable, or Amazon’s EC2 auto scaling engine takes back the instances. 

In the meantime, you’ll be charged for every hour of Spot Instance usage. If termination occurs, Amazon considers not only the period of usage, but also who initiated the termination, plus the operating system used. Consequently, you might end up paying for just a couple of seconds, or maybe even get away with zero charges. 

Whichever the case, it’s advisable not to stop at Spot Instances. Although they are a good place to start, you can only fully optimize your AWS cloud costs through a holistic data-driven approach. 

This is where you should take a step back and use a cloud cost intelligence platform, like CloudZero, to conduct an in-depth analysis of your entire cloud spend.

CloudZero provides visibility into your cloud costs, enabling engineering teams to drill into cost data from a high level down to the individual components that drive their cloud spend — and see exactly what AWS services cost them the most and why.

Additionally, CloudZero uses machine learning to align spend to business metrics you care about like cost per customer, feature, product, team, and more. To see it for yourself, , and start your journey towards optimizing your cloud spend.

The Modern Guide To Managing Cloud Costs

Traditional cost management is broken. Here's how to fix it.

Modern Cost Management Guide