Flex RIs are an AWS feature that allow you optimized savings on certain types of EC2 Reserved Instances. This article will explain:
- What are Flex RIs?
- How Do I Understand Flex RIs?
- Using CloudCheckr’s Recommendations to Optimize Your Reserved Instances
What Are Flex RIs?
A Flex RI is the term for any RI (moving forward from March 2017 onwards) that can be modified as many times as you want, as long as you stay within the instance family. In addition, when you stay within the one instance family, you can share the benefits of the RI amongst other sizes in the family. The RIs must have the following characteristics:
- Amazon Linux only
- Regional RI only (not an Availability Zone RI)
- Default tenancy only
How Do I Understand Flex RIs?
In the past, a specific RI size and type would give you discounted pricing only on one type of EC2 instance. For example, if you owned a 1-year RI on an m4.large Linux instance but were only running m4.xlarges because your compute needs suddenly changed, you would not be able to easily apply the m4.large RI to another size unless you took rebalancing actions.
AWS’ new feature introduces the concept of an RI Footprint. To understand this, you should first consider that AWS has created a normalization factor for all the RIs in an instance family. The normalization factor is as follows:
If you take an m4.small as a first example, using the normalization factor you are easily able to understand how it relates (in size and cost) to all the other sizes in its family. If an m4.small is 1 then, an m4.medium is 2x as large, a 32xlarge is 256x as large, and a nano is 0.25x as large.
The key takeaway from this is that the Reserved Instances within a family are therefore completely interchangeable. Any RI can give you discounts on any size – the discount will be proportional to the normalization factor.
You can see an example of instance equivalents here:
Your Reserved Instance Footprint
Because all your family RIs are going to be lumped together, you will now have to think about them not as a collection of individual pieces — 10 medium RIs, 5 large RIs, etc. — but instead as one large group that has an impact on your entire EC2 usage, hence AWS’ Footprint designation.
Going forward, if you have 10 medium RIs and 5 large RIs, your footprint will be 40:
10 mediums = 10 x 2 = 20
5 larges = 5 x 4 = 20
Footprint = 20 + 20 = 40
Your Footprint Gives You Flexibility With RI Coverage
The great thing about grouping RIs by footprint is that you simply have a target number that you need to cover. In our example, the footprint is 40 so using the normalization factor as a guideline, you can use any combination of RIs to make up a footprint of 40. You’ll see that you can use large or small RIs, but smaller RIs have the advantage of giving your greater granularity for future RI coverage.
10 larges = 10 x 4 = 40
40 smalls = 40 x 1 = 40
80 micros = 80 x 0.5 = 40
You Can Now Take Advantage of Partial Savings
A further aspect of RI flexibility to understand is the fact that you are able to get partial savings when an RI partially matches an instance you are running. This is significant because you are no longer chasing instance sizes — as long as you have some member of the family in an RI, you will get some percentage of RI coverage.
Here’s an example:
Let’s say you are running a 2xlarge with an On Demand rate of $1.00/hr, and the only RI you own is an xlarge for $0.25/hr. With the new normalization factor (and equivalencies shown at the beginning of this article) you can see that an xlarge is equivalent to half of a 2xlarge, and thus the RI can cover half of the hour at the xlarge RI rate of $0.25. The remaining half of the 2xlarge — another xlarge — will then be charged the xlarge On Demand rate of $0.50. The result is that you have an effective hourly rate of $0.75/hr, a 25% discount over the original On Demand rate of $1.00/hr. This is all calculated for you by AWS and the effective rate is reflected in your CloudCheckr data.
Using CloudCheckr’s Recommendations to Optimize Your Reserved Instances
CloudCheckr has two EC2 RI Recommendation reports that take your RI footprint into account when making suggestions. When applicable, the reports will tell you the optimal number of RIs to buy to get full coverage. Please note that our algorithm makes recommendations to purchase the smallest available RI size to ensure you have the most flexibility as your deployment changes over time.
You can see the recommendations when looking at following reports:
EC2 RI Purchase Recommendations (by Instance)
EC2 RI Purchase Recommendations (by Frequency)
For further information, you can watch an explanation from CloudCheckr CTO, Patrick Gartlan: