It’s no secret that costs in AWS Cloud can quickly spiral out of control without proper management. For many businesses, neglecting AWS cost optimization can lead to unnecessary expenses — or even humorous yet painful scenarios like the one in this meme.
In this article, we’ll share practical strategies to optimize your AWS costs and provide a real-world example of how these strategies have been successfully implemented.
Reserved Instances
Reserved Instances are ones of the best options when it comes to saving money. Reserved Instances are divided on two types (more information – review AWS official documentation).
A) Standard RIs
You can get up to 72% off if we compare to regular On-Demand instances.
It allows you to run different instance types within the same Instance family (by purchasing 10 c6g.xlarge instances, you can also run 20 c6g.large instances).
B) Convertible RIs
Although a smaller reduction (up to 54%) is anticipated, more features are added.
Any instance type, family, etc. can be changed at any time.
All of these significant savings are available if you pay for three years at once, but in reality, most customers prefer the No Upfront plan, which offers a ±30% reduction and no upfront payments.
I’ll give you an example of the US-east-1 region’s c6a.xlarge instance. Here are the pricing for comparison (I’ve included the percentage of the on-demand price in the image):
On-demand price: 0,153$/h;
Spot price: 0,076$/h.
So, by choosing at least 12 months, Standard class, with No Upfront plan, we will get $0.101/h, which is a 34% discount compared to the On-Demand price. But note that by choosing a Spot, you get an even bigger discount of 50% (we’ll talk about spots a little later).
Additional recommendations:
1. Count all the on-demand instances and their types that you use in each region. This will help you understand which RIs you need to buy.
2. Decide on the instance family (c5, c6, r6i…) that you use (for example, c6a.xlarge and c6a.4xlarge are the same family).
3. Sell the RIs if you don’t need them.
4. It’s better to have eight c6a.large than one 4xlarge (you’ll sell it faster).
5. Actively monitor the Reservations utilization report in Billing and Cost Management.
Savings Plans
Reserved instances and savings plans are comparable, with the exception that a plan purchased for a year cannot be sold. There are two varieties as well.
A) Calculate Plans for Savings
- Up to 66% discount is possible (again, depending on various conditions).
- Enables you to use any EC2 instance, irrespective of instance type or region.
- They present themselves as having the most freedom possible.
- The amount paid is $/h.
B) Plans for Saving EC2 Instances
- Savings of up to 72 percent.
- They belong to a particular instance family in a particular area (you know, it’s called Reserved Instances).
- Marketed as a stable load solution.
- The first type, compute, is unclear, but the second type is quite obvious (though I’ll offer an example nevertheless).
- To clarify a bit, we need to open Billing and Cost Management -> Savings Plans -> Recommendations and see what Amazon recommends.
Gart’s decision:
In this case, we chose Convertible RIs and got ± the same discounts, with the ability to be flexible and sell at any time.
2. Spot Instances
Spot Instances are the juice, the cheapest, you don’t need to buy anything, you pay only for actual use, just like on-demand (but yes, with some restrictions).
Here are the key features compared to on-demand (taken from the official AWS documentation):
If we take the same c6a.xlarge instance in the us-east-1 region as a basis, we see that a 45-50% discount is offered:
Advantages:
- Big savings. Low prices that allow you to significantly reduce the cost of instances (they promise discounts of up to 90%, Ris and Saving plans are far from such indicators).
- Flexibility. Ideal for stateless and non-critical applications that can be interrupted and resumed without significant impact on the workflow.
Disadvantages:
- Unpredictability – due to the possibility of instance termination, you need to be ready for a termination at any time.
- Lacks in service coverage – insufficient number of instance types in a particular availability zone (more info).
What can be done to protect yourself from unexpected terminations?
Register several type instances in the ASG (c5.xlarge, c5a.xlarge, c5d.xlarge). This is done in case Amazon runs out of one type. Then ASG will be able to raise an instance with another type.
Install the AWS Node Termination Handler, which monitors the status of nodes and launches a drain node that will be deleted soon so that the nodes can complete their work properly.
If you have Karpenter, then you don’t need to do anything at all, it controls it (if you have configured everything correctly).
Tools for optimizing budgets in AWS
There are many of them: Cost Explorer, Budgets, Trusted Advisor, Compute Optimizer, Pricing Calculator, Cost Anomaly Detection, Service Catalog.
1. AWS Cost Explorer (cost analysis and visualization):
- Visualizes costs through graphs and reports by various criteria: services, accounts, regions.
- Analyzes cost changes over time to understand the dynamics of resource utilization.
- Predicts future costs based on current data.
2. AWS Budgets (allows you to create and manage budgets):
- Allows you to set up budgets for different categories, such as general expenses, expenses for specific services, or projects.
- Sends notifications when expenses are approaching the set limits.
- Monitors actual resource usage and compares it to budgets to identify possible cost overruns.
3. AWS Trusted Advisor (recommendations for improving resource utilization, performance, and security):
- Provides recommendations for optimizing costs, such as using Reserved Instances or Spot Instances.
- Offers advice on how to improve infrastructure performance.
- Provides recommendations to improve resource security and ensure system uptime.
- Monitors service utilization and warns you when you are approaching the set limits.
4. AWS Compute Optimizer
Resource utilization analysis and optimization recommendations:
- Recommends the best instance types based on their performance.
- Identifies underutilized resources that can be reduced or removed to reduce costs.
- Analyzes resource performance and suggests ways to improve it.
Gart’s Experience:
Cost Explorer is usually enough to look at costs, analyze recommendations, and make assumptions about how to optimize the infrastructure to save costs. We also look at the Total projected cost for the current month to react on time when something is going wrong.
Struggling with AWS costs? Gart Solutions is here to help you identify and address potential issues before they escalate.
Let us optimize your cloud infrastructure and save you money without compromising performance.
Schedule your consultation and start reducing your cloud expenses now!
Tips for optimizing costs in AWS
We will try to give you real-world advices from the experience of Gart Solutions that we think will be more useful, than general advices.
– AWS cost dashboard is a very helpful tool, which allows us to visually see the costs of resources and find the ones that cost the most, for example:
- Top ten S3 packages for the last two months
- What exactly do we pay for in Data Transfer
- What family instances did we pay for three months ago:
- Etc.
– Think about cost-optimization at the beginning of your infrastructure creation, it will help you save a lot of time in the future.
– CloudWatch can cost a lot more than you expect, especially when you have auditing, access logs, and many metrics enabled.
– If possible, create VPC Private Links, sometimes this can save a lot of money on intra-region traffic. Especially when you have ElasticSearch and you backup to S3, which is in the same region.
– If you can scale down non-production environments during off-hours, do it.
– Sometimes it doesn’t make sense to keep large instance type databases on non-products because they don’t have the same load as sales.
– If you need to write a support ticket, you can always change the support plan to the one you need, and not pay for it for months for nothing.
– Use Lifecycle Rules everywhere – S3, ECR, Snapshots, etc. – to control the number of resources and not pay for those that are no longer relevant.
– Old and unnecessary KMS keys waste money (it’s noticeable when you have a lot of them). Sometimes it’s scary to delete them because it turns out that some resource is using them (and you can’t quickly check which keys are used and which are not).
– Analyze different instance types, sometimes you can get more Memory for the same money (or even cheaper).
– Check the Spot price in each AZ, sometimes it is more profitable to take RIs.
– Requests/Limits of applications in kubernetes may be inadequate. Analyze metrics, sometimes it can reduce the number of worker nodes by several times.
– If you’re looking for a useful tool to explore cost-effective compute resources tailored to project-specific criteria, you might find this helpful: https://compute-cost.com
And the main to remember – no matter how much you do cost optimization, the client will still come and ask you to save more money. 😄
Conclusion
AWS cost optimization is not a one-time activity but a continuous process requiring diligence, strategic planning, and adaptability. Whether you rely on Reserved Instances, Savings Plans, or Spot Instances, the key is finding the perfect equilibrium between cost efficiency and maintaining the reliability and performance of your infrastructure.
Each project presents its own challenges and requirements, which means the approach to optimization must be tailored accordingly. By leveraging the strategies and insights shared in this article, you can achieve substantial cost reductions while improving the overall efficiency of your AWS environment (or, Contact Us for an AWS Costs Optimization Audit).
It’s important to remember that even small adjustments can lead to significant savings over time. Regularly revisiting your AWS configuration, monitoring resource usage, and applying incremental improvements can make a notable difference in your monthly AWS bill.
That said, optimization is an ongoing journey, and the suggestions provided here are based on experience and proven methods. They are not universal solutions and may need to be adapted to suit the unique needs of your project.
Contact Gart Solutions for AWS cloud cost optimization.