Maybe you have a few instances that are running 24/7 and you were thinking about using Reserved Instances (RIs for short) to save a significant amount of money. After all, according to AWS, a reduction of up to 75% is quite significant. Then you made the leap and paid for the reservation, and you are sleeping better knowing that the next bill will be considerably smaller than the last one.
Let’s see how it looks like in the EC2 console! Here are 2 instances that are currently enjoying the reduced hourly rates:
Or maybe it’s easier to see from the Reserved Instances page:
Could you spot the indicator that these instances are charged way less than the sticker price?
Don’t blame yourself if you don’t.
The thing is, there is absolutely no indication that the purchased RIs are actually used. If the instance has matching properties, then it will be a “reserved instance”, but if there are any differences then you’ll be charged for both the instance and the reservation. If you bought a RI for a
t3.micro but later decided you need a bigger instance, you’ll pay way more if you forget to change the RI too.
And you’ll get no notifications about the mismatch, except for the next bill.
Fortunately, there is a metric that can be queried that tracks the proportion of the purchased RIs that are actually used. But typical AWS, you can find it not where all the other metrics are found, in CloudWatch, but by using 2 new and kinda unrelated services: AWS Cost Explorer and AWS Budgets.
How to check the RI Utilization metric
First, you need to enable the AWS Cost Explorer. To do this, find it on the Console, enable it, then wait at least 24 hours, as it needs to perform some sort of dark magic to produce the metrics.
After 24 hours, check back to the console as there is no notification when it becomes ready to use.
RI utilization is a numerical value that indicates what percentage of the purchased RIs are used at a given moment. If you run your instances 24/7 then you want to keep it as close to 100% as possible.
To access this report, select the Reservation Utilization menu item on the AWS Cost Explorer console:
After that, you’ll see the graph. A happy state you want to maintain looks like this:
How to set up alerting
Now that you can see the chart, the next thing is to set up notifications to know when it shows a grimmer picture.
To do that, go to AWS Billing, and select Budgets:
The next thing is to create a budget. First, you need to select the type, which is Reservation budget in this case:
Then fill in the budget details:
- Period: Daily
- Reservation budget type: RI Utilization
- Service: EC2-Instances (the only one)
- Utilization threshold: 100 or 99
For the Utilization threshold it is better to set to 99 instead of 100, as the latter would trigger for intermittent shutdowns resulting in false positives.
After the budget is set up, the last thing is to specify how you’d like to be notified when the threshold is crossed: Email or SNS. Email is easier, as there is no auto-completion for SNS here, and possibly you need to change the topic policy too. But it is certainly an option.
After you’ve filled this out, confirm & create the budget.
Now you’ll get a notification whenever there is a mismatch between the reservation and the instances, possibly saving some money.
Reserved Instances offer a great way to save some money, but it’s all too easy to misconfigure something and pay even more than without reservation. This is especially the case when one person in the team handles the EC2 instances, and another person handles RIs. But with some initial setup, you can rest assured that you’ll avoid this situation.