Reserved Instances are often used to reduce the price of Amazon EC2 instance on-demand pricing. If you’re not familiar with Reserved Instances, then you’re missing out. Reserved Instances, or RIs, are a billing construct used in conjunction with Amazon EC2 instances (virtual machines). The default usage on the AWS platform is the on-demand pricing in which you get billed by the hour or second with no commitments. Basically, when you decide to terminate an instance you stop paying for it.
Reserved Instances comes into play when you have EC2 instances that will be running all the time and you can’t terminate them each night to save money. Reserved instances let you pay a reduced price per hour for your instances, but you commit to paying for the entire year or for three years depending on the type of RI you purchase. These price decreases can be pretty significant cost savings (up to 75%) but remember that you’re committing to a fixed length so if you don’t need those instances any longer, you’re still paying for the RI.
Be Aware of How RIs Work
There are a few things that you need to know about RIs before you consider using them. Reserved Instances are purchased with a list of attributes for a class, Instance type, Platform, Scope, tenancy and term.
- Class – Convertible or Standard
- Instance type – The instance family and instance size such as an m4.large.
- Platform – The operating system
- Scope – RIs can be purchased for a region or for a specific Availability Zone.
- Tenancy – Shared Tenancy (default) or instances running on dedicated hardware
Why do we care about these attributes? Because you can’t transfer a Reserved Instance from one instance to another with differing attributes. For example a Reserved Instance will be applied to any instance that matches all of the attributes. If you have a single RI that matches two different instances, it will be applied to one of them. If you terminate one of those instances, the RI will be applied to the second instance automatically. However, if you were to terminate an instance to change the size, the type will no longer patch and the RI won’t be applied unless there is another instance with the same attributes. There is some help here though, if you purchase a Convertible RI, you can modify the RI attributes through the API or console but note that convertible RIs provide a smaller discount for this flexibility.
RIs also provide you insurance on capacity. With On-Demand instances there is no guarantee that capacity will exist within a Region or AZ. For example, if an entire region went down and you needed to spin up your instances in another region, you may be fighting with other customers for the limited capacity in that region. If you purchased an RI in that region, you are guaranteed to have resources to spin up your instances.
Now that we understand the basics behind RIs, let’s explore some considerations that you should take into account before deciding to purchase an AWS Reserved Instance.
Find the Steady State
First and foremost, if you’re just starting to migrated servers to AWS or deploying new workloads, don’t purchase an RI right away. You’ll likely find out that the instance size you picked needs to be scaled either up or down. While this is easy to do within AWS, an RI is tied to an instance type so changing the family or size will have pricing consequences for you. So ensure you’ve run your workloads for a while and have a good understanding of the capacity it needs to use for a steady state before purchasing your RIs.
Use Shared Reserved Instance Sharing in Multi-Account Environments
If you have multiple accounts setup with a root level master billing account, consider whether or not to purchase the RIs at the root account or one of the subordinate accounts. If you purchase the RI at the root account level the RI can be shared across any of the other accounts within the organization. This is incredibly useful for ensuring that the pool of resources is very large so RIs can be allocated to any instance with attributes that match across any account. However, in some situations those individual accounts are owned by their own business unit and have their own budgets. In those cases you may want to turn off Reserved Instance sharing so you can specify which account gets the RI, and the benefits. Be aware here though, that if that account doesn’t use the RI, the other accounts can’t use it either.
Determine the Criticality of your Workload
If the workload you’re running in AWS is mission critical you may want to consider an RI to ensure that no matter what, AWS will have resources available for you to spin that instance up if an AZ fails, or a region fails. Having snapshots, backups, AMIs etc replicated to other regions and infrastructure as code readily available to re-deploy applications is great. But don’t forget that AWS has finite resources as well, even if you don’t see the cloud this way. Don’t let an “Insufficient Capacity” error prevent your perfectly architected business continuity strategy from working correctly.
Don’t Purchase an RI for Every Instance
The public cloud provides a lot of options for elasticity. With the use of auto-scaling groups and load balancers we can automatically scale out our applications based on demand and then reduce them later when the demand subsides. When purchasing an RI consider buying for the steady state and use On-Demand (or spot pricing) for any of the additional capacity that might only be temporary.
Use One-Year RIs
Reserved Instances come in one year or three year options. Three year RIs give you pretty good cost reduction, but consider that AWS is always releasing new instance sizes and families. You might want to take advantage of these but if you have a three year RI this might be more difficult. Consider using the one-year RIs to give you the flexibility to re-evaluate your sizing each year.
If you Goof Up
So what do you do if you accidentally purchased an RI for the wrong type or something. Well, If you contact AWS Support they might let you return it or swap it out for the right type but you can’t count on that. From what I’ve been told this is usually accepted one time but any future exceptions you should expect to own. There is an RI marketplace where you can sell your RIs if you no longer need them. Think of this like the craigslist of AWS RIs where you can buy and sell RIs based on your situation.