THE FORECAST. Your best ally to save on your AWS bill

THE FORECAST. Your best ally to save on your AWS bill

As we exploit our infrastructure hosted in the Amazon cloud, our bill also begins to “explode”. This is why at a certain point (or not), it is convenient to start looking for resources so that your bill is not so bulky.

The first step, before anything else, is to be clear about what and how many resources you need for your application and/or infrastructure to have adequate performance and make a forecast about how long you think you will need these resources running at least.

For this estimate, you must have a good knowledge of your architecture and have been working on it for some time, otherwise you will not have enough capacity to predict how your infra will behave in atypical situations.

Let’s get in position. Let’s simulate several ways to save on your EC2 bill.

 

Reserved Instances

It consists of making a forecast of EC2 instances that you will need at least 1 or 3 years from now (it depends on the commitment time you choose).

A good practice would be to play with the equivalence that instance types have in EC2. For example, reserve 2 t3.small for each t3.medium. In this way, all your hardware will be distributed according to the needs of your infrastructure, and if at any time the number or type of instances changes, that reserved hardware will continue to be distributed and used in the most optimal way.

 

What is the prize for making this great foresight and commitment? Well, AWS gives you discounts of at least 25-30% and up to 50-60% on the EC2 bill!

 

The longer your commitment time and the more you pay up front, the bigger the discount.

 

 

Spot requests

These instance types allow you to take advantage of unused EC2 capacity in the AWS cloud. Spot Instances are available at a discount of up to 90% compared to on-demand prices.

Where’s the catch? Although it is hard to believe, they are instances that if AWS needs for another user or purpose, they can be removed instantly with just a 2-minute notice (if you find out, turn off the machines and they won’t be removed 😉 )

This is why it is recommended to use these instances only for container environments, CI/CD, testing… or combine them in an ASG with your on-demand instances.

 

Scheduled Instances

An effective practice if you know how to detect what hours or days of the week your infra processes more load than normal.

It is about programming a number of machines during a specific time. If, for example, there is a time of day where there is more traffic than usual and the rest of the day is much quieter, you could schedule one or two more instances to be added to your ASG.And why is it a good option to save? Because you adjust the number of machines to the maximum based on the needs of the moment, and you never pay for what you don’t use.

 

Saving plans

If you have a more or less large number of instances and you have been with that number for quite some time and you believe that for now it will not vary excessively, personally a Saving Plan is your best option.

What the saving plan basically does is make an analysis of the resources and power that your infra needs (it takes away that work) and proposes savings in exchange for a commitment.

The truth is the most comfortable measure and if you want to spend some time checking for yourself that the prices they offer are realistic, do so and you will see that even if you reserve instances by your own means, the discount they offer is the same or higher.

 

There are 3 types of Saving Plans:

Compute: Provides more flexibility and reduces costs by up to 66%. Based on EC2, AWS Fargate, and AWS Lambda usage, regardless of instance family, size, zone, region, OS, and tenancy
EC2 Instance: Provides the lowest prices and reduces costs by up to 72%, in exchange for the commitment to use individual instance families in a region.
SageMaker: Reduce costs by up to 64% in SageMaker. They are based on the use of SageMaker regardless of instance family, size, component, and AWS Region.

 

To apply a Saving Plan, we select this option:

Once inside, we can choose the time and price ratios that we are willing to pay and see what discount is applied, or click here and see the recommendations that AWS proposes based on the last X days.

 

 

In the recommendations, depending on the commitment time and the upfront, we will see some prices or others.

My personal proposal about

Once you know all these methods, why not combine them?
You can easily combine Spot Instances with On-Demand, Reserved, and Savings Plans instances to further optimize workload cost with performance.

You can also shut down machines while you are not using them or use the Scheduled Instances method.

Other services where reservations are a good ally
In this post, we wanted to emphasize the reservation of instances and the EC2 Saving Plans, but AWS offers many services where, thanks to the forecast of resources that you will need at least in a specific time, you can save yourself a good pinch.

For example, in the DynamoDB service, you can reserve capacity. It works the same as reserving instances, in exchange for a good discount, you can reserve disk capacity for a specific time with different payment formats in advance.

Another example is Opensearch, the SAS of ELK (Elasticsearch, Logstash and Kibana) that incorporates AWS. In this service you can make reservations for instances, but with a very important peculiarity to take into account.

Unlike other reservations, in this service you have to reserve exactly the type and the exact number of instances that your Opensearch uses. Basically, there is no use reserving 2 t3.small instances for one t3.medium to use its resources, for example. If your Opensearch uses 2 Data Nodes t3.medium and 3 Master Nodes m5.large, you must reserve exactly these types and numbers of instances.
I personally recommend it anyway, the savings are very remarkable.

 

Close

As the title of this post indicates, the best option you have to save money in all AWS services where machines are involved is forecasting. If your infrastructure has the expected performance and you know its behavior well, you will know how to forecast the number of instances or resources you need in 1 or 3 years.
It is worth making an effort to analyze your resources and taking a few hours or days looking at your ASG and other services, you can easily reduce 50% on your next bill.

If you want help to carry out these practices, do not hesitate to contact us!
The Geko team has experience in different fields, working with DevOps methodology, accompanying our clients throughout the process from migration to cloud management, and adapting 100% to their infrastructures and technologies.

Leave a Reply

Your email address will not be published. Required fields are marked *