How Spotinst in saving cloud infrastructure cost
Let me share what I learned about Spotinst while interacting with a Spotinst SPOC.
Amazon EC2 instances are available in 3 types of varieties. Those are On-demand, Reserved Instances and Spot Instance.
On-demand, as the name suggests, you want an EC2 instance you ask for it and wait for it to be available for usage. A Reserved Instance is something that you keep it beforehand in your bucket and use it whenever you want.
However, a Spot Instance is something that AWS assigns you and can ‘take’ it back based upon some reasons. we will discuss them in the latter part of the post.
Cost($) wise : On-Demand > Reserved Instance > Spot Instance
What is SpotInst?
Referencing from spotinst.com, Spotinst is a Cloud workload automation platform. It automates multi-cloud workloads to improve performance, reduce complexity and lower compute infrastructure costs.
How much $s are we saving?
Well simply put, Spotinst saves you up to 80% in regards to Cloud resources.
How does it actually work?
we have serval algorithms that allow us to run the client’s env on Spot instances instead of On-Demand/RI’s. We rely on the Spot markets in real-time as we receive Spot Market interruption rate from AWS for certain instance types, based on that we can predict the next interruption and be able to launch another instance to replace the endangered EC2 instance.
what do you mean by interruption?
Interruption is When AWS takes the Spot instance you are running. When you are running EC2 from AWS console AWS can ‘take’ that instance but Spotinst will be able to predict that and replace it.
Why would AWS take the instance that I am running and on what basis it is decided by AWS?
That’s how Spot instance work they are cheaper than On-Demand/RI’s but they can receive interrupted at any given time.
The following are the possible reasons that Amazon EC2 might interrupt your Spot Instances:
- Price: The Spot price is greater than your maximum price
- Capacity: If there are not enough unused EC2 instances to meet the demand for Spot Instances, Amazon EC2 interrupts Spot Instances. The order in which the instances are interrupted is determined by Amazon EC2.
- Constraints: If your request includes a constraint such as a launch group or an Availability Zone group, these Spot Instances are terminated as a group when the constraint can no longer be met.
What happens when there is no Spot market at all?
We have a feature that calls FallBackOnDemand this feature meant to replace Spot markets when there is no market available(prevent Downtime) and then revert to Spot with a feature called Maiantance window- looks for available Spot instance while running OnDemand(Save you money).