FinOps Decoded: Maximizing Cost Efficiency with AWS Reserved Instances and Savings Plans
Published: 2023-07-26 13:58:33

**Co-author:** @sakshi-2672 

## Introduction
 
Cloud computing has gained significant attention lately, primarily because of its flexibility and ability to scale. To reduce costs on AWS from a rate perspective, two main options available are Savings Plans and Amazon EC2 Reserved Instances (RI). Although both services can be utilized by companies, this article aims to clarify the disparities, benefits, and limitations associated with each, along with providing practical use cases. While choosing the right AWS plan is a difficult decision, Intuitive helps organizations to optimize their costs while taking advantage of the flexibility available when deploying complex applications in the cloud. By understanding these factors, you can make an informed decision to optimize your cloud costs effectively. 

## AWS Reserved Instances 

Reserved Instances (RIs) assist organisations by offering a considerable discount in exchange for a commitment to a specific usage over time, as compared to the standard on-demand computing pricing. Reserved Instance options include a Standard or Convertible RI with a commitment of one or three years, as well as payment options (no upfront, partial upfront, all upfront) 

EC2 RIs provide customers with a significant discount on the hourly rate compared to on-demand instances. By committing to a one- or three-year term, customers can secure a lower cost per hour for their EC2 instances. The discount can vary depending on the RI type, payment option and instance attributes. 

In addition to the discounted rate, EC2 RIs allow customers to reserve capacity for their instances. This means that the capacity required for the reserved instances is guaranteed and available whenever needed, even during peak usage periods. This helps ensure that customers have the necessary resources available for their applications without the risk of instances being unavailable due to capacity constraints. 

With RIs, you have the flexibility to choose the type that is most suitable for your application, within the Region or Zone where it will be used.

**Standard RIs:** These are ideal for steady-state consumption and offer the most discount (up to 72% off On-Demand). 
The capability to modify the size of an EC2 server instance is available, but it is limited to the instance size within the same family. This modification can be performed for Linux EC2 instances exclusively and is not applicable to Windows Server EC2 instances.
_For example_, you can upgrade from an m5.4xlarge to an m5.8xlarge, but transitioning to a different EC2 instance family, such as c5.4xlarge, is not supported. 

**Convertible RIs:** These offer a discount (up to 54% off On-Demand) and the opportunity to modify the RI's characteristics, provided that new Reserved Instances of the same or higher value are created as a result of the exchange. Convertible RIs, like Standard RIs, work best in steady-state applications. 
_For example_, you already have a convertible RI of instance type c5.large, after a while your requirements changes and needs more compute power, then you can modify the type to c5.xlarge or a different instance family altogether, such as an m5.large, as long as the new configuration aligns with the Convertible RI's scope and terms.  
**Note:** The standard Reserved Instances can be listed in RI Market place for reselling.

**Comparing Reserved Instances and On-Demand Pricing**
Let’s consider the instance type as “m5.4xlarge”, which is popular for general purpose workloads. 

| Resource  |  On-Demand Rate per hour  |  Standard Reserved Instance Rate per hour |
|---|---|---|---|---|
| m5.4xlarge   |  $ 0.768  | $ 0.484   |

Reserved Instance rate is for 1-year commitment with no upfront payment.
```
Saving Percentage = ((On-Demand rate – RI rate) / On-Demand rate) * 100 
                  = ((0.768 – 0.484) / (0.768) * 100 = ~37%  
```
By purchasing a 1-year Reserved Instance for the "m5.4xlarge" instance type, you would achieve a savings percentage of 37% compared to using the same instance on-demand. 
```
Monthly charges = Charge rate per hour * Total no. of hours 
                = 0.484 * 730 = $ 353.32  
```
You will be paying this amount $353.32 (~37% discount on $560.64) for the next 12 months whether you run or terminate or stop the EC2 instance considering 100% usage. The savings can only be beneficial if the usage is over 63%. 

**Why are Savings Plans needed?**
A decade after introducing Reserved Instances (RIs), Amazon Web Services (AWS) announced the Savings plan as a more flexible alternative to RIs. AWS Savings Plans are intended to supplement, not replace, Reserved Instances. SPs and RIs have substantial differences that make them more suited to specific applications. Savings Plans are applicable to both EC2 and Fargate instances, whereas RIs are only applicable to EC2 instances. 

## AWS Savings Plans

Savings Plans offer cost savings that go beyond the standard On-Demand rates. To take advantage of these savings, customers commit to a given spending measured per hour, over a period of either one or three years. This discount can amount to 72% off the regular On-Demand price.
 
**AWS Savings Plan Pricing model** 
Savings Plan prices depend on various attributes, including the type of instance, operating system, tenancy, and payment method you choose. 

AWS offers three Savings Plan payment options (no upfront, partial upfront, all upfront) 

**AWS Savings Plan Types**
AWS offers three types of Savings Plans namely, Compute Savings Plans, EC2 Instance Savings Plans, and Amazon SageMaker Savings Plans. 

However, the following two Savings Plans are the most popular for cloud cost optimization. 

**EC2 Savings Plan**
EC2 Savings Plan provides up to 72 percent savings compared to On-demand rates. It is flexible enough to automatically cover the usage regardless of instance size (for example, r5.xlarge, r5.2xlarge, etc.), operating system (for example, Windows, Linux, etc.), and tenancy (Host, Dedicated, Default) within the specified family in a Region.  

**Note:** While with convertible RIs, you manually need to perform changes across instance families, sizes, operating system, and tenancy to adjust your requirements. 

_For example_, Consider the pricing example of the following resources. The example assumes region as us-east-1, one year commitment duration and partial upfront payment.   

You purchase a one year, partial upfront, EC2 Savings plan with $ 5/hr commitment.

| Resource | On-Demand Rate per hour | EC2 Instance Savings Plan rate per hour | Savings over on demand (100% usage)  |
|---|---|---|---|---|
| r5.2xlarge  | $ 0.504 | $ 0.302 | 40% |
| r5.8xlarge  | $ 2.016  | $ 1.27 | 37% |

**Requirement:** The required usage in a single hour is 3 * r5.2xlarge and 4 * r5.8xlarge. 

As the saving of r5.2xlarge is higher than r5.8xlarge instances, we first consider cost incurred by r5.2xlarge to be covered in EC2 Savings plan, your savings plan covers 3 units of r5.2xlarge instances.

```
Cost => (Required units of r5.2xlarge) * (SP rate of r5.2xlarge)   
     => 3 * 0.302  
     => $ 0.906 
```
Further, 3.223 units (calculation as shown below) of r5.8xlarge will be charged according to the Savings plan rate

![Calculation:1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/117d3elemkdakh6prioi.png)

**`Remaining Commitment => $ 5 - $ 0.906 - $ 3.223 = $ 0`**
We can note that after the consumption of 3.223 units, the savings plan commitment is exhausted. Further the 0.777 units of r5.8xlarge will be charged on-demand

```
Cost => (Required units of r5.8xlarge) * (On-demand rate of r5.8xlarge)  
         => 0.777 * 2.016 
         => $ 1.5664

Total Cost => $ 0.906 + $ 4.0932 + $ 1.5664 
                  => $ 6.5656
```

**Compute Savings Plan**
This plan provides flexible options with a discount level of 66%. It allows choices across instance family, region, OS, tenancy, and compute service (e.g., EC2 to Fargate). You can transfer discounts between different instances. Compute Savings Plans reduce waste and apply to EC2, Lambda, and Fargate usage. 

_For example_, Consider the pricing example of the following resources. The example assumes region as us-east-1, one year commitment duration and partial upfront payment. 
Suppose you purchase a one year, partial upfront, Compute Savings Plan with $13.488/hr commitment. 

| Resource | On-Demand Rate per hour | Compute Savings Plan Rate per hour | Savings over On-Demand (100% usage) |
|---|---|---|---|
| d2.xlarge | $ 0.69 | $ 0.396 | 43% |
| Fargate per GB per hour | $ 0.0044 | $ 0.0033 | 25% |
| Fargate per vCPU per hour | $ 0.040 | $ 0.030 | 25% |
| g3s.xlarge | $ 0.75 | $ 0.604 | 19% |

**Requirement:** The required usage in a single hour is 3 * d2.xlarge, 300 vCPU 1000 GB of Fargate and 3 * g3s.xlarge

As d2.xlarge has the highest savings percentage, let’s start to calculate and check if it can be covered by savings plan commitment.

```
Cost => (Required units of d2.xlarge) * (SP rate for d2.xlarge)
     => 3 * 0.396 
     => $ 1.188
```
**`Remaining Commitment => $ 13.488 - $ 1.188 = $ 12.3`**
Now, the next highest saving is in Fargate and the cost for Fargate GB will be considered first. The cost incurred by Fargate is as follows.

```
Cost => (Required Fargate GB/hour) * (SP rate for Fargate GB/hr)
     => 1000 * 0.0033 
     => $ 3.3

Cost => (Required Fargate vCPU/hour) * (SP rate for Fargate vCPU/hr)
     => 300 * 0.030
     => $ 9
```
**`Remaining Commitment => $ 12.3 - $ 3.3 - $ 9 = $ 0`**
We can note that after the consumption of Fargate cost, the savings plan commitment is exhausted. Further the 3 units of g3s.xlarge will be charged on-demand.

```
Cost => (Required units of g3s.xlarge) * (On-demand rate for g3s.xlarge)
     => 3 * 0.75
     => $ 2.25
 
Total Cost  => $ 1.188 + $ 3.3 + $ 9 + $ 2.25 
            => $15.738
```

### **Example for Savings Plan and EC2 Reserved Instance combined usage**
Consider the pricing example of the following resources. The example assumes region as us-east-1, one year commitment duration and partial upfront payment. 
Suppose you purchase a one year, partial upfront, Compute Savings Plan with $ 18/hr commitment and 3 EC2 Reserved Instance of c5n.xlarge Linux shared tenancy in us-east-1.

| Resource | On-Demand Rate | Compute Savings Plan Rates | Savings over On-Demand (100% usage) |
|---|---|---|---|
| c5n.xlarge | $ 0.216 | $ 0.149 | 31% |   
| Fargate per GB per hour | $ 0.0044 | $ 0.0033 | 25% |   
| Fargate per vCPU per hour | $ 0.040 | $ 0.030 | 25% |   
| g3s.xlarge | $ 0.75 | $ 0.604 | 19% |

**Note:** Reserved Instance rate for  c5n.xlarge is $ 0.130

**Requirement:** Let’s assume we need in a single hour 4 * c5n.xlarge, 400 vCPU 1200 GB of Fargate and 5 * g3s.xlarge.
Let us start by utilizing the 3 EC2 reserved instances for c5n.xlarge

```
Cost => (Total units of Reserved Instances) * (Reserved Instance rate for c5n.xlarge)
     => 3 * 0.130
     => $ 0.390
```
Now for another 1 unit of c5n.xlarge, we consider the savings plan commitment according to the highest savings percentage.

```
Cost => (1 unit of c5n.xlarge) * (SP rate for c5n.xlarge)
     => 1 * 0.149
     => $ 0.149
```
**`Remaining Commitment => $ 18 - $ 0.149 = $ 17.851`**
The next highest saving percentage is for Fargate and the cost for Fargate GB will be considered first. The cost incurred by Fargate is as follows.

```
Cost => (Required Fargate GB/hour) * (SP rate for Fargate GB/hr)
     => 1200 * 0.0033 
     => $ 3.96

Cost => (Required Fargate vCPU/hour) * (SP rate for Fargate vCPU/hr)
     => 400 * 0.030
     => $ 12
```
**`Remaining Commitment => $ 17.851 - $ 3.96 - $ 12 = $ 1.891`**
Further 3.1308 unit of g3s.xlarge (as shown in the calculation below) is covered in the compute savings plan and the hourly commitment of $18 is exhausted and the remaining 1.8692 units g3s.xlarge are charged with On-Demand rates.


![Calculation 2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v3exc7rtkubqynuwco9p.png)

```
Cost => 3.1308 * (g3s.xlarge compute SP rate) + 1.8692 * (g3s.xlarge on-demand rate)
     => 3.1308 * (0.604) + 1.8692 * (0.75)
     => 1.891 + 1.4019
     => $ 3.292

Total cost => $ 0.390 + $ 0.149 + $ 3.96 + $ 12 + $ 3.292
           => $ 19.7919
```
**How Savings plan differ from Reserved Instances?**
Savings Plans and Reserved Instances differ in flexibility because Reserved Instances are based on a commitment to utilising an instance at a specified price over a specific term, whereas Savings Plans are based on a commitment to spend a specific dollar amount per hour over a specific period.

![Graph](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/72387hga4m0zptcj5to9.png)

## Conclusion
AWS Reserved Instances and Savings Plans provide cost-effective solutions for businesses in the cloud. By committing to specific usage and payment terms, organizations can achieve substantial cost savings and predictable pricing. These flexible options allow businesses to optimize their AWS expenses and maximize their return on investment.