Cloud Cost Optimization: save money in AWS and Azure

Cloud cost optimization, how to reduce your AWS and Azure billes

Share This Post

When you hear about the cloud, you often hear about how convenient it is. Yet, when you go try it yourself you may find it more expensive than traditional hosting. How come is that? Well, probably you don’t know about cloud cost optimization. With that, you can significantly save up to 70%, without changing your architecture.

Better yet, this is available in all cloud providers – from AWS to Alibaba, and the concept is always the same. In this post, we are going to see how to put this in use in the major providers: AWS and Azure.

Cloud Cost Optimization

What is cloud cost optimization?

The problem…

Cloud cost optimization simply means finding a way to save money in the cloud, without changing architecture. In other words, if you had two virtual machines running but you figure out you need just one and shut down the other, that’s not cloud cost optimization. That is just common sense.

Instead, with cloud cost optimization, you keep both machines exactly as they are, yet you start spending less – much less. And that’s not a trick, something for new or old users. It is something available for everyone that cloud providers encourage.

How is it possible that you have the same resources and spend less? The reason lies in the concept of Pay-per-use of the cloud. Normally, you pay exactly for what you use. This means that if your virtual machine runs for 8 minutes, you pay only for 8 minutes. Instead, traditional providers allow you to go on a month-by-month basis. You simply can’t have a VM for less than 1 month.

This flexibility is amazing. In fact, you can use a massive VM for just a couple of hours to do some computing tasks that you needed done. Once you finish, you can destroy the machine. Yet, it comes at a cost. That cost is worth paying if you want the flexibility, but what if you don’t?

…and the solution

Most applications don’t need that flexibility. They need to be running 24/7 (for example, a website). So, you pay for something you are not going to use.

With cost optimization, you commit upfront. You say to your provider you need that virtual machine for – say – 1 year, and you get a huge discount for that. You can either prepay it upfront or pay it in monthly charges.

Cloud cost optimization is saving money by committing to use some cloud resources for a longer period (1-3 years).

Combine flexibility and commitment

You don’t need to use just one model in the cloud. You can use both, and get the best out of them. This is what I call combining flexibility and commitment.

Your company will have most of its services running all the time. For example, it might have an e-commerce website that needs to be always on. However, there are some resources that may be used only once in a while. For example, additional servers for your application during peak hours, or a backup task that runs periodically.

You can use cloud cost optimization to increase your commitment to the resources you need all the time. For the rest, the things you use occasionally, you can go with the normal pricing.

Optimizing costs is abstract

Imagine you have 11 virtual machines, 10 to run your big e-commerce website, and 1 to run backup tasks once a month. As I said previously, probably the thing that makes more sense here is to optimize the costs only for the first 10.

Yet, remember that cloud cost optimization is abstract. It is just something at a commercial level and has nothing to do with the implementation.

Thus, you don’t commit to a given virtual machine. You don’t say to your provider “I want to commit to paying upfront for machine XXX”. Not at all. Instead, you say to your provider “I want to commit to paying upfront for a machine of type YYY”.

Once you do that, the provider will check month per month which types of machines you have, and compare that to the types you have purchased for cloud optimization. If there is a match, the provider will automatically use the prepaid credit. If there is no match, the machine will be paid normally.

So, returning in the example above, you can commit using 10 machines with 2 vCores and 4GB of RAM each.

AWS Cloud Cost Optimization

If you are with AWS, start by logging in the console.

AWS – like its competitor – will notify you with “recommendations” if there are places where you can save some money. For example, if you are running all the time a VM and paying it on-demand, you will get a recommendation.

Once you log in, you will see the dashboard that allows you to enter a specific AWS product. Search for AWS Cost Explorer and hit Enter. Once in there, you will have a list of options in the menu on the left. From there, you need to select Purchase Saving Plans in the Saving Plans section.

AWS Cost Explorer is the tool in AWS where you can perform cloud cost optimization through saving plans: click on Purchase Saving Plans
use the menu on the left to purchase a saving plan.

Once there, AWS offers you two options. You can either go with a Compute Saving Plan or with an EC2 Instance Saving Plan. The first gives you more flexibility, without sacrificing the savings. Yet, starting from the second is easier to understand.

EC2 Instance Saving Plan

With this approach, you decide how much you want to commit (in terms of cost) on a machine type.

AWS Saving Plans and EC2 Instance Saving Plan settings for cloud cost optimization
An AWS EC2 Instance Saving Plan.

In this example, we are committing to spend $87.60 on any instance of type “a1” in the region “US East (N. Virginia)”. We will pay the full amount upfront.

By doing so, when we have a machine of that type in that region, instead of having additional charges, the amount due will be taken from this pre-paid credit. But that’s not really an advantage. The advantage is that you will not pay with the on-demand price. Instead, you will pay with the 1-year committed price until you finish the credit.

How much does my actual instance cost with that pricing? It depends on your instance, but you can check the details on this full price list. This is the official AWS document showing you the hourly cost if you are on-demand and the one if you commit for 1 or 3 years.

Compute Savings Plans

This approach is almost identical to the one described above. Except, it does not apply to a specific resource type. It applies to any resource type within EC2 (Virtual machines) and Fargate (containers).

Compute Saving Plans are the most flexible way to optimize the costs in AWS
A Compute Saving Plan.

The good thing about this is that you will pay all your EC2 and Fargate resources with the 1-year committed rate until the credit of $87.60 runs out. Simple as that.

Of course, when you are ready to buy go on with Add to cart.

Azure Cloud Cost Optimization

Azure is a little more straightforward for cloud cost optimization. Yet, the concept is similar and the potential savings are still amazing. Thus, we can start by accessing the Azure Portal.

In the portal, search for Cost Management. In this tool, you will have a page that allows you to see the recommendations. Azure will tell you where and how you can save some money.

Azure Cost Management allows you to optimize your cloud costs, just view the reccomendations as highlighted
Azure Cost Management page, click on View recommendations.

This will bring you to a page where you see all the recommendations. Each recommendation is simply a virtual machine that you are using a lot and paying on-demand. You can select each and you can decide how long to commit: 1 or 3 years, and thus saving.

At first, it seems like Azure does not have the same flexibility as AWS. However, you are free to convert an optimization on a resource type to another one in the future, should you need to. So, effectively, you have the same flexibility as in AWS.

Wrapping it up

Cloud is a tool and you need to use it wisely. Thus, if you already know you are going to use some resources for a long time, optimize your costs. This will make you leverage the advantages of the cloud at a lower price!

The key idea that you must take with you today is that cost optimization is something abstract. It is only about billing, and not about infrastructure and design. Thus, apply it freely whenever you can!

Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded with the same principle: I share what I learn so that you get value from it faster than I did.
Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded with the same principle: I share what I learn so that you get value from it faster than I did.

Join the Newsletter to Get Ahead

Revolutionary tips to get ahead with technology directly in your Inbox.

Alessandro Maggio