Ten top tips to reduce Azure Costs
    • Dark
      Light
    • PDF

    Ten top tips to reduce Azure Costs

    • Dark
      Light
    • PDF

    Article Summary

    #ServerlessTips - Azure Cost Management
    Author: Stephane Eyskens, Azure MVP

    Companies often learn it the hard way, but Azure is not free of charge. They tend to overlook the cost management piece, and often fail to anticipate a fast-growing adoption of the Azure cloud within their organization.

    The result is typically painful: more expenditures than planned. Beyond governance, there are a few ways you that help reduces costs significantly in Azure. Below is a list of tips every company should look at.

    Tip #1 – Budget alerts

    The low-hanging fruit is the definition of budget alerts. While these alerts will not stop the consumption, you will at least be aware that your Azure consumption is going over budget, which you define yourself.

    Tip #2 – Keeping logging under control

    Something that is typically overlooked, is logging. In Azure, we typically use Application Insights, Diagnostic Logs, and Log Analytics Workspaces to store and query logs.

    The ingestion capacity of Log Analytics is sky-high, so we might not realize that we could be logging too much information until it shows up on the bill. Log Analytics is extremely expensive, you can easily spend 10K euros/month before you know it. I try to advise customers to:

    • Drill developers to work with verbosity levels and make sure you are not in “Debug” or “Verbose” mode at all times. You should ideally be able to switch verbosity levels as needed.

    • Select diagnostic logs with care. Not all logs have the same value, so it might not be required to log everything. Beware that metrics are anyway available in Azure Monitor, so you might first want to decide on metrics that make sense for your organization, and then, select diagnostic logs, accordingly, should you want to query these logs for further troubleshooting or definition of advanced alert rules.

    • Fine-tune default behaviors. As an example, the Azure Monitor agent for AKS will log everything that is happening within an AKS cluster. You might fine-tune and take only what is necessary for you.

    I often see companies spending a good 10% of their overall Azure bill only for logs…. To protect yourself against abusive logging, you can define daily caps in Log Analytics.

    Tip #3 – Reserved instances

    Many Azure services such as Virtual Machines, AKS, Premium App Service Plans, Redis, etc. are subject to the so-called reserved instances. Briefly, reserved instances allow you to commit for one or three years to a certain resource consumption.

    In exchange, you receive up to about 60% discount on the running costs. The reserved compute can be allocated as you see fit. If you are unsure about your long-term strategy, you can nevertheless go for a one-year reservation, which can be reconducted later.

    Tip #4 – Autoscaling with minimal and maximal boundaries

    Many services offer autoscaling capabilities. Thanks to autoscaling, you do not need to overscale your infrastructure in case a peak workload comes to the surface. The autoscaling feature itself is free of charge.

    You should of course define a maximum limit to make sure the service does not scale too much (in case of attacks or bugs). Of course, not all services scale at the same speed, so you must pay attention to the type of service you are dealing with. There are typically two ways to define autoscaling:

    • One way is to define scheduled autoscaling. This can be very handy with predictable peak times. If you know your application is available in only one country and that you have more users in the morning and/or in the evening, scheduled autoscaling is the best way to go. It allows you to cover your peak times seamlessly while still saving costs by scaling down automatically when peak times are behind.

    • The other way is dynamic scaling based on actual metrics. This is where you must pay particular attention to the type of service you work with. For example, an App Service Environment V3 is much slower to scale out than a multi-tenant app service. Another example is with AKS, you will need to wait a few minutes before you can use a new node. On the other hand, you can also leverage virtual nodes which are typically available within a minute. As you can see, scaling speed and capabilities vary from one service to another, and even from one SKU to another.

    Overall, defining autoscaling plans is always a clever idea as it allows you to manage peak times at an affordable cost, while not being forced to over-scale.

    Tip #5 – Stop/Pause services which can be stopped in lower environments

    Some services such as Virtual Machines, Azure Firewall, etc. can be stopped to save money. Others, such as Azure App Service and Function Apps can also be stopped but you are still charged because the cost is associated with the App Service Plan, not the web app or function app itself.

    Similarly, some associated costs might still be ongoing…For example, you keep paying for VM disks even though the VM is stopped. It is however interesting to make an inventory of services that can be stopped in non-production outside of business hours.

    Tip #6 – Choose pricing tiers with care

    This might sound obvious, but you should make sure to work with appropriate pricing tiers (SKU), especially in lower environments. For example, even though you might need Azure APIM Premium for your use case, you can typically use the Developer SKU in non-production as it has the same capabilities (except geo-redundancy), but no associated Service Level Agreement (SLA).

    The best way to know if you are using the right SKU is to work on the non-functional requirements and know your actual needs.

    Tip #7 – Burstable and Spot Virtual Machines

    Burstable VMs are small-scale VMs, which you can typically use for self-hosted Azure DevOps agents and lightweight processes. They are very cost-effective. Spot VMs take advantage of Azure’s huge infrastructure to offer to compute with extremely high discounts, by leveraging unused capacity.

    The counterpart is that Azure can take this capacity back at any point in time. This is however remarkably interesting to use Spot VMs with Azure Kubernetes Services (or at least a mix of spot & non-spot) in non-production to benefit from this interesting price.

    Tip #8 – Azure Policy to the rescue

    You can use Azure Policy to help control costs. You can typically control the pricing tiers (SKU) that you want to allow/prohibit. In sandboxed environments and non-production, you will typically prohibit teams from deploying expensive SKUs, by applying default Deny policies. You might exempt the team/project from that policy if justified.

    Tip #9 – Bring your license

    It is possible to bring your license with some Windows virtual machines as well as with Azure SQL. The way it works varies among the two and requires you to have a Ph.D. to figure out how licensing works with Microsoft, but there is room for optimization in that area.

    Tip #10 – Set up a cost management activity as part of your overall governance

    The best way to keep track of costs is to include cost management activities as part of your overall governance. Good governance would imply at least:

    • Solid foundations to build on
    • Setting up policies, including cost-related policies
    • Using Infrastructure as Code to standardize the provisioning of Cloud resources
    • Setting up a minimal set of initiative-taking services, such as
      • Reviewing security recommendations
      • Reviewing Azure Advisor
      • Reporting on actual costs against forecasts

    There is much more to it but, having at least these activities in the pipe, will concur to increased control over costs.

    The above reasons can indeed help you save you can also check the other several Azure Cost Analysis tools which offers advanced capabilites with in-bulit automation to have cost under control.

    MicrosoftTeams-image 443


    Was this article helpful?