Plan to manage costs for virtual machines
This article describes how you plan for and manage costs for virtual machines. Before you deploy the service, you can use the Azure pricing calculator to estimate costs for virtual machines. Later, as you deploy Azure resources, review the estimated costs.
If you'd like to learn how to monitor costs for virtual machines, see Monitor costs for virtual machines. If you'd like to review the best practices for virtual machine cost optimization, see Best practices for virtual machine cost optimization.
In this article, you'll:
- Gain an understanding of the billing model for virtual machines
Prerequisites
Cost analysis in Cost Management supports most Azure account types but not all of them. To view the full list of supported account types, see Understand Cost Management data. To view cost data, you need at least read access for an Azure account. For information about assigning access to Microsoft Cost Management data, see Assign access to data.
Understand the full billing model for virtual machines
Virtual machines run on Azure infrastructure that accrues costs when you deploy new resources. It's important to understand that there could be other infrastructure costs that might accrue.
How you're charged for virtual machines
When you create or use virtual machines resources, you might get charged for the following meters:
- Virtual machines - You're charged for it based on the number of hours per VM.
- The price also changes based on your VM size.
- The price also changes based on the region where your virtual machine is located.
- As virtual machine instances go through different states, they're billed differently.
- Storage - Pricing changes based on multiple factors, including disk types, transactions, and configurations.
- For more information about Disk Storage billing, see Understand Azure Disk Storage billing.
- Virtual network - You're charged for it based on the number of GBs of data transferred.
- Bandwidth - You're charged for it based on the number of GBs of data transferred.
- Azure Monitor - You're charged for it based on the number of GBs of data ingested.
- Azure Bastion - You're charged for it based on the number of GBs of data transferred.
- Azure DNS - You're charged for it based on the number of DNS zones hosted in Azure and the number of DNS queries received.
- Load balancer, if used - You're charged for it based on the number of rulesets, hours used, and GB of data processed.
Any premium software from the Azure Marketplace comes with its own billing meters.
At the end of your billing cycle, the charges for each meter are summed. Your bill or invoice shows a section for all virtual machines costs. There's a separate line item for each meter.
Other costs that might accrue with virtual machines
When you create resources for virtual machines, resources for other Azure services are also created. They include:
- Virtual Network
- Virtual Network Interface Card (NIC)
- NICs don't incur any costs by themselves. However, your VM size limits how many NICs you can deploy, so play accordingly.
- A private IP and sometimes a public IP
- Network Security Group (NSG)
- NSGs don't incur any costs.
- OS disk and, optionally, additional disks
- In some cases, a load balancer
For more information, see the Parts of a VM and how they're billed section of the virtual machines documentation overview.
Costs might accrue after resource deletion
After you delete virtual machines resources, the following resources might continue to exist. They continue to accrue costs until you delete them.
- Any disks deployed other than the OS and local disks
- By default, the OS disk is deleted with the VM, but it can be set not to during the VM's creation
- Virtual network
- Your virtual NIC and public IP, if applicable, can be set to delete along with your virtual machine
- Bandwidth
- Load balancer
If your OS disk isn't deleted with your VM, it likely incurs P10 disk costs even in a stopped state. The OS disk size is smaller by default for some images and incurs lower costs accordingly.
For virtual networks, one virtual network is billed per subscription and per region. Virtual networks can't span regions or subscriptions. Setting up private endpoints in vNet setups may also incur charges.
Bandwidth is charged by usage; the more data transferred, the more you're charged.
Using a savings plan with virtual machines
You can choose to spend a fixed hourly amount for your virtual machines, unlocking lower prices until you reach your hourly commitment. These savings plans are available in one- and three-year options.
Using Azure Prepayment with virtual machines
You can pay for virtual machines charges with your Azure Prepayment credit. However, you can't use Azure Prepayment credit to pay for charges for third party products and services including those from the Azure Marketplace.
When you prepay for virtual machines, you're purchasing reserved instances. Committing to a reserved VM instance can save you money. The reservation discount is applied automatically to the number of running virtual machines that match the reservation scope and attributes. Reserved instances are available in one- and three-year plans.
For more information, see Save costs with Azure Reserved VM Instances.
Next steps
In this article, you learned about estimating costs of virtual machines, the virtual machine billing model, and reviewing virtual machine costs in the Azure portal.
For more information on virtual machine cost optimization, see the following articles:
- Learn how to monitor costs for virtual machines.
- Review the virtual machine cost optimization best practices.
- Learn how to optimize your cloud investment with Microsoft Cost Management.
- Learn more about managing costs with cost analysis.
- Learn about how to prevent unexpected costs.
- Take the Cost Management guided learning course.
- Learn how to create Linux and Windows virtual machines.
- Take the Azure Well-Architected Framework - Cost Optimization training.