Amazon EC2 Reserved Instances and Other AWS Reservation Models
Tags: cloud, aws, devops, cloudskills
Published: 2021-10-25 10:41:04

##● Amazon EC2 Reserved Instances:
➥ By purchasing RIs, you make a `one-year` or `three-year` commitment and receive billing discount of up to `72%`. 
➥ RI is not an instance dedicated to your organization. It is a billing discount applied to the use of On-Demand Instances.

##➤ Reserved Instances payment options:
**1-No Upfront:** You are billed a discounted hourly rate for every hour within the term, regardless of whether the Reserved Instance is being used (`Lowest discount`).
**2-Partial Upfront:** A portion of the cost must be paid up front and the remaining hours in the term are billed at a discounted hourly rate, regardless of whether you’re using the RI.
**3-All Upfront:** Full payment is made at the start of the term, with no other costs or additional hourly charges, regardless of hours used (`Highest discount`).
_______________________________________
##➤ Standard vs. Convertible offering classes:

|Standard Reserved Instance|Convertible Reserved Instance|
|-|-|
|Enables you to modify Availability Zone, scope, networking type, and instance size (within the same instance type) of your RI.| Enables you to exchange one or more Convertible RIs for another with a different configuration, including instance family, OS, and tenancy. There are no limits to how many times you perform an exchange, as long as the target instance is of an equal or higher value than the new instances.|
| Can be sold in Marketplace| Cannot be sold in Marketplace.|
| Higher discount| Lower discount (One-year Standard has similar discount to three-year Convertible)|

**✅ When to use Convertible Reserved Instances:**
- Workloads are likely to change. 
- You want to hedge against possible future price drops. 
- You can’t or don’t want to ask teams to do capacity planning or forecasting. 
- You expect compute usage to remain at the committed amount over the commitment period.

________________________________________

##➤ Regional and zonal Reserved Instances:

||Regional Reserved Instance|Zonal Reserved Instance|
|-|-|-|
|**Availability Zone flexibility**|When you purchase a Reserved Instance for a Region|When you purchase a Reserved Instance for a specific Availability Zone|
|**Capacity reservation**|Discount applies to instance usage in any availability zone in the specified region|A zonal Reserved Instance provides a capacity reservation in the specified Availability Zone.|
|**Instance size flexibility**|The Reserved Instance discount applies to instance usage within the instance family, regardless of size. Only supported on Amazon Linux/Unix Reserved Instances with default tenancy. For more information, see [Instance size flexibility determined by normalization factor.]( https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/apply_ri.html#ri-normalization-factor)|No instance size flexibility: The Reserved Instance discount applies to instance usage for the specified instance type and size only.|

**➤ Instance size flexibility does not apply to the following Reserved Instances:**
- RIs that are purchased for a specific Availability Zone (zonal Reserved Instances) 
- RIs with dedicated tenancy 
- RIs for Windows Server, Windows Server with SQL Standard, Windows Server with SQL Server Enterprise, Windows Server with SQL Server Web, RHEL, and SUSE Linux Enterprise Server 
- RIs for G4 instances.

**➤ Maximizing Utilization with Size Flexibility in Regional Reserved Instances:**
All Regional Linux RIs with shared tenancy apply to all sizes of instances within an instance family and a Region. The only attributes that must be matched are the instance type (ex. m4), tenancy (must be default), and platform (must be Linux). All new and existing Reserved Instances are sized according to a normalization factor based on instance size, as follows:

![RI 1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7mmmp9be79crxresdeps.png)

**➤ Let’s have some Examples to explain this:**
1-If you have RI for a c4.8xlarge, it applies to any usage of a Linux c4 instance with shared tenancy in region as: 
- One c4.8xlarge instance. 
- Two c4.4xlarge instance.
- Four c4.2xlarge instances. 
- Sixteen c4.large instances.
2-It also includes combinations of instances, a t2.medium has a normalization factor of 2. If you purchase a t2.medium default tenancy Linux/Unix Rin the US East (N. Virginia) Region and you have two running t2.sm.
![RI 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uqggb3w6irex21dst1t5.JPG)
3-If you have one t2.large instance in the US East (N. Virginia), the billing benefit is applied to 50% of the usage instance.
![RI 3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/phlzihk5tpj5y67bp57l.JPG)

_________________________

##➤ Normalization factor for dedicated EC2 instances:
For size inflexible RIs, the normalization factor is always 1. The purpose of it  is to provide an ability to match various instances to each other within a family so that you can exchange one type for another.

**➤ Normalization factor for bare metal instances:**
- For regional Amazon Linux/Unix Reserved Instances with shared tenancy on bare metal instances, you can benefit from the Reserved Instance savings within the same instance family. 
- Also, For regional Amazon Linux/Unix Reserved Instances with shared tenancy on instances in the same family as a bare metal instance. A bare metal instance is the same size as the largest instance within the same family.
![RI 4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/da0d8xr8gpqdp35x03pb.JPG)

Ex, If you purchase an i3.metal default tenancy Linux/Unix RI in the US East (N. Virginia) Region, the billing benefit can apply as follows: 
- If you have one running i3.16xlarge in your account in that Region, the billing benefit is applied in full to the i3.16xlarge instance (i3.16xlarge normalization factor = 128). 
- Or, if you have two running i3.8xlarge instances in your account in that Region, the billing benefit is applied in full to both i3.8xlarge instances (i3.8xlarge normalization factor = 64). 

_________________________________________

##Savings Plans:
- Another flexible pricing model that provides savings of up to `72%` lower prices on instances usage, regardless of instance family, size, OS, tenancy or AWS Region, and also applies to AWS Fargate and Lambda.
- Savings Plans offer significant savings in exchange for a commitment to use a specific amount of compute power (measured in $/hour) for a one or three-year period.

**➤ AWS offers two types of Savings Plans:**
**1-Compute Savings Plans:**
• Provide the most flexibility and help to reduce your costs by up to `66%` regardless of instance family, size, AZ, Region, OS, or tenancy. Ex., you can change from C4 to M5 instances, shift a workload from EU (Ireland) to EU (London), or move a workload from Amazon EC2 to Fargate or Lambda.
**2-EC2 Instance Savings Plans:**
• Offers savings up to `72%` for commitment to usage of individual instance families in a Region (ex. M5 usage in N. Virginia) with the flexibility to change between instances within a family in that Region, ex. you can move from c5.xlarge running Windows to c5.2xlarge running Linux and benefit from the Savings Plans prices.
_________________________________

##Reservation models for other AWS services:

**1-Amazon RDS reserved DB instances:**
- Three payment options: No Upfront, Partial Upfront, and All Upfront. 
- All reserved DB instance types are available for Aurora, MySQL, MariaDB, PostgreSQL, Oracle, and SQL Server database engines. Size-flexible reserved DB instances are available for Amazon Aurora, MariaDB, MySQL, PostgreSQL, and the “Bring Your Own License” (BYOL) edition of the Oracle database engine.
**2-Amazon ElastiCache reserved nodes:**
- Gives you the option to make a low, one-time payment for each cache node. In turn, you receive a significant discount on the hourly charge for that node. 
- Amazon ElastiCache provides three reserved cache node types (Light Utilization, Medium Utilization, and Heavy Utilization) that enable you to balance the amount you pay up front with your effective hourly price. 

**3-Amazon Elasticsearch Service Reserved Instances:**
- ES RIs offer significant discounts, Instances are identical, RIs are just discount applied to On-Demand Instances. 
- Amazon ES RIs require one- or three-year terms and have three payment options that affect the discount rate.

**4- Amazon Redshift reserved nodes:**
- The best choice if you intend to keep an Amazon Redshift cluster running continuously for a prolonged period. 

**5-Amazon DynamoDB reservations:**
- You can pay a one-time upfront fee and commit to paying for a minimum usage level at specific hourly rates for the duration of the reserved capacity term.

_________________________________________

##Reserved Instances Billing: 
- You can pay for your RI upfront, partially upfront, or monthly, depending on the payment option specified.
- When Reserved Instances expire, you are charged On-Demand Instance rate.
- You can set up a billing alert to warn you when your bill exceeds a threshold that you define.

**➤ Usage Billing:**

- Reservations are billed for every clock-hour during the term selected, whether an instance is running or not.
- A Reserved Instance billing benefit can be applied to a running instance on a per-second basis. Per second billing is available for instances using an open-source Linux distribution, such as Amazon Linux and Ubuntu. 
- A RI billing benefit can apply to a max of 3600 sec (one hour) of instance usage per clock-hour. You can run multiple instances concurrently, but can only receive benefit of the RI discount for a total of 3600 seconds per clock-hour.
- Example : if you purchase one m4.xlarge RI and run four m4.xlarge instances concurrently for one hour, one instance is charged at one hour of RI usage and the other three instances are charged at three hours of On-Demand Instance usage.
- However, if you purchase one m4.xlarge RI and run four m4.xlarge instances for 15 minutes (900 seconds) each within the same hour, the total running time for the instances is one hour, which results in one hour of RI usage and 0 hours of On-Demand Instance usage.

![RI 5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ox3bpx0219o6c3dgbnqf.JPG)

**➤ Consolidated Billing:**

- AWS Organizations includes consolidated billing and account management capabilities that enable you to better meet the budgetary, security, and compliance needs of your business.
- The pricing benefits of Reserved Instances are shared when the purchasing account is billed under a consolidated billing payer account. The instance usage across all member accounts is aggregated in the payer account every month.

**1-Reserved Instances:**
- AWS also offers discounted hourly rates in exchange for an upfront fee and term contract. Services such as Amazon EC2 and Amazon RDS use this approach to sell reserved capacity for hourly use of Reserved Instances.
- When you reserve capacity with Reserved Instances, your hourly usage is calculated at a discounted rate for instances of the same usage type in the same Availability Zone (AZ).

**2-Blended rates:**
- A line item for the blended rate of that instance is displayed on the bill of any member account that is running an instance that matches the specifications of a reservation in the organization. 
- The payer of an organization can turn off Reserved Instance sharing for member accounts in that organization via the AWS Billing Preferences. This means that RIs are not shared between that member account and other member accounts.

**How discounts are applied:**
- The application of Amazon EC2 Reserved Instances is based on instance attributes, including the following: 

**1- Instance type:**  Instance types comprise varying combinations of CPU, memory, storage, and networking capacity This gives you the flexibility to choose the mix of resources for your applications.

**2-Platform:** You can purchase RIs running on Linux, Unix, SUSE or Red Hat Linux, Windows Server, or MSSQL Server.

**3-Tenancy:** Reserved Instances can be default tenancy or dedicated tenancy. 

**4- Regional or zonal:** As discussed before.
__________________________________

##Maximizing the value of reservations

**➤ Measure success:**
• Means measuring your reservation coverage and utilization.
• Establish a standardized review cadence in which you focus on the following questions: 
1.Do you need to modify any of our existing reservations to increase utilization? 
2.Are any currently utilized reservations expiring? 
3.Do you need to purchase any reservations to increase your coverage?
**➤ Maximize discounts by standardizing instance type:**
• By standardizing the instance types that your organization uses, you can ensure that deployments match the characteristics of your reservations to maximize your discounts.
• Three services that can help you standardize your instances are:
**1-AWS Config:** to monitors and records your resource config and lets you automate the evaluation of recorded configurations against desired configurations.
**2-AWS Service Catalog:** to create and manage catalogs of IT services that are approved for use on AWS.
**3-AWS Compute Optimizer:** recommends optimal AWS compute resources for your workloads to reduce costs and improve performance by using Machine Learning algorithms to analyze historical utilization metrics.
**➤ Reservation management techniques:**
![RI 6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1bq65rh0i72h33g6ezsa.JPG)

**➤ Reserved Instance Marketplace:**
• supports the sale of third-party and AWS customers' unused Standard RIs, which vary in lengths and pricing options.

**➤ AWS Cost Explorer:**
- lets you visualize, understand, and manage your AWS costs and usage over time.
- Provides the following prebuilt reports:
*1-EC2 RI Utilization %* offers relevant data to identify and act on opportunities to increase your RI usage efficiency.
*2-EC2 RI Coverage %* shows how much of your overall instance usage is covered by Reserved Instances.

**➤ AWS Cost and Usage Report:**
- contains the most comprehensive set of data about your AWS costs and usage, including additional information regarding AWS services, pricing, and reservations.
- It can help you Calculate savings and Track the allocation of Reserved Instance discounts.
![RI 6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/55efkt6xkcg4l60izbrr.JPG)

**➤ AWS Trusted Advisor:**
Online resource to help you reduce cost, increase performance, and improve security by optimizing your AWS environment. AWS Trusted Advisor provides real-time guidance to help you provision your resources following AWS best practices.

___________________________

Original Paper [here](https://d1.awsstatic.com/whitepapers/cost-optimization-reservation-models.pdf?did=wp_card&trk=wp_card).