Why you should consider - Azure Cost Management?
While cloud adoption is at an all-time high these days, users must be mindful of the cost of resource consumption. Most cloud resources offer a consumption-based model and it’s essential to perform cost analysis, capacity management and budget analysis to ensure that we make optimal use of our cloud resources. In this article, we will discuss the factors that affect the cost of cloud resources and some ways in which we could calculate the operational cost of deploying a resource in the cloud.
Different factors affecting Azure Cost Management
1. Subscription type
One of the first factors that comes to mind when discussing cost is the type of subscription that we are using. Azure offers different types of subscription based on individual and organizational needs and each type of subscription has different billing models associated with it.
For example:
- Free subscriptions provide us with some free resource usage, up to a certain limit, and in fact some services are always free up to certain usage thresholds.
- Other subscription types, like pay-as-you-go, Enterprise Agreement and Cloud Solution Provider subscriptions that you might have in the Azure Cloud, all have different costs associated with them.
2. Resource type
Different types of resources in the Azure cloud will have different costs when it comes to billing. For example, a virtual machine and a storage account would not cost the same. Even with virtual machines, the costs will vary in accordance with the amount of capacity (compute and storage) the virtual machine has. Similarly different storage tiers within storage accounts will have different costs.
3. Resource consumption
As one would anticipate resource usage is definitely a factor that affects costs. Metrics like CPU time, ingress/egress network traffic and also the disk size all incur charges as we continue to use them.
4. Resource usage
This is the cost of the actual resource itself i.e., the virtual machine being deployed or the disk being added to a virtual machine.
5. Location
The cost of living varies among different cities in a country or different countries. In a similar manner, the cost using Azure resources is not the same for every location and there is some variation.
Best practices for effective Cost Management With Azure
1. Select the right resource for the task
In regards to cost best practices in the Azure Cloud, we need to select the right tool for the job. For example, we have several different resource types for compute resources inside the Azure Cloud, and we need to make sure that we select the correct one for our use case. For example, if we want virtual machines, well, then we need to select the virtual machines resource.
2. Resource sizing requirements
While deploying resources in the Azure cloud, we need to ensure that the resource being created has appropriate capacity. If we create a resource that is too small then our workload will run properly. Consequently, if we have a resource that is too large then we’ll end up with unused capacity and in turn we end up spending money on resources that we do not use. It is therefore necessary to have an effective capacity management strategy in place so that our resource sizing is aligned with the needs of our workloads.
3. Deallocate un-used resources
It is important to deallocate or delete resources that we are not using so that we are not charged for them. We would like to sight an example here which is a common cause of budget overflows when it comes to virtual machines. Many users tend to shutdown virtual machines when they are done with them instead of deleting them. It’s worth mentioning that virtual machines in shut down state will still incur costs as the resources remain allocated. It’s only after the virtual machine is deallocated or deleted that the assigned resources are freed up and billing for the resource stops.
4. Leverage cloud capabilities wherever possible
Perhaps one of the most vital features that have catapulted the move to the cloud are scalability and elasticity. For optimal utilization of cloud resources, it’s imperative that we make use of these two features wherever our workloads and organizational needs allow us to. Scalability and elasticity allow us to grow or shrink our infrastructure resources within a matter of seconds without incurring any downtime. Therefore, thoughtful utilization of these capabilities becomes crucial in optimizing cloud costs as they help align our resource utilization with the demands of our workloads.
5. Plan costs in advance
Having a well drafted budget for the purchase of cloud resources goes a long way in keeping our costs lower. Azure provides us with some tools to help us calculate the cost of deploying resources in the cloud. This allows users to plan for optimal resource utilization and keep costs low or at least not be overwhelmed by the cost report. We will discuss these tools now.
Different Azure Cost Management and Analysis Tools
1. Pricing calculator
The pricing calculator helps us to estimate the cost of running a workload inside the Azure Cloud. Within the pricing calculator, we can also modify the workload details so that we could gauge and estimate the cost difference of running the workload with different capacity constraints. We will now share a brief demonstration of how we may use the pricing calculator. This is an online portal accessible via the URL https://azure.microsoft.com/en-in/pricing/calculator/. Once you open this URL, you’ll see different Azure products and services listed for which we could estimate costs for.
In our case, we’ll select virtual machines and let’s see how much running a virtual machine in the Azure cloud in an IaaS scenario is going to cost us. After clicking on virtual machines, if we scroll down a bit, we would be able to view the monthly cost of running a virtual machine in the Azure cloud.
Note that we did not type in any specifications for the virtual machine and these were auto-populated. Let’s change the region, OS type and instance type and observe how the cost of operation changes.
Now, when we view the monthly cost with the new selections, we will see that it’s vastly different from the earlier case.
The difference in cost could be mostly attributed to the larger size of the instance i.e., the current selection has much larger compute and memory capacity in comparison to the previous selection.
If we scroll further down we’ll find options to choose the level of support, licensing and a useful option to save the cost estimate in case we need to present it at a later time.
In addition to cost estimations Microsoft also presents us with some saving options wherein the monthly cost of the virtual machine or another resource is reduced if the consumers opt for a long term one year or three-year usage agreement.
2. Total Cost of Ownership (TCO) calculator
A comparison between running the workload on premises and in the cloud is an important factor that influences an organization’s decision regarding migrating the workload to the cloud. The TCO calculator is a very useful tool that helps us make this comparison and in doing so the case for cloud migration. The TCO calculator is accessible via the URL https://azure.microsoft.com/en-in/pricing/tco/calculator/.
The TCO calculator would first require us to define our workload and then adjusting our assumptions of how much money we're going to spend on specific things, such as utilities for our resources. And we can really just build out our workloads. We can build out our servers, our databases, our storage, our networking. And once we've done that, we adjust our assumptions. And then we can view a report of how much money we are spending versus how much money it will cost to run the same workload inside of the Azure Cloud.
Under the define your workload section, click on the add server workload button and fill in the specifications for the workload. These parameters denote the settings with which we are running the workload on premises.
Apart from the workload/virtual machine section, there are also sections for database, storage and network. We may keep these settings at defaults or fill in values in accordance with our needs. Once done, click on next.
On this page we may make some adjustments to the default operating costs for on premises generated by the TCO.
We’ll keep the defaults and click on the next button at the end of the page.
Finally, we will now be shown the operational cost comparison between running our workloads on-premises and the Azure cloud. Based on the workload details and assumptions we specified, our cost savings with moving our workload to Azure are as follows.
A more detailed cost comparison could be found by scrolling down.
With such an enormous cost benefit, any organization would be tempted to move their workload from on premises to the Azure cloud.
3. Cost management tool
The last tool that we are going to discuss is not a web portal but is in fact an Azure service. To navigate to the cost management portal just type the word cost in the search bar and click on the first result which is cost management + billing.
Within the cost management tool, we can view costs based on scopes and a scope in this context is a subscription. Within our scope we can filter out costs based on a variety of categories and we could also view costs incurred during a particular time window or consolidate costs incurred by resources belonging to a specific tag.
This is where tagging resources proves to be very helpful in tracking resource costs. In the screen shot given below, we are viewing the consolidated costs incurred by the resources grouped under the Infrastructure_production subscription for the year 2021 onwards.
If we scroll down, we could also view resource costs filtered by service, location and resource groups.
The cost management service also allows us to set up budget alerts where in we would be alerted if our infrastructure costs exceed a defined percentage of our budget. For example, we could se a budget of 100$ and set up a budget alert to be notified via email when our billing exceeds 50$. This is a great way to keep our cloud infrastructure costs in check.
Summary
In this article, we explained the different best practices for controlling our cloud infrastructure costs and we also discussed some tools we could utilize to better understand how resources in the cloud are billed and how we could reduce our operational costs by moving our workloads to the Azure cloud.
References
We referred to the official Azure documentation while writing this article, specifically the Azure cost management and the Analyzing costs and creating budgets sections, links to which have been provided below for further reading.
Introduction to analyzing costs and creating budgets with Azure Cost Management
Plan and manage your Azure costs