While spot instances promise to save you up to 90% on cloud costs, reaching such savings levels may be a tall order. Spot instance price hikes can effectively ruin your most ambitious cost optimization plans. If you don’t want to compromise your savings, CAST AI’s new feature – scheduled rebalancing – can come to the rescue.
AWS adjusts spot instance rates gradually, depending on long-term trends in supply and demand for this capacity type. At times getting surprisingly close to on-demand rates, they can end up not being that cost-efficient after all.
Until recently, CAST AI users haven’t had proactive mechanisms to protect their cloud savings from such spot instance pricing changes. However, the new rebalancer lets them set a schedule that gets executed once their criteria can be met, e.g., more cost-efficient spot instances become available.
Scheduled rebalancing helps to relieve the negative effects of spot price hikes. Read on to learn how it works and how it’s already supported some of our users.
How spot instance price hikes can spoil your savings
Spot instance prices can change anytime depending on market supply and demand. Volatility is inherent in this game: as particular resources get more requests, their price can drift to the on-demand level.
This holds particularly true if you locked in on a specific spot instance type some time ago, and its price has increased since then. Over the last year, we’ve researched spot instance price changes across the three cloud providers and noticed some interesting patterns (more on that soon!)
For example, if you started with AWS c5’s in 2022, you now pay 24% more than if you had dynamically moved to c6a’s as spot prices increased.
CAST AI uses APIs like DescribeSpotPriceHistory from AWS to retrieve pricing information and keep a constant inventory of all spot prices in all regions. This data helps us track spot instance price changes and identify more affordable choices.
Price change variations within just one family demonstrate that flexibility about spot instance type can unlock significant savings:
c6a: -11.82% (decrease)
c1: -6.71% (decrease)
c6g: -3.15% (decrease)
c7g: -2.07% (decrease)
cc2: 0.00% (no change)
c6gd: 0.02%
c5a: 3.24%
c6id: 5.37%
c3: 8.41%
c5ad: 10.91%
c5: 12.47%
c6gn: 15.95%
c6i: 17.41%
c5d: 17.87%
c4: 20.35%
c5n: 20.61%
c6in: 28.44%
c7gn: 49.58%
You just need to know which spot instance you should select and when – and that’s where scheduled rebalancing comes in.
Mitigate spot instance price hikes automatically
So far, CAST AI users have been able to reach a far more optimal cluster state almost instantly with a feature called rebalancing.
Checking real-time market prices, it replaces suboptimal cluster nodes with more affordable on-demand and spot instances. Teams like Sharechat or Branch have used the rebalancer to optimize configuration and generate significant savings fast.
We use rebalancing extensively. That way, our infrastructure stays optimized, thanks to the right configurations and choice of the right machine types, saving us considerable resources.
– Jenson C S, Engineering Manager at ShareChat
Read more about rebalancing in the documentation.
However, before a rebalancing plan gets executed, you must request and accept it in the product console or with this script.
CAST AI’s addition of the scheduled rebalancer ups the cloud cost optimization game.
By creating scheduled cloud cost optimization plans, you can cover different use cases. Once saved, your schedules will work independently towards your target.
For example, a partial rebalancing targeting spot nodes could run on weekdays, while a complete cluster rebalancing could occur on weekends. And then also set a schedule that will pick alternative nodes in case of spot instance price hikes.
Zoom in on scheduled rebalancing
Instead of having to remember to start it each time, scheduled rebalancing can automatically kick off and target spot nodes following your preferences.
Starting with your most expensive spot node, the rebalancer will consider all spot instance price options and look for more affordable alternatives.
Let’s say you have 12 spot nodes, of which you decide to rebalance five. The rebalancer could arrange them by price, starting with the one that costs you the most. It could look for the most affordable combination of nodes that fit the same number of CPU and RAM requests.
Scheduled rebalancing may replace all or only some of your nodes, hitting your required savings goal.
In the process, the rebalancer may also find new, cheaper instance types. For example, when GCP launched the c3 instance type in March 2023, CAST AI started provisioning these performant, low-cost spot instances. One user saved an additional 12.5% month-over-month due to CAST AI using the new instance type.
How to add a rebalancing schedule
You can add a new rebalancing schedule directly in the product console.
The key elements you can specify while creating a schedule include:
1. Node selection preferences
This section lets you specifically indicate the nodes you wish to target: based on their lifecycle (on-demand/spot), using one or multiple labels, or selecting their age (e.g., nodes older than 1 hour).
- By specifying the batch size, you can limit the maximum number of nodes you wish the rebalancer to target, for example, to just a single node per cycle.
- By using labels, you can flexibly include and exclude nodes to specifically target the ones that:
- use spot instances;
- have a specific template;
- follow a particular configuration;
- were provisioned by CAST AI;
- and more.
2. Savings threshold
This setting lets you specify the level of savings (e.g., 15%) that needs to be reached for the rebalancer to kick off.
- By specifying this value, you can avoid running optimization activities if savings are too marginal to be worth the effort.
- At the same time, by setting this value to 0, you can roll nodes in scenarios where rebalancing doesn’t aim at optimizing costs but performance and maintenance (e.g. after control plane upgrade, node configuration updates, etc.).
3. Execution times
You can decide if you want the rebalancer to run during specific times (e.g. Fridays, from 01:00 UTC to 04:00 UTC).
Don’t give in to spot instance price hikes
While spot instance price changes are inevitable, they don’t have to ruin your planned cloud cost savings.
As you’ll see in our forthcoming research on spot pricing changes, the hikes are too sharp and fast for a human mind to keep up with.
That’s where automation and AI can lend you a hand – and scheduled rebalancing can indeed deliver substantial savings. Schedule a technical call and see how it could help you.
CAST AI clients save an average of 63%
on their Kubernetes bills
Book a call to see how much how you could save with cloud automation.