Cost Optimization is one of the five pillars of the AWS Well-Architected Framework, and with good reason. When you optimize your costs, you build a more efficient cloud that helps focus your cloud spend where it’s needed most while freeing up resources to invest in things like more headcount, innovative projects or developing competitive differentiators.
Reserved Instances are an incredibly powerful tool for optimizing your AWS costs with the potential to save up to 70% off of On-Demand rates. Taking advantage of these savings involves a multi-point strategy based on knowing your current usage and predicting your future usage. Let’s take a quick look at how Reserved Instances work and how you can use them for AWS cloud cost optimization.
NOTE: In this blog post, we’re focusing on Amazon EC2 Reserved Instances, but Reserved Instances can also be used for other services, such as Amazon RDS.
How Reserved Instances Work
Have you ever bought a season pass to a theme park or museum? You basically get a heavily discounted rate on admission for a whole year. If you go enough times during that year, you’ll save money. Reserved Instances work in a similar fashion with either a one-year or three-year term. You get a discounted rate on instance use for the term of the Reserved Instance, and if you use enough of the right instances, you can save a lot of money.
A season pass is usually pretty straightforward. You might have different admission prices for adults, seniors or children, and you might have some blackout days, but that’s about it. Reserved Instances, on the other hand, have a wide variety of traits that determine the discount and when the Reserved Instance can be applied to EC2 usage.
For starters, each Reserved Instance has some core purchase options for you to choose that will determine your discount:
- Standard vs. Convertible – Standard gives you greater discounts, but Convertible allows you more flexibility.
- One Year vs. Three Years – A one-year term is less commitment, but a three-year term will save you more.
- No Upfront vs. Partial Upfront vs. All Upfront – The more you pay upfront, the greater your discount, but it does mean more initial cash outlay.
Once a Reserved Instance is purchased, it will only apply to EC2 instances running the right combination of attributes. These are:
- Instance type – Type is based on the instance family and size, such as m5.xlarge.
- Scope – The Reserved Instance can be limited to either a Region or a specific Availability Zone within the Region, like us-east or us-east-1b.
- Platform – Reserved Instances need to match the OS, such as Linux.
- Tenancy – Instances can have Default (shared) or Dedicated hardware, and Reserved Instances can only apply to instances with the same Tenancy.
So a Reserved Instance might be for an m5.xlarge instance running Linux with a Default Tenancy in the us-east region. Whenever you run an instance that matches those parameters, your Reserved Instance is applied and you aren’t billed further for its use.
It’s also important to note that a Reserved Instance can only be applied to the capacity of that instance at any given time. For example, an m5.xlarge with Instance Size Flexibility can be applied to two m5.large instances at the same time, since this is equal capacity to an m5.xlarge, but not two m5.xlarge instances. In that case, it would only apply to one of the instances.
There are a few more complications about how Reserved Instances can be applied and used, including Reserved Instance modifications and conversions. To learn more, download The Complete Handbook for AWS Reserved Instances.
How to Save Money with Reserved Instances
AWS bills by the second, so a one-year Reserved Instance is 31,536,000 seconds (365 days) of use at the discounted rate, while a three-year Reserved Instance is 94,608,000 seconds (1,095 days) of use at the discounted rate. Understanding these numbers helps you compute the break even point of your Reserved Instance.
In the graphic above, the blue line is your On-Demand costs over time, while the yellow line is the costs of a Partial Upfront Reserved Instance. At around 7 months, the On-Demand costs will be more than the maximum Reserved Instance costs, making that your break-even point.
As an illustration, say you’re using an m5.xlarge in the us-west (Oregon) region. On Demand pricing for this instance runs around $0.19 an hour. A Standard One-Year Term with Partial Upfront payment will cost $512 and $42.34/mo for a total of $1,016. That’s an effective hourly rate of about $0.12 for 8,760 hours, which is a 39% discount. Running instances that size for 5,192 hours with On-Demand pricing will incur the same expense. So any use beyond 5,192 hours (about 7 months) is pure savings.
How to Optimize with Reserved Instances
A Reserved Instance is only going to be worth the expense and commitment if you can be confident that it will be applied above the break-even point. This is where you have to match up your Reserved Instance purchase strategy with both your current and predicted Amazon EC2 usage.
Remember how Reserved Instances can only apply to the capacity of that instance? This idea is key to cost optimization with Reserved Instances.
If three instances run at once for eight hours, the Reserved Instance only applies to one instance and only eight hours, leaving 16 hours billed at On-Demand rates.
If three instances run one after the other, the Reserved Instance applies to all three for twenty-four hours with zero On-Demand billing.
Using the idea above, we can use the waterline planning model. In this model, the use of instances that could fall under the same Reserved Instance are all grouped together, then plotted against their hourly use. The result looks something like this:
In this diagram, each letter represents one of eight different instances of the same type.
For the purposes of this example, let’s assume this same ten hour pattern is repeated for a whole year. At a glance, this charting method shows you that there are always four instances running, with five running 90% of the time and six running 80% of the time. That means:
- 4 Reserved Instances would have 100% utilization
- 5 Reserved Instances would have 90% utilization
- 6 Reserved Instances would have 80% utilization
Using this, you can select a waterline for your organization, or a savings level for your Reserved Instances purchases. If you selected an 80% waterline, then charting your use like this would instantly show you that you need to purchase six Reserved Instances to hit your savings goals.
How to Quickly Weigh Your Reserved Instance Options
Mature cloud infrastructures use thousands of EC2 instances, which means it’s time-prohibitive and cost-prohibitive to manually chart EC2 use against possible Reserved Instance use. With small systems, spreadsheets can be used to evaluate the information, but any growing cloud will quickly overwhelm the spreadsheet.
This is where a cloud cost management tool, such as Cloudability, comes in. Our Reserved Instance Planner builds models using your actual usage data to predict your future usage, then cross-references that against pricing and Reserved Instance options to make recommendations for you.
Reserved Instance cost optimization is a continuous journey
Your cloud is constantly growing and changing, which means optimizing costs with Reserved Instances isn’t something you do just once. You should regularly bring together Finance, Tech and Business teams to evaluate your Reserved Instance options and make purchases or modifications. This kind of multi-team coordination is part of a growing practice known as FinOps.