Container Talks
Published in

Container Talks

What Are Spot Instances And Why These Are Useful?

AWS Spot Instances

The majority of organizations have some workloads that are mission-critical and some of the other workloads are not that much important. We can reduce the cost of those less-important workloads by taking advantage of AWS spot EC2 instances. In this blog we are going to discuss about what is spot instance, when to use spot instance and about pricing of the spot instances.

What are spot instances?

An AWS spot instance is an unused EC2 instance that is available for less than the On-Demand price. Spot instances are identical to a normal EC2 instance. Except two things. First, the billing model of spot instances are different from regular EC2 instances. And second is, they can be terminated anytime by EC2 itself. Spot instances are available at up to 90% less price compared to on-demand prices.

When to use spot instances?

The main reason for using spot instances is to reduce the overall cost. You can use spot instances for flexible and fault-tolerant applications and high-performance workloads. These are also ideal for flexible workloads, such as testing, rendering applications, and continuous integrations (CI).

You can use Spot Instances for the following tasks:

(i) Batch Processing Tasks: Batch processing workloads process large amounts of data at one time. Tasks, such as running automated validation tests, transactions of credit cards, processing documents, etc are ideal for Spot Instances. This is because these tasks are mostly stateless and rely intensively on numerous processors.

(ii) Continuous Integration (CI): CI tasks run on irregular schedules, and using On-Demand instances can be extremely expensive. Therefore using spot instances for CI tasks is a good practice.

(iii) High-performance computing: Artificial intelligence and machine learning powered applications require high computing capabilities, a huge amount of memory, quick storage, and a fast network. So, running such tasks can be costly on GPU instances, therefore using spot instances for such tasks is the best option.

How does Spot instance pricing work?

Like an auction, the cloud users have to bid for getting the spot instances. If the market price of the spot instance i.e spot price is below your bid price then you will get the instance at the spot price. For getting a spot instance, you pay the spot price, not the price you bid on. For example -

On-demand price — $1.5/hr
Spot price — $0.5/hr
Your bid price — $1/hr
What you pay — $0.5/hr

Now, suppose you are using a spot instance by paying $0.5/hr and the spot price is increased to $1.2/hr i.e higher than your bid price. In that case, EC2 (AWS Resource) will automatically terminate your spot instance. But you will be notified 2 minutes before the termination of the instance so that you can take backups from the instance you are using.

Sometimes this also may happen that your bid price is less than the spot price, but still, you will not get the spot instance. This happens because of the availability of the spot instance. The hourly spot price may vary based on demand and capacity. If the demand increases or the capacity decreases for the spot instance, the spot price goes higher.

Almost all of the cloud service providers like AWS, Microsoft Azure, Google Cloud, DigitalOcean, etc offer spot instances. This means whichever cloud service you are using, you can reduce the overall pricing by using spot instances.

Wanna know more tricks to reduce your AWS billings, please read AWS Cost Optimization series.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Devtron Labs

Devtron Labs

Devtron is an open source no-code solution for Kubernetes deployments. https://github.com/devtron-labs/devtron