If you want to optimize your AWS costs (believe me you want), this article is for you.
What are spot instances?
Spot instances, in terms of hardware, are just like On-Demand EC2. You’ll find the differences between both at the behavior of these spot instances as they won’t behave like a normal EC2. AWS has a huge amount of hardware resources that have been ordered by AWS accounts around the world. Once these accounts have finished the usage of these instances, their resources’ hardware isn’t used by anyone. So, AWS offers these ‘used’ instances with a significant discount (up to 90% discount) to everyone.
So why don’t everyone just use spot instances?
Because you pay a much lower price for these spot instances than you would pay if it was a normal EC2 instance, if the resources that are used for your spot instances are needed in order to provide a normal EC2 instance (for someone who is paying actually much more), your spot instance will be terminated. Without any warning.
Summarize spot instances pros & cons
|EC2 instance||Spot instance|
|Termination behavior||You choose when to terminate||Whenever AWS choose|
|Costs||100x||10x up to 20x|
What is Spotinst?
Spotinst is a service (Israeli one) that takes the responsibility of the whole termination issue on spot instances. It recognizes a spot instance just before it gets terminated, saves all its data, provision a new spot instance, brings back all the data that was on the old instance, and just makes it look like nothing happened. The IP stays the same, the machine name stays the same.
How does it simply work?
On Spotinst, there is an ‘Elastigroup’ (there are more features that Spotinst offers, but let’s focus on this one for now) that behaves very similarly to an Auto-scaling group. You set a minimum, maximum, and s desired number of instances you want to keep alive. This Elastigroup will make sure that you’ll always have the number of instances you have mentioned, without losing data.
Spotinst services cost money, but still after that, it is cheaper than a normal EC2 instance.
Summarize Spotinst pros & cons
|EC2 instance||Spot instance using Spotinst|
|Termination behavior||You choose when to terminate||Same for the end user (at the background it isn’t actually the same)|
|Costs||100x||20x up to 30x|
|Provision using Terraform||Supported||Supported but you tackle generating machines IPs, as you work with Elasticgroups|
Leave A Comment
You must be logged in to post a comment.