Rediger

Del via


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:

  • Learn how to estimate costs before using virtual machines
  • Gain an understanding of the billing model for virtual machines
  • Learn how to review costs of virtual machine deployments in the Azure portal

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.

Estimate costs before using virtual machines

Use the Azure pricing calculator to estimate costs before you add virtual machines.

  1. On the Virtual Machines tile under the Products tab, select Add to estimate and scroll down to the Your Estimate section.

  2. Select options from the drop-downs. There are various options available to choose from. The options that have the largest impact on your estimate total are your virtual machine's operating system, the operating system license if applicable, the VM size you select under INSTANCE, the number of instances you choose, and the amount of time your month your instances to run.

    Notice that the total estimate changes as you select different options. The estimate appears in the upper corner and the bottom of the Your Estimate section.

    Screenshot showing the your estimate section and main options available for virtual machines.

  3. Below the Savings Options section, there are choices for optional, additional resources you can deploy with your virtual machine, including Managed Disks, Storage transactions, and Bandwidth. For optimal performance, we recommend pairing your virtual machines with managed disks, but make sure to review the additional cost incurred by these resources.

    Screenshot of choices for optional, additional resources.

As you add new resources to your workspace, return to this calculator and add the same resource here to update your cost estimates.

For more information, see Azure Virtual Machines pricing for Windows or Linux.

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.
  • 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:

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
  • 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.

Screenshot of virtual machine savings plans on pricing calculator.

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.

Screenshot of virtual machine prepayment options on pricing calculator.

For more information, see Save costs with Azure Reserved VM Instances.

Review estimated costs in the Azure portal

As you create resources for virtual machines, you see estimated costs.

To create a virtual machine and view the estimated price:

  1. Sign in to the Azure portal.

  2. Enter virtual machines in the search.

  3. Under Services, select Virtual machines.

  4. In the Virtual machines page, select Create and then Azure virtual machine. The Create a virtual machine page opens.

  5. On the right side, you see a summary of the estimated costs. Adjust the options in the creation settings to see how the price changes and review the estimated costs.

    Screenshot of virtual machines estimated costs on creation page in the Azure portal.

  6. Finish creating the resource.

If your Azure subscription has a spending limit, Azure prevents you from spending over your credit amount. As you create and use Azure resources, your credits are used. If you reach your credit limit, the resources that you deployed are disabled for the rest of that billing period. You can't change your credit limit, but you can remove it. For more information about spending limits, see Azure spending limit.

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: