Understanding Amazon Reserved Insntances

AWS EC2 Reserved Instances —Choosing the right one that fits you.

Amazon Web Services offers to buy compute instances in 3 modes primarily.

In this post, I am going discuss, the types of use cases where Reserved Instances(RI) will fit in for max discount. The complete flow of reserving the RIs. The preference behind reserving RIs, i.e (Capacity first or Discounts first).

  1. On Demand Instances : With On-Demand instances, you pay for compute capacity by the hour with no long-term commitments or upfront payments. You can increase or decrease your compute capacity depending on the demands of your application and only pay the specified hourly rate for the instances you use. Pay as you go, no commitment, pay hourly rate, Suitable for unpredictable workloads, or developed or testing in EC2 newly.
  2. Reserved Instances : Reserved Instances provide you with a significant discount (up to 75%) compared to On-Demand instance pricing. In addition, when Reserved Instances are assigned to a specific Availability Zone, they provide a capacity reservation, giving you additional confidence in your ability to launch instances when you need them. Significant discount, 1 year or 3 year commitment, best suited for predictable, steady usage.
  3. Spot Instances : AWS allows you to bid on Spare Amazon EC2 computing capacity. These instances are known as spot instances. Since Spot instances are often available at much discount compared to On-Demand pricing, you can significantly reduce the cost of running your applications, grow your application’s compute capacity and throughput for the same budget. Spot instances may provide up to 90 % discount, useful for steady and flexible workloads such as batch processing. You can bid for Spot instances using AWS API’s, AWS CLI and Web Console. Your Spot instance runs whenever your bid exceeds the current market price.

Now, let’s discuss about how to make most of RIs by understanding the attributes that define RI, offering class, plans of RI and the factors those effect your savings.

  1. Among all the possible ways you could save money on AWS, RIs are the ones which give you massive discounts. The discounts provided will vary from 45%-75% depending on the plan and scope that you choose.
  2. RIs affinity will decide on which account the RI is actually applied.
  3. RI Can provide optional capacity reservation.
    * RIs will be applied in that account alone. Only in the account that purchased the RI.
    * If you are planning to capacity RI purchase, ensure you purchase it in the account where you are going to use it. While applying the RIs discounts owner account is always given the priority.
  4. AWS assigns Reserved Instance hours to linked accounts, it always starts first with the linked account that purchased the reservation, which is sometimes called Reserved Instance affinity. If there are hours from the capacity reservation left over, they are applied to other accounts operating identical usage types in the same Availability Zone. Again, this allocation always occurs using un blended rates.

Payment Options for AWS RI

To purchase RI, AWS offers 3 payment options. They are All upfront, Partial Upfron0t, No Upfront.

  • All Upfront: Pay full amount for the reservation term in one single payment. This one gives the highest savings.
  • Partial Upfront: Pay portion of amount for part of the reservation term in an upfront payment, and pay the remaining in installments every month for the duration of the term. This option costs more than All Upfront, but less than No Upfront.
  • No Upfront: Pay for the reservation in installments throughout the term’s duration every month. This payment offers the lowest savings rate.

Here is the AWS pricing details of various instance types and plans.

Apart from the discount you get individually from the above plans, if you have total active RI list value above $5,000,000 per region, you get more discount from 5% — 10%. This discount is known as RI Volume Discount.

Note: It is highly recommended to purchase the RIs in bulk together in a single transaction. The reasons being, you can merge the RIs if reservation going to be unused due to the changing requirements over the time.

AWS RI Offering Classes

AWS offers the RIs in 3 modes, i.e Standard, Convertible and Scheduled. where each have advantages and disadvantages of their own.

Standard RIs : These provide the most significant discount (up to 75% off On-Demand) and are best suited for steady-state usage as shown in below pic. If the load and infra per instance is properly estimated by load testing, and is not going to change frequently for at least an year, these RIs are recommended.

AWS EC2 Consistent Usage graph. Credits: Botmeric

This mode of RI will give maximum discount over other modes.

Convertible RIs : These provide a discount (up to 45% off On-Demand) and the capability to change the attributes of the RI as long as the exchange results in the creation of Reserved Instances of equal or greater value. Like Standard RIs, Convertible RIs are also best suited for steady-state usage. These give Good discount but less than the Standard RIs, average of 45% discount. Useful for uncertain needs of RI such as, flexibility of change of instance type when infra requirement is changed or when load exceeded, AWS dropped prices and new RI for specific instance type is lesser than the current one, etc. With this offering class you can change every attribute of RI. No limits to exchange size. You can purchase the convertible RIs only with 3 year term plan. You can check if RI is convertible or not by verifying “Offering Class”.

With convertible RIs you can exchange the RIs, across the family, ex: from t2 to m4, with different OS, ex: Windows to Linux, to new instance size. Ex: medium to large.

While exchanging the convertible RIs, you may need to either exchange it with instance type/size smaller than the current one, or vice versa.

Exchanging the instance with lower cost : In this scenario, you will get additional instances, which are either unused or applied to other instance types.

Ex: Say that you are running m4.4xlarge instance in us-east-1a, as per your new requirement, if you are exchanging it with t2.large instance in us-east-1a, since t2 family instances are cheaper than m4, you will get 5 t2.large instances for exchanging 1 m4.4xlarge instance. (Note:Need to change).

Exchanging instance with higher cost : While exchanging the instance with higher cost than the current one, you may need to pay true up charge, which will be reflected in your current month bill.

Below is the formula used for calculating the true up charge of an RI.

True Up charge = new convertible ri you receive by exchange — prorated upfront charges of current instance.

Ex: Say that you have an t2.micro instance in 3 year term plan partial upfront with 32 months remaining. Now, if you go for exchanging that instance with t2.small instance, then your true up charge will be,

The total upfront price of your new reservation t2.small is : $133.792,

Remaining upfront value of your exchanged reservations : $109.25,

True Upcharge = 133.792–109.25 = 24.54 with hourly rate of $0.006.

You can exchange with convertible RI only if the following conditions are met.

  1. Active
  2. Not pending another exchange request
  3. Terminating in the same hour (but not minutes or seconds)

Limitations of Convertible RIs:

  1. Convertible RIs can only be exchanged for other Convertible Reserved Instances currently offered by AWS.
  2. Convertible RIs cannot be modified. You can only exchange it with other configuration.
  3. Convertible RIs can only be exchanged with the same or higher payment option. Ex, Partial Upfront Convertible Reserved Instances can be exchanged for All Upfront Convertible Reserved Instances — but they cannot be exchanged for No Upfront Convertible Reserved Instances.

Scheduled RIs : These are available for discounts within the time windows you reserve. This option allows you to match your reservation to a predictable recurring schedule that only requires a fraction of a day, a week, or a month. These are recommended heavily when you have predictable spike for a duration or for running the batch jobs.

Ex: Recommended when your system generates reports at 2:00PM every day and emails to all your product users.

Note: You can purchase the RIs in this mode using AWS CLI, API’s, AWS management console.

Scope of RIs — Zonal RI & Regional RI:

Zonal RIs: Any RI purchased for specific availability zone ,is called as zonal RI. In this scope of RI, instance capacity reserved for your use in that AZ, which gives better confidence while launching instances. Capacity reservation is, if you want to run an instance in AZ, if AWS has reached the capacity of instance type you need, you will not be able to launch due to hardware limitation in that AZ. With zonal RIs, irrespective of instance being used or not, the instance capacity is assigned to you. Capacity reservation available with in that account. The attributes that decide the RIs discount are Instance Type, Tenancy (Shared/Dedicated), Availability Zone, Operating System. These RIs will be applied to the instances running with same instance type and OS in the AZ RI is purchased. This is highly recommended when you are reserving the higher instances types on AWS, as they are limited.

Regional RIs : This scope is recommended if you prefer the discount over the capacity since region scope does not offer capacity reservation. But regional RIs give flexibility over managing the RIs as if has broader applicability & flexibility, recommended for maximum discounts.

Note: Based on your requirement, you can always modify the scope of RIs with no extra cost.

Instance size flexibility :

All Regional Linux/UNIX RIs with shared tenancy apply to all sizes of instances within an instance family and AWS region, even if you are using them across multiple linked accounts. This will help further in reducing the AWS costs. In this RIs are applied based on scale known as normalization factor within a particular instance family. Below is the normalization factor table for instance sizes.

Normalization of Instance sizes, Source : AWS Blog

Let’s say you already own an RI for a m4.16xlarge. This RI now applies to any usage of a Linux/UNIX C4 instance with shared tenancy in the region.

This could be applied on either:

  • Four m4.4xlarge instance.
  • Eight m4.2xlarge instances.
  • Sixteen m4.xlarge instances.
  • Thirty two m4.large instances.

Or any combination of above instances for above family that matches to the total normalization factor.

Limitations of instance size flexibility:

  1. This is not applied on Zonal RIs.
  2. This is not applied on Windows , RHEL.

Rate will be applied completely if proper match found, else partially applied for the units.

How RIs are applied? 
 1) Zonal RIs are always applied first.
 2) Regional RIs are applied next. 
 3) The instance size flexibility. Applied by the first qualified instance based on the instance.

Understanding the Application of Reserved Instances

The following scenarios cover the ways in which Reserved Instances are applied.

Scenario one

A customer is running the following On-Demand Instances in account A:

  • 4 x m3.large Linux, default tenancy instances in Availability Zone us-east-1a
  • 2 x m4.xlarge Amazon Linux, default tenancy instances in Availability Zone us-east-1b
  • 1 x c4.xlarge Amazon Linux, default tenancy instances in Availability Zone us-east-1c

The customer then purchases the following Reserved Instances in account A:

  • 4 x m3.large Linux, default tenancy Reserved Instances in Availability Zone us-east-1a (capacity is reserved)
  • 4 x m4.large Amazon Linux, default tenancy Reserved Instances in us-east-1
  • 1 x c4.large Amazon Linux, default tenancy Reserved Instances in us-east-1

The Reserved Instance benefits are applied in the following way:

  • The discount and capacity reservation of the four m3.large Reserved Instances is used by the four m3.largeinstances because the attributes (instance size, region, platform, tenancy) between them match.
  • The m4.large Reserved Instances provide Availability Zone and instance size flexibility, because they are Amazon Linux Reserved Instances with default tenancy.
  • An m4.large is equivalent to 4 normalized units/hour.
  • The customer has purchased four m4.large Reserved Instances, and in total, they are equal to 16 normalized units/hour (4x4). Account A has two m4.xlarge instances running, which is equivalent to 16 normalized units/hour (2x8). In this case, the four m4.large Reserved Instances provide the billing benefit to an entire hour of usage of the two m4.xlarge instances.
  • The c4.large Reserved Instance in us-east-1 provides Availability Zone and instance size flexibility, because it is an Amazon Linux Reserved Instance with default tenancy, and applies to the c4.xlarge instance. A c4.largeinstance is equivalent to 4 normalized units/hour and a c4.xlarge is equivalent to 8 normalized units/hour.
  • In this case, the c4.large Reserved Instance provides partial benefit to c4.xlarge usage. This is because thec4.large Reserved Instance is equivalent to 4 normalized units/hour of usage, but the c4.xlarge instance corresponds with 8 normalized units/hour. Therefore, the c4.large Reserved Instance billing discount applies to 50% of c4.xlarge usage. The remaining c4.xlarge usage is charged at the On-Demand rate.

Regional Linux/Unix Reserved Instances apply to any usage matching the region, tenancy, and platform within the instance family. Reserved Instances are first applied to usage within the purchasing account, followed by qualifying usage in any other account in the payer account. In the case of Reserved Instances that offer size flexibility, there is no preference to the instance size within a family that the Reserved Instances apply. The Reserved Instance discount is applied to qualifying usage that is detected first within payer account. The following example may help explain this.

Scenario two

A customer is running the following On-Demand Instances in account A:

  • 2 x m4.xlarge Linux, default tenancy instances in Availability Zone us-east-1a
  • 1 x m4.2xlarge Linux, default tenancy instances in Availability Zone us-east-1b
  • 2 x c4.xlarge Linux, default tenancy instances in Availability Zone us-east-1a
  • 1x c4.2xlarge Linux, default tenancy instances in Availability Zone us-east-1b

The customer is running the following On-Demand Instances in account B — a linked account:

  • 2 x m4.xlarge Linux, default tenancy instances in Availability Zone us-east-1a

The customer then purchases the following Reserved Instances in account A:

  • 4 x m4.xlarge Linux, default tenancy Reserved Instances in us-east-1
  • 2 x c4.xlarge Linux, default tenancy Reserved Instances in us-east-1

The Reserved Instance benefits are applied in the following way:

  • The discount of the four m4.xlarge Reserved Instances is used by the two m4.xlarge instances in account A and the m4.2xlarge instance in account A. All three instances match the attributes (instance family, region, platform, tenancy). There is no capacity reservation.
  • The discount of the two c4.xlarge Reserved Instances can apply to either the two c4.xlarge instances or thec4.2xlarge instance, all of which match the attributes (instance family, region, platform, tenancy), depending on which usage is detected first by the billing system. There is no preference given to a particular instance size. There is no capacity reservation.

In general, RIs that are owned by an account are applied first to usage in that account. However, if there are qualifying, unused zonal Reserved Instances in other accounts in the payer account, they are applied to the account before regional Reserved Instances owned by the account. This is done to ensure maximum Reserved Instance utilization and a lower bill. For billing purposes, all the accounts in the organization are treated as one account. The following example may help explain this.

Scenario 3

The customer is running the following instance in account A

  • 1 x m4.xlarge Linux, default tenancy instances in Availability Zone us-east-1a

The customer is running the following instance in another linked account B:

  • 1 x m4.xlarge Linux, default tenancy instances in Availability Zone us-east-1b

The customer then purchases the following Reserved Instances in account A:

  • 1 x m4.xlarge Linux, default tenancy Reserved Instance in Availability Zone us-east-1

The customer also purchases the following Reserved Instances in account C:

  • 1 x m4.xlarge Linux, default tenancy Reserved Instances in Availability Zone us-east-1a

The Reserved Instance benefits are applied in the following way:

  • The discount of the m4.xlarge Reserved Instance owned by account C is applied to the m4.xlarge usage in account A.
  • The discount of the m4.xlarge Reserved Instance owned by account A is applied to the m4.xlarge usage in account B.
  • If the Reserved Instance owned by account A was first applied to the usage in account A, the Reserved Instance owned by account C remains unused and usage in account B will be charged at On-Demand rates.

Summary:

  1. Standard RIs offer you more discounts over any Convertible RIs.
  2. Zonal RIs offer capacity reservation, recommended for larger instance types and if capacity is preferred over discounts.
  3. Regional RIs give more flexibility in managing the RIs.
  4. Convertible RIs give you wide range of options while exchanging but offers you lesser discounts compared to Standard RIs.

Instance size flexibility give you further discounts for Linux/Unix instances for regional RIs and shared tenancy.

Though AWS RIs give you the maximum savings in your cloud cost, if not managed properly, they might lead to unused cost. Planning and managing AWS RIs is tedious task. Analyze & forecast your usage properly before you purchase. After purchasing RIs, you must monitor the usage regularly if the discounts are applied or not.

For better understanding and analysis of RIs, you can take a look at Botmetric’s Cost and Governance RI. It provides wide range of analysis for RI Utilization, unused RI, planning RI based on the metrics like CPU, IO and number of days instance running. It has free 14 day trial.