Making the most of spot instances is challenging if you have no automation in place and need to select, manage, configure, and provision instances on your own.
But if you decide to give spot instances a manual try regardless, here are the key steps:
1. Know your workload
How aggressive are you going to be about implementing spot instances?
Before jumping on the spot bandwagon, you need to know how much time your application needs to finish a job, and many more things. We shared a list of questions to ask yourself in the previous edition of Kubernetes IRL.
2. Cherry-pick your instances
When shopping for spot instances, consider going for slightly less popular ones. They might come with a lower frequency of interruption and run stable for a longer time.
The frequency of interruption is the rate at which the instance reclaimed capacity during the trailing month.
AWS displays it in the Spot Instance Advisor in ranges of <5%, 5-10%,10-15%,15-20% and >20%:
3. Bid your price
Now it’s time to set the maximum price you’re willing to pay for the spot instance.
Setting the right spot price is key because your instance will run only when the marketplace spot price matches your bid or is lower.
The rule of thumb here is to use a maximum price that equals the on-demand price.
If you set a lower amount and the price goes up, you risk getting interrupted.
4. Manage spot instances in groups
When using groups of spot instances, you can request multiple instance types at the same time. That’s how you increase your chances of snatching the spot instances you need.
Another perk? You can set a maximum price per hour for the entire fleet rather than a given spot pool (a group of instances with the same type, OS, availability zone, and network platform).
Each of the three major cloud providers has an offering like that:
AWS Spot Fleet – you can manage a large fleet of spot instances with different allocation strategies (for example, considering the lowest price or only capacity-optimized types).
Azure VM scale set – use this feature to create and manage a group of load-balanced VMs, increasing or decreasing their number automatically.
Google managed instance group – you can bring preemptible instances together in a group after specifying the preemptible option in the instance template.
But to make it all work, prepare to invest a significant number of hours in manual configuration, setup, and maintenance tasks.
5. Plan for potentially limited spot instance capacity
The amount of available capacity sold as spot instances can vary a lot based on size, region, time of day, and many other factors. It is also subject to frequent changes based on supply and demand.
This might lead to unexpected behavior if you happen to pick the most popular instance types during a market surge like Black Friday.
You need to have a plan B for your workload in case of a spot drought.
Or handle all of the above with automation
What if your workloads are spot-ready, but you can’t afford to spend time managing interruptions and instance type selection manually? You should look into automation.
A platform like CAST AI can handle all of the aspects mentioned in the list above and it also comes with additional benefits, like early prediction of a cloud provider reclaiming an instance. This allows you to benefit from spot discounts on a broader selection of workloads.
I hope this helps you to significantly cut your cloud bill with spot instances!
See you in the next edition of Kubernetes IRL,
Allen
Found this email useful? Forward it to your friends and coworkers who need more Kubernetes best practices in their lives.
CAST AI Group Inc., 111 NE 1st Street, 8th Floor #1041, Miami,Florida,33132,United States,