Evaluating and Controlling Cloud Costs
I’ll tell you everything you need to know about controlling costs in the cloud. Cloud computing is a magical place where you can provision resources with a few clicks. And you can scale your apps automatically to serve millions of users. While this ease of use is great, it can be difficult to predict and control costs in the cloud.
Here’s an example:
I once worked on a simple app with a database deployed in the cloud. The database was pretty large, and I left all the default database settings in place. At the end of the month, the company faced a very large and unexpected cloud bill. Because the database made backups of itself this took up a lot of data, which cost a lot of money.
So in this post, you’ll learn to prevent costs like these. We’ll take a look at what kind of things cost money in the cloud. How to measure them, and how to control them. Let’s do it.
The Importance of Managing Cloud Costs
Let’s take a moment to discuss why it is important to manage the costs of your cloud deployments.
Before cloud computing, when you were running your applications in your data centers or somewhere else. You usually bought your servers and storage, or you would render servers per month or year, and those were most of the hosting costs you made.
If you owned the hardware, you could depreciate it over time and plan and budget for new hardware. This is a predictable cost model. And when applications run in the cloud, costs are less predictable.
Developers and infrastructure engineers can easily spin up new services in the cloud. Which is great for them but costs money. And services can scale endlessly, which is incredible but also costs money.
The cloud offers new usage models that were impossible before. And because of that, our old way of thinking about costs isn’t working for the cloud. But many companies still operate with the same assumptions of cost predictability. And don’t have a strategy in place to monitor and control cloud costs. Which can lead to horrible surprises at the end of the month.
The Things That Cost Money in the Cloud
Let’s explore things that cost money in the cloud.
Cloud Services Costs
The most obvious things that cost money in the cloud are the services that you use. For instance, you can run a virtual machine or cluster of containers in the cloud. This costs money and costs you whenever these are running.
So when a virtual machine is running all day and all night. You’ll pay for it all day and all night. The usage of the service is not the only thing that determines its costs.
The service tier, or size and power of the service. also determines costs. Again, let’s take a virtual machine as an example.
If you run a virtual machine with 1 GB of internal memory and 2 slow CPUs, you pay less for it than for a VM with 32 GB of memory 16 super fast CPU cores, and a fast graphics processor. You pay for usage and power.
On top of that, you also pay for additional features like high availability. Some cloud providers let you choose an availability tier when they guarantee that VM is.
Let’s, say, 99.999% of the time up and running, which costs more than a promised availability of 99.9%, which you might use for less‑critical workloads.
Cloud providers offer hundreds of services, each with its characteristics, service tiers, and optional features.
Some of these are services you pay for the whole time when they exist, as a VM, and others are serverless. Which you only pay for when you use them.
In any case, the services you use make up the biggest part of your cloud costs. But there’s more.
DATA Storage Cost int the cloud
The cost of enterprise cloud data storage can vary greatly dependent on particular use cases. The Key cost elements Are :
1- You probably have massive amounts of data that you need to store and organize. And that you want to get value from, so you store it in the cloud and you pay for that.
2- You might store data in the cloud to share it within your organization or with external parties. Or to use it with your applications.
3- You pay for the amount of data that your store, which is relatively cheap in comparison to what the services in the cloud cost.
4- the cloud has multiple copies of your data because you want to replicate your data. You probably store data in the cloud to keep your data safe. This happens automatically in most cloud providers
This safety costs money. You pay for the replication service and the extra copies, and on top of that, you can often choose the performance tier of the storage space in the cloud.
This determines how fast you can read and write data. Which allows you to choose a slow performance tier for data that you archive and a fast tier for data that you actively use.
Higher storage performance is more expensive than lower storage performance. So services that you use in the cloud cost money and storage does too.
Network Traffic Costs
Another thing that you pay for is network traffic. That is data that goes in and out of the datacenters of your cloud provider. Cloud providers pay for their internet connections, and so they charge those costs back to the customer, as we, the customers, determine how high their internet traffic is by uploading and downloading data from the cloud.
Network traffic consists of traffic that goes into the cloud data centers, which is called ingress. And traffic that flows out of cloud data centers, which is called egress.
Cloud providers typically only charge for egress, so data flowing out of their data centers. Which can also include data flowing out of one data center to another.
Sometimes you also use egress when you use a VPN or other cloud service to connect the clouds to your on‑premises environment. Although some of these hybrid services include network traffic in their price.
You typically pay network traffic per gigabyte used per month, and this can become a significant part of your costs.
Software Licenses Costs
On top of services, storage, and network traffic, you also pay for software licenses in the cloud. Some licenses are included in the price of the cloud service. Like the license for Windows Server in a virtual machine in the cloud.
And other licenses are ones you pay for per application, per CPU core, or user. For instance, a license for Exchange Online, which is an email service. Or a license for a CRM system in the cloud.
Licenses can become a large portion of your costs. Especially if they are user-based and you have a lot of users.
And finally, you also pay for training. The cloud requires new ways of thinking, new ways of programming, deploying, and managing infrastructure. Your people need to learn how to use the cloud and need to keep up with these changes. This includes your engineers and your business users that use cloud applications.
Most cloud providers are constantly introducing new services and features, and your people need to know how to use them. This requires an investment in continuous training, which is not as simple as just providing a budget per employee.
Training requires time, which you need to provide, and resources, like Pluralsight subscriptions, books, classroom training, and access to technical conferences.
So that’s it. These are the major things that cost money in the cloud:
- The cloud services you use and their service tiers and additional features.
- The amount and type of storage that you use.
- The amount of network traffic that you use.
- Licenses that your applications or users require.
- Training to enable your people to work effectively in the cloud.
Evaluate Costs by Measuring Usage
The first thing to manage your cloud costs is to find out what you are using and what that costs. This used to be difficult as invoices and users reports from cloud providers were complicated and contained confusing terms for line items.
It was almost like they didn’t want us to know what we were spending. But now all major cloud providers have tools that you can access for free to measure and analyze usage costs.
You can use the cost management tool of Microsoft Azure, to see which types of costs you are making and analyze those in different views.
And also create budgets, set limits, and more, like measure and estimate costs in all of the major cloud providers in a similar way.
On AWS, you would use the cost estimator tool, and on the Google Cloud Platform, you would use Google cloud cost management or be Orbitera tool.
There are also third-party tools for measuring usage and analyzing costs. You use these when you use multiple clouds and want to have an overview of all your costs in one place.
Also, cloud providers are starting to enable you to show costs from other clouds in their cost management tools so that you don’t need third-party tools anymore.
So now that you know how much you use and what it costs. Let’s take a look at ways to control and reduce your costs.
Control Costs by Making Them Visible
Here are the first things that you can do to control your cloud costs:
Create a cost‑aware culture
Let’s discuss these. Now obviously, you need to know what the cloud costs your company. But if you are the only one who knows this.
Then you are the only one that worries about controlling the costs. Controlling costs in the cloud is a group effort. Everybody needs to work on it. And to do so, everybody needs to be aware of the costs.
If a developer knows that a database she spins up costs $5 an hour, she might try her database script on her local computer first.
And when an ITOps person can see that a virtual machine costs $10 per hour, he will be more motivated to delete it when he doesn’t need it anymore.
So when people are aware of the costs, that is are aware of the consequences. They will treat the resources they use differently and become better at controlling costs.
One way for people to become aware of the costs is to have them create an inventory of all the cloud resources that are active and that they use.
This creates awareness that things cost money in the cloud and that you can’t just spin up services and leave them up and running.
Also, provide everybody access to the cost analysis tool in your cloud provider. Transparency is key here.
I’ve seen it many times when people get access to cost data, they start to optimize for costs and try to minimize them. It becomes a goal to them to minimize costs, and that’s what you want to achieve, a cost‑aware culture.
Categorize and separate resources
So when you have an overview of all the resources that you use in the cloud, you should categorize them.
You can do that in groups or with tags or in subscriptions. You can use this classification to analyze your costs in more detail. For instance, only when you’ve identified and tagged all the resources and services that make up your development environment, do you know what that environment costs. And that can inform decisions, like if and when you want to create additional environments.
Or it can inform you that having duplicates of all the services for a certain environment to increase the availability of your solution costs too much for the value that it provides.
Now another practice that you can use to get more control over your costs is to separate services in different subscriptions, for instance by creating a separate cloud subscription for all your production resources.
This makes it much easier to know what the production environment costs and results in invoices for only that environment.
Create alerts and notifications.
So we’ve talked about creating a cost‑aware culture and about categorizing and separating resources.
Once you know about your cloud resources and know to which environment and solution or team they belong, you can create alerts and notifications.
These can help you proactively take action to control cloud costs. For instance, when you have a serverless application running that you only pay for when it is used. You want to receive an alert when it is being used a lot and that it is going to cost you a lot.
Another example is that when the total cost of an environment, like the development environment, exceeds a certain number, you want to receive an alert.
You can create cost alerts and notifications in all major cloud platforms, and it is usually part of their cost management tool. Usually, you can create simple or complex rules that fire an alert when they are met.
Use the Right Resource Tiers to Control Costs
Scaling: Effective ways to minimize cloud costs
The cloud is elastic, and that means that you can scale services up when you need more power to crunch big calculations or serve more users.
Scaling up is when you increase the power of your service. Usually by increasing the amount of memory, CPU, and disk and network speed. In the cloud, you can scale up by choosing a higher service tier.
You can also scale out by adding more instances of your service, like more web servers to handle users. You can configure scaling up and out to happen automatically when you need it and on a schedule.
Now, switching to a higher service tier or adding more instances costs money. But the funny thing is that you can also scale down and in to save money.
For instance, when you run a website in the cloud, you can have the webserver and possibly the database scale down to a lower service tier or fewer instances when it’s not busy. Maybe that’s the case on the weekend or in the evening. Or maybe you can automate it by monitoring the CPU utilization and scale based on that.
Automatically scaling down and in can save you a lot of money and is one of the key benefits of running your app in the cloud.
Switching services off when not in use to save cloud costs
Now besides automatic scaling, you can also shut certain services down to save costs, like a virtual machine when nobody is using it.
Most cloud providers offer scheduler services that automatically start and stop virtual machines and container services on a schedule. This can save a lot of money.
Besides dynamically reducing costs by scaling and shutting down services. You can also save by taking inventory of your service tier usage. Check which service tiers you are using and if you need them.
Taking inventory of your service tier usage
Most higher service tiers offer higher performance and also additional features, so check if you need those features and check if you are using the performance.
And when you start a new project, you can do resource capacity planning for the performance load that you are expecting and plan your service tiers based on that.
Resource capacity planning involves things like thinking about how much storage you need and how much concurrent users your application will serve.
This is not an exact science, and there is no real way to get it right. but it will steer you in the right direction.
And you can use this direction to create the minimum resource configuration that you need and scale up and out when the load increases.
Finally, you can control your storage costs by planning your storage performance and redundancy needs. Not all data needs to be stored in high-performance storage and not all data is that important that it needs to be replicated six times across the world.
Take some time to categorize your data think about how you use it and choose the appropriate storage tier for it.
Create Policies and Budgets to Control Costs
Earlier, we talked about creating a cost‑aware culture where people are aware of what things cost in the cloud. and that this awareness makes them spend less. This is a great practice, but we can do more to control costs.
Create Policies to Control cloud Costs
All major cloud providers enable you to create policies. These are rules that enforce or restrict behavior.
For instance, you can create a policy that only allows certain people to create new cloud resources in a certain subscription or resource group. Or you can whitelist certain virtual machine service tiers to be used.
This way, you can make sure that nobody creates a massive GPU‑powered supercomputer that will drain your bank account in days.
Create Budgets to Control cloud Costs
Another way to have more control over your costs is to create budget limitations. All cloud providers enable you to create a budget for a resource container or a subscription.
This is a certain amount of money that can be spent by resources in that scope in a certain amount of time, like a month, and you can control what happens when that money is spent.
You can stop services from running, like shut down virtual machines or send alerts and prevent new services from being created.
Policies and budgets are great tools to further control costs. Without having to rely on the good intentions of the people that use the cloud.
Clean up to Control Costs
Now, an obvious way to save on costs is to delete resources that you don’t need. This sounds easier than it is. Earlier we spoke about taking inventory of all the services that you have, which provides an overview of the resources and costs.
But now you need to figure out which resources you don’t need anymore. For some resources, this will be obvious but for others, not so much.
It could be that somebody created a web server at some point and that that person doesn’t work at your company anymore. Now, nobody knows why the server was created and if it is still used by any of the hundreds of processes that you run in your applications.
One way to figure out if something is being used is to look at its resource utilization. Often you can see the amount of CPU and memory being used or the number of network connections to a service. This will provide clues, but it’s not always accurate.
It could be that the server is only used once a month and that you can’t see that clearly in the utilization charts. If you have no way to find out if you can remove the service, try to stop the service or cut it off from the network and just see what happens. Monitor the rest of your processes to see if anything fails.
This is a crude method, but sometimes the last resort. All of this teaches us that you should keep a detailed list of all your cloud resources and what they are used for.
Removing unused services should be something you do regularly. You can do that manually, or you can automate it in your cloud with scripts and automation tools.
Use Discounts to Control Costs
We’ve seen a lot of powerful cost control methods so far. Now here’s one that is often overlooked: using discounts. Most cloud providers offer discounts when you prepay your monthly bill, and you can also commit to spending a certain amount in their cloud in a certain period, like in a year. You can also get a discount by buying certain types of subscriptions with conditions and limitations.
These discounts can add up. Some add up to 40% of your entire cloud costs. If you are not getting a discount now, look into it. Other discounts can be gained by using reserved resources, like a reserved VM. You reserve it by committing to use it for some time, like a year, and get a discount on its price.
Another way to benefit from a discount is to bring your licenses. In most cloud virtual machines where the costs of an operating system license or license for something like SQL Server are included, you get a discount if you already have a license.
Finally, you can get a discount by using shared resources for non‑critical workloads. For instance, you can use a shared virtual machine that has a certain amount of memory and CPU but can be scaled down at any time when demand from other users increases.
This might be fine for workloads that don’t need to be up and running the whole time and can continue after they are interrupted.
Continuous Cost Control
First, we found out that services and their tiers, storage, network traffic, licenses, and training are the things you pay for in the cloud. And we’ve seen that we first need to find out what resources we have in the cloud and what they cost to start controlling costs.
Time needed: 6 minutes.
How to reduce cloud costs?
- Create a cost-aware culture
when people are aware of the costs, that is are aware of the consequences, they will treat the resources they use differently and become better at controlling costs.
- Notifications and alerts
Create cost alerts and notifications in all major cloud platforms, and it is usually part of their cost management tool.
Usually, you can create simple or complex rules that fire an alert when they are met.
- Choose service tiers
Most service tiers offer higher performance and also additional features, so check if you need those features and check if you are using the performance.
- Automatically scale down and in
Automatically scaling down and in can save you a lot of money and is one of the key benefits of running your app in the cloud.
- Create budgets and policies
Policies and budgets are great tools to further control costs without having to rely on the good intentions of the people that use the cloud.
- Clean up resources
An obvious way to save on costs is to delete resources that you don’t need.
- Benefit from discounts
Discounts can add up. Some add up to 40% of your entire cloud costs. If you are not getting a discount now, look into it.
Secrets of cloud costs
You should do all these things to get a grip on your costs and minimize your monthly cloud bill. And remember that all major cloud providers include a cost management tool that helps you to analyze, predict, and control your costs, and that there are third‑party tools for doing this in a multi‑cloud environment.
Finally, I encourage you to find out if your cloud provider offers a cloud advisory tool. This is usually part of their cost management tool and automatically points out where and how you can save costs in the cloud.