Although there is a baseline price for whichever VM workload model you select, what you ultimately pay depends on a variety of options and configuration variables.
Not only do you choose between different Azure VM pricing models to reduce costs, you can potentially take advantage of special discount opportunities. This depends on your workload types and requirements. This article breaks down Azure pricing models and discounts, with a focus on VM-based workloads.
Azure VM pricing basics
Pricing for Azure's VM hosting service, Azure Virtual Machines, is based on three key factors:
- The type of VM instance you choose. Azure offers hundreds of VM instance types. Each instance is configured with different memory, vCPU and temporary storage resources, and some instance types also offer GPUs. Each type of instance has different pricing.
- How long your VM instance runs. In most cases, Azure charges for VMs by the minute. You pay only for the time that a VM instance is running; there is no cost for instances that you configure but are not running.
- The type of pricing model you choose. There are multiple pricing models for Azure VMs. The price per minute of VMs varies depending on the pricing model you select.
You may also pay the following additional fees for running Azure VMs:
- Data transfer over the network. If data leaves the Azure cloud or moves to a different Azure region, expect to incur data egress fees.
- Load balancing fees. Load balancers help manage traffic for Azure VMs.
- Persistent storage. If your VMs require persistent storage, you'll typically need to pay for Managed Disks. Managed Disks are billed separately from VMs.
Those types of resources aren't strictly required to run Azure VMs. You should factor in additional costs on top of the base cost of your Azure VM instances.
Azure VM pricing models
A pricing model defines how long your Azure VM instance runs and how much it costs to run it per hour. When you select a pricing model, you commit to pay for your Azure VM instance for the associated period.
Currently, Azure offers three pricing models for VMs.
Pay-as-you-go is the simplest and most flexible payment model. It lets you run VMs without a commitment to run them for a specified period. However, the pay-as-you-go pricing structure is higher than the other pricing models.
This model makes the most sense for workloads with unpredictable capacity requirements, such as an application that you've recently deployed into production and don't yet know how many requests it will receive.
For example, a D2as v4 instance type would cost $70 per month, or about $0.10 per hour, if you run it with pay-as-you-go pricing.
This payment model saves money because it enables you to pay upfront for a predefined period of VM run time. In most cases, you must commit to one year or three years of usage.
The amount of money that you save via reserved instances depends on which instance type you choose. In general, you'll save around 40% for a one-year reserved instance and 60% for a three-year instance.
For example, the same D2as v4 instance described above would cost you $41.16 per month, or around $0.06 per hour, if you run it as a one-year reserved instance.
You can typically cancel a reserved instance through the Azure portal and receive a refund for time that's unused. In most cases, Azure deducts a cancellation fee from the refund. For that reason, choose reserved instances only if you're confident that you'll need the instance for the time you select.
Because reserved instances require an upfront commitment to a fixed amount of usage, they are best for workloads with predictable capacity requirements, such as a line-of-business application for which request rates are unlikely to fluctuate much.
With Azure spot instances, customers purchase a fixed amount of compute capacity, but they are unable to control when their VM actually runs. Availability is up to Azure.
Spot instances offer deep discounts -- as much as 90% compared with pay-as-you-go pricing. The D2as v4 instance described above costs about $7 per month, or around $0.01 per hour, as a spot instance.
Because Azure can choose to shut them down without warning, spot instances are compatible only with workloads that can tolerate interruptions. For example, if you have a large batch of data to process, and your analytics tools can stop and restart, spot instances could be a good choice. You wouldn't want to use a spot instance, however, to host a web application that must be always available.
Azure pricing discounts
In addition to choosing the right VM instance type and pricing model for your workloads, you may be able to reduce your Azure bill through Azure discount promotions.
One option to consider is dev/test pricing. Azure offers discounts of up to 60% for VMs you use for dev/test purposes, rather than production.
Another way to reduce Azure VM costs is to use Azure Hybrid Benefit. This program lets you reuse licenses you already own for certain Microsoft products, including Windows, when you run workloads in Azure. If you intend to run Windows-based VMs in Azure, Hybrid Benefit is worth exploring. Hybrid Benefit won't reduce your costs for Linux VMs, however.