Azure

Azure cost optimization: how to reduce Azure costs

Azure cost optimization means paying only for the capacity your work uses. To reduce Azure costs, deallocate idle VMs, resize oversized ones and delete disks nothing uses. Then fit AKS requests and data disks to real use, and buy reservations or savings plans last, sized to what’s left.

Azure cost management: start in Microsoft Cost Management

If you searched for Azure cost management, you may want Microsoft’s own tool. Microsoft Cost Management is a suite of FinOps tools to analyze, monitor and optimize your Microsoft Cloud costs. In the Azure portal, it’s on every subscription, resource group and management group.

What you can do there:

  • explore your costs in Cost analysis;
  • set budgets that alert you when cost passes an amount or a forecast;
  • get anomaly alerts when a subscription’s daily usage spikes or dips;
  • export cost details to your storage account on a schedule;
  • read Azure Advisor’s cost recommendations.

Tag your resources first. Resource tags are the only way to add your own context, such as an app, environment or owner, to cost details. Cost allocation tags explains how to set them.

This page isn’t Microsoft’s tool, and it doesn’t replace it. It’s a guide to the fixes that reduce what those reports show.

Azure cost optimization, one cost line at a time

Azure cost optimization works one cost line at a time. Each line has its own driver and its own first fix.

Cost lineWhat you pay forFirst fixWho helps
The time a VM stays allocated, busy or idle.
Deallocate idle VMs and resize oversized ones.
Azure Advisor flags them.
The size you provision, whatever data it holds.
Delete disks no VM uses, then size the rest to their data.
Advisor flags unattached disks. Amoeba rightsizes data disks.
The node VMs, which grow with what your pods request.
Fit requests to real use, then let spare nodes go.
AKS cost analysis shows it. Coral rebalances the cluster.
Data that leaves a region.
Keep services that talk to each other in one region.
Your network design.
A one- or three-year commitment.
Buy last, sized to what the fixes leave.
Advisor recommends a size.

Virtual machines: deallocate idle ones, resize the rest

A VM’s compute charge follows its power state, not how busy it is. Azure charges a running VM for instance usage. It also charges a VM that’s Stopped (allocated), the state a shutdown from inside the guest OS leaves.

Only a deallocated VM has released its hardware and stopped the instance charge. Its disks and networking still cost. In the Azure CLI, az vm stop keeps the compute resources, and az vm deallocate releases them.

For VMs that run all day with little load, start with Azure Advisor. Microsoft calls its cost recommendations the first stop for existing resources. On its Cost tab, Advisor flags VMs and scale sets with low usage, and recommends rightsizing or shutting them down.

Then check how you pay for the VMs you keep:

  • Spot VMs use spare Azure capacity at up to 90% off pay-as-you-go prices. Azure evicts them when it needs the capacity back, so keep them for dev, test and batch work.
  • Azure Hybrid Benefit lets you use Windows Server and SQL Server licenses you already own, or Red Hat and SUSE Linux subscriptions, on Azure.
  • Reservations and savings plans come last, once your VM sizes have settled.

Managed disks: you pay for the size, not the data

An Azure managed disk is charged for what you provision, not for the data on it. How depends on the disk type:

  • Premium SSD, Standard SSD and Standard HDD are charged by a performance tier, which the size you pick sets by default. Grow a Standard SSD or Standard HDD into the next tier, and you pay for that tier.
  • Premium SSD v2 and Ultra Disk are charged per GiB, plus the performance you provision.
  • Every Premium SSD v2 includes 3,000 IOPS and 125 MB/s free of charge.

A managed disk can grow, but it can’t shrink. Shrinking an existing disk “isn’t supported and might result in data loss,” Microsoft Learn says. So space bought for a peak stays paid for after the data has gone.

Start with these checks:

  1. Find disks no VM uses. Advisor lists disks that aren’t attached to a VM, and Microsoft advises a snapshot first, because deleting a disk is irreversible. How to find unattached disks in Azure shows the queries.
  2. Compare used with provisioned space on each data disk. Azure VM disk usage shows how.
  3. Check the type. Premium SSD v2 vs Premium SSD compares the two Premium SSD types.

Azure disk cost optimization walks through every step, and the Azure disk pricing calculator prices one disk at list price. How to reduce Azure disk size covers the copy to a smaller disk.

AKS: requests decide how many nodes you pay for

An AKS cluster’s nodes are Azure VMs, grouped in node pools. You pay for them as compute, so the number and size of the nodes drive the cost.

That number follows what your pods request. The Cluster Autoscaler adds nodes when pods can’t be scheduled for lack of resources, and removes nodes with no running pods. AKS node auto provisioning (NAP) picks VM sizes from what pending pods request.

So a request set well above real use holds capacity that nothing uses. Microsoft’s AKS guidance says requests higher than actual usage can lead to overprovisioned workloads.

The fix, in order:

  1. Bring each container’s requests close to what it uses. The Vertical Pod Autoscaler can recommend values from past usage. Kubernetes pod right sizing shows how.
  2. Let the spare nodes go. Once pods fit on fewer nodes, the autoscaler can remove the empty ones. Cluster Autoscaler not scaling down covers what keeps a node in place.
  3. Stop dev and test clusters when they don’t need to run. Cluster stop shuts down every node pool, and the cluster keeps its state for when you start it again.
  4. Run work that can take an interruption on Spot node pools.

To see where the money goes inside a cluster, turn on the AKS cost analysis add-on. It splits cluster cost by Kubernetes constructs, beside Azure’s compute, network and storage categories. AKS cost analysis explains what it shows.

Kubernetes cost optimization on AKS and EKS is the full guide. The EKS and AKS pricing calculator prices a node pool.

Data transfer: keep traffic inside one region

Azure prices data transfer as bandwidth: data moving in and out of its data centers, and between them. Its bandwidth pricing page sets these rules:

  • Data coming in is free.
  • Data between Azure services in the same region isn’t charged.
  • Data out to the internet is free for the first 100 GB a month, then charged per GB, in tiers.
  • Data between two regions is charged on the way out, and free on the way in.

Bandwidth pricing leaves out the Content Delivery Network, ExpressRoute and peering, which have their own prices.

Internet egress has two prices. One routes it over Microsoft’s premium global network, and the other over a transit ISP network, through routing preference. The transit ISP route is priced less on every paid tier.

So keep services that talk to each other in one region, and watch what leaves it. Microsoft’s AKS guidance gives the same warning: a cheaper region for compute can bring latency and data transfer costs. Egress cost explains the terms.

Reservations and savings plans: commit last

Azure offers two ways to commit, each for one or three years.

Azure reservationAzure savings plan for compute
What you commit to
A specific resource, size and region
A fixed hourly spend, across eligible services and regions
Discount
Up to 72% against pay-as-you-go prices
Up to 65% against pay-as-you-go prices
Best for
Stable, predictable usage
Usage that changes, or spreads across services and regions

Each hour, a savings plan’s discount covers eligible usage up to the commitment, and anything beyond is charged at pay-as-you-go rates. Commitment an hour doesn’t use expires. It doesn’t roll over.

Savings plans can’t be canceled or refunded, and the one for compute doesn’t cover software, networking or storage. When a reservation expires, its resources keep running, but at on-demand rates.

So commit after the fixes above, not before. Azure Advisor bases its savings plan recommendation on your eligible on-demand usage. Bought first, a plan is sized to usage you’re about to remove.

The glossary covers reserved instances and savings plans in more depth.

Where Coral and Amoeba fit

Deallocating, deleting and committing are changes you make now and then. Requests and disks drift as usage moves, so Zoorik builds a product for each.

Coral, for AKS

Coral rebalances AKS clusters. It sizes each container’s CPU and memory requests to what it really uses. Coral also empties spare nodes one at a time, so the Cluster Autoscaler or NAP can remove them.

Coral works with the Horizontal Pod Autoscaler, KEDA, NAP and the Cluster Autoscaler, and needs no application code changes. Node optimization is on from install. Pod sizing waits until you switch on “Automatically optimize”.

AKS cost optimization with Coral

Amoeba, for managed disks

Amoeba rightsizes the data disks of Windows and Linux VMs, and never touches the OS disk. It moves a VM’s data disks onto one btrfs pool sized to your data, with room to grow. On Azure, the pool uses Premium SSD v2 where your VM’s region and zone offer it, and Premium SSD otherwise.

The services that use the data mounts restart at the switch onto the pool. After that, Amoeba rightsizes the pool without any downtime.

It grows the pool before it fills, and shrinks it one disk at a time when your data goes down and stays down. So you pay for close to what you use.

Azure managed disk cost optimization with Amoeba

Both products are in early access. Neither product resizes VMs outside AKS, buys commitments or changes your network.

Both price their savings at list price, without your discounts. So check their figures against your own rates before you size a commitment.

The free assessment estimates what you could save on Kubernetes (AKS and EKS) or block storage on Azure and AWS. It’s read-only, runs in Cloud Shell or your terminal, and writes one PDF. It sends nothing to Zoorik.

Questions about Azure cost optimization

What is Azure cost management?

It’s tracking and controlling what you spend on Azure. Microsoft’s own tool for it is Microsoft Cost Management, a suite of FinOps tools in the Azure portal. Zoorik isn’t that tool: this page covers the fixes that reduce what it shows.

Where do you start to reduce Azure costs?

Start with what nothing uses, such as VMs that are stopped but still allocated, and disks no VM is attached to. Then act on Azure Advisor’s resize advice, and fit AKS requests to real use. Buy reservations or savings plans last.

Reservation or savings plan: which should you buy?

Choose a reservation for stable usage on one resource, size and region, where it gives the deeper discount. Choose a savings plan for usage that changes, or spreads across services and regions. A savings plan can’t be canceled or refunded, so size it to what your fixes leave.

Is data transfer free inside Azure?

Data coming in is free, and so is data between Azure services in the same region. Data out to the internet is free for the first 100 GB a month, then charged per GB. Data between regions is charged where it leaves.

Does Zoorik replace Microsoft Cost Management or Azure Advisor?

No. Cost Management and Advisor show your spend and recommend changes across Azure. Coral and Amoeba make the changes on two lines of it: AKS requests and nodes, and the data disks of your VMs.

Find your own number

One line in your cloud console. One PDF report with your estimated saving at list price.

Estimate your saving

Talk to the builders

Thirty minutes with the people who build Coral and Amoeba.

Book a demo (opens in a new tab)

Or write to founders@zoorik.com