Skip to content

Commit 45b528f

Browse files
authored
Merge pull request #267562 from tomvcassidy/vmCostOptimizationArticleSplit
Splitting virtual machines cost optimization articles
2 parents 8a84050 + 5769f0c commit 45b528f

13 files changed

+195
-96
lines changed

articles/batch/plan-to-manage-costs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Use the [Azure pricing calculator](https://azure.microsoft.com/pricing/calculato
3232

3333
![Screenshot showing the your estimate section and main options available for Azure Batch.](media/plan-to-manage-costs/batch-pricing-calculator-overview.png)
3434

35-
You can learn more about the cost of running virtual machines from the [Plan to manage costs for virtual machines documentation](../virtual-machines/plan-to-manage-costs.md).
35+
You can learn more about the cost of running virtual machines from the [Plan to manage costs for virtual machines documentation](../virtual-machines/cost-optimization-plan-to-manage-costs.md).
3636

3737
## Understand the full billing model for Azure Batch
3838

@@ -47,7 +47,7 @@ Azure Batch is a free service. There are no costs for Batch itself. However, the
4747
Although Batch itself is a free service, many of the underlying resources that run your workloads aren't. These include:
4848

4949
- [Virtual Machines](https://azure.microsoft.com/pricing/details/virtual-machines/windows/)
50-
- To learn more about the costs associated with virtual machines, see the [How you're charged for virtual machines section of Plan to manage costs for virtual machines](../virtual-machines/plan-to-manage-costs.md#how-youre-charged-for-virtual-machines).
50+
- To learn more about the costs associated with virtual machines, see the [How you're charged for virtual machines section of Plan to manage costs for virtual machines](../virtual-machines/cost-optimization-plan-to-manage-costs.md#how-youre-charged-for-virtual-machines).
5151
- Each VM in a pool created with [Virtual Machine Configuration](nodes-and-pools.md#virtual-machine-configuration) has an associated OS disk that uses Azure-managed disks. Azure-managed disks have an additional cost, and other disk performance tiers have different costs as well.
5252
- Storage
5353
- When applications are deployed to Batch node virtual machines using [application packages](batch-application-packages.md), you're billed for the Azure Storage resources that your application packages consume. You're also billed for the storage of any input or output files, such as resource files and other log data.

articles/virtual-machines/.openpublishing.redirection.virtual-machines.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5239,6 +5239,11 @@
52395239
"source_path_from_root": "/articles/virtual-machines/nv-series-retirement.md",
52405240
"redirect_url": "/azure/virtual-machines/sizes/migration-guides/nv-series-retirement",
52415241
"redirect_document_id": false
5242+
},
5243+
{
5244+
"source_path_from_root": "/articles/virtual-machines/plan-to-manage-costs.md",
5245+
"redirect_url": "/azure/virtual-machines/cost-optimization-plan-to-manage-costs",
5246+
"redirect_document_id": false
52425247
}
52435248
]
52445249
}

articles/virtual-machines/TOC.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,8 +2102,12 @@
21022102
href: ./linux/tutorial-azure-devops-blue-green-strategy.md
21032103
- name: Cost optimization
21042104
items:
2105-
- name: Overview
2106-
href: ./plan-to-manage-costs.md
2105+
- name: Plan to manage costs
2106+
href: ./cost-optimization-plan-to-manage-costs.md
2107+
- name: Monitor costs
2108+
href: ./cost-optimization-monitor-costs.md
2109+
- name: Best practices
2110+
href: ./cost-optimization-best-practices.md
21072111
- name: Resources
21082112
items:
21092113
- name: Cloud adoption framework
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Best practices for virtual machine cost optimization
3+
description: Learn the best practices for managing costs for virtual machines.
4+
author: tomvcassidy
5+
ms.author: tomcassidy
6+
ms.custom: subject-cost-optimization
7+
ms.service: virtual-machines
8+
ms.topic: conceptual
9+
ms.date: 02/21/2024
10+
---
11+
12+
# Best practices for virtual machine cost optimization
13+
14+
This article describes the best practices for managing costs for virtual machines.
15+
16+
If you'd like to see how the billing model works for virtual machines and how to plan for costs ahead of resource deployment, see [Plan to manage costs](cost-optimization-plan-to-manage-costs.md). If you'd like to learn how to monitor costs for virtual machines, see [Monitor costs for virtual machines](cost-optimization-monitor-costs.md).
17+
18+
In this article, you'll learn:
19+
* Best practices for managing and reducing costs for virtual machines
20+
* How to use Azure policies to manage and reduce costs
21+
22+
## Best practices to manage and reduce costs for virtual machines
23+
24+
The following are some best practices you can use to reduce the cost of your virtual machines:
25+
26+
- Use the [virtual machines selector](https://azure.microsoft.com/pricing/vm-selector/) to identify the best VMs for your needs
27+
- For development and test environments:
28+
- Use B-Series virtual machines
29+
- Use at least B2 for Windows machines
30+
- Use HDDs instead of SSDs when you can
31+
- Use locally redundant storage (LRS) accounts instead of geo- or zone-redundant storage accounts
32+
- Use Logic Apps or Azure Automation to implement an automatic start and stop schedule for your VMs
33+
- For production environments:
34+
- Use the dedicated Standard pricing tier or higher
35+
- Use a Premium SSD v2 disk and programmatically adjust its performance to account for either higher or lower demand based on your workload patterns
36+
- For other disk types, size your disks to achieve your desired performance without the need for over-provisioning. Account for fluctuating workload patterns, and minimizing unused provisioned capacity
37+
- Use [role-based-access-control (RBAC)](../role-based-access-control/built-in-roles.md) to control who can create resources
38+
- Use [Azure Spot virtual machines](spot-vms.md) where you can
39+
- For Windows virtual machines, consider [Azure Hybrid Benefit for Windows Server](windows/hybrid-use-benefit-licensing.md) to save cost on licensing
40+
- Use [cost alerts](../cost-management-billing/costs/cost-mgt-alerts-monitor-usage-spending.md) to monitor usage and spending
41+
- Minimize idle instances by configuring [autoscaling](../virtual-machine-scale-sets/virtual-machine-scale-sets-autoscale-overview.md)
42+
- Configure Azure Bastion for operational access
43+
44+
### Use policies to help manage and reduce costs for virtual machines
45+
46+
You can use [Azure Policy](../governance/policy/overview.md) to help govern and optimize the costs of your resources.
47+
48+
There are built-in policies for [virtual machines](policy-reference.md) and [networking services](../networking/policy-reference.md) that can help with cost savings:
49+
50+
- **Allowed virtual machine SKUs** - This policy enables you to specify a set of virtual machine size SKUs that your organization can deploy. You could use this policy to restrict any virtual machine sizes that exceed your desired budget. This policy would require updates to maintain as new virtual machine SKUs are added.
51+
- https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/Compute/VMSkusAllowed_Deny.json
52+
- You can review the available [VM sizes](sizes.md) and cross-reference their associated costs on the pricing pages for [Windows](https://azure.microsoft.com/pricing/details/virtual-machines/windows/) and [Linux](https://azure.microsoft.com/pricing/details/virtual-machines/linux/).
53+
- **Network interfaces should not have public IPs** - This policy restricts the creation of public IP addresses, except in cases where they are explicitly allowed. Restricting unnecessary exposure to the internet can help reduce bandwidth and virtual network data costs.
54+
55+
You can also make custom policies using Azure Policy. Some examples include:
56+
57+
- Implement policies to restrict what resources can be created:
58+
- https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/General/AllowedResourceTypes_Deny.json
59+
- Implement policies to not allow certain resources to be created:
60+
- https://github.com/Azure/azure-policy/blob/master/built-in-policies/policyDefinitions/General/InvalidResourceTypes_Deny.json
61+
- Using the resource policy to limit the allowed locations where virtual machines can be deployed.
62+
- Auditing resources that are incurring costs even after virtual machine deletion.
63+
- Auditing resources to enforce the use of the Azure Hybrid Benefit.
64+
65+
## Next steps
66+
67+
In this article, you learned the best practices for managing and reducing costs for virtual machines and how to use Azure policies to manage and reduce costs.
68+
69+
For more information on virtual machine cost optimization, see the following articles:
70+
71+
- Learn how to [plan to manage costs for virtual machines](cost-optimization-plan-to-manage-costs.md).
72+
- Learn how to [monitor costs for virtual machines](cost-optimization-monitor-costs.md).
73+
- Learn [how to optimize your cloud investment with Microsoft Cost Management](../cost-management-billing/costs/cost-mgt-best-practices.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
74+
- Learn more about managing costs with [cost analysis](../cost-management-billing/costs/quick-acm-cost-analysis.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
75+
- Learn about how to [prevent unexpected costs](../cost-management-billing/understand/analyze-unexpected-charges.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
76+
- Take the [Cost Management](/training/paths/control-spending-manage-bills?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn) guided learning course.
77+
- Learn how to create [Linux](linux/quick-create-portal.md) and [Windows](windows/quick-create-portal.md) virtual machines.
78+
- Take the [Microsoft Azure Well-Architected Framework - Cost Optimization training](/training/modules/azure-well-architected-cost-optimization/).
79+
- Review the [Well-Architected Framework cost optimization design principles](/azure/well-architected/cost-optimization/principles) and how they apply to [virtual machines](/azure/well-architected/service-guides/virtual-machines-review#cost-optimization).
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
---
2+
title: Monitor costs for virtual machines
3+
description: Learn how to monitor costs for virtual machines by using cost analysis in the Azure portal.
4+
author: tomvcassidy
5+
ms.author: tomcassidy
6+
ms.custom: subject-cost-optimization
7+
ms.service: virtual-machines
8+
ms.topic: conceptual
9+
ms.date: 02/21/2024
10+
---
11+
12+
# Monitor costs for virtual machines
13+
14+
This article describes how you monitor costs for virtual machines.
15+
16+
If you'd like to see how the billing model works for virtual machines and how to plan for costs ahead of resource deployment, see [Plan to manage costs](cost-optimization-plan-to-manage-costs.md). If you'd like to review the best practices for virtual machine cost optimization, see [Best practices for virtual machine cost optimization](cost-optimization-best-practices.md).
17+
18+
After you start using virtual machine resources, use Cost Management features to set budgets and monitor costs. You can also review forecasted costs and identify spending trends to identify areas where you might want to act. Costs for virtual machines are only a portion of the monthly costs in your Azure bill. Although this article explains how to plan for and manage costs for virtual machines, your bill includes the costs of all Azure services and resources used in your Azure subscription, including the third-party services. You can learn more about the billing model in [Plan to manage costs](cost-optimization-plan-to-manage-costs.md).
19+
20+
In this article, you'll learn how to:
21+
* Monitor virtual machine costs
22+
* Create budgets for virtual machines
23+
* Export virtual machine cost data
24+
25+
## Prerequisites
26+
27+
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](../cost-management-billing/costs/understand-cost-mgt-data.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn). 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](../cost-management/assign-access-acm-data.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
28+
29+
## Monitor costs
30+
31+
As you use Azure resources with virtual machines, you incur costs. Azure resource usage unit costs vary by time intervals (seconds, minutes, hours, and days) or by unit usage (bytes, megabytes, and so on.) As soon as virtual machine use starts, costs are incurred, and you can see the costs in [cost analysis](../cost-management/quick-acm-cost-analysis.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
32+
33+
When you use cost analysis, you view virtual machine costs in graphs and tables for different time intervals. Some examples are by day, current and prior month, and year. You also view costs against budgets and forecasted costs. Switching to longer views over time can help you identify spending trends, and you can see where you might be overspending. If you create budgets, you can also easily see where they're exceeded.
34+
35+
To view virtual machine costs in cost analysis:
36+
37+
1. Sign in to the [Azure portal](https://portal.azure.com).
38+
39+
1. Open the scope in the Azure portal and select **Cost analysis** in the menu. For example, go to **Subscriptions**, select a subscription from the list, and then select **Cost analysis** in the menu. Select **Scope** to switch to a different scope in cost analysis.
40+
41+
1. By default, cost for services are shown in the first donut chart. Select the area in the chart labeled virtual machines.
42+
43+
> [!NOTE]
44+
> If you just created your virtual machine, cost and usage data is typically only available within 8-24 hours.
45+
46+
Actual monthly costs are shown when you initially open cost analysis. Here's an example showing all monthly usage costs.
47+
48+
:::image type="content" source="media/plan-to-manage-costs/virtual-machines-pricing-all-monthly-costs.png" alt-text="Example of all monthly costs projections in cost analysis in the Azure portal." lightbox="media/plan-to-manage-costs/virtual-machines-pricing-all-monthly-costs.png" :::
49+
50+
To narrow costs for a single service, like virtual machines, select **Add filter** and then select **Service name**. Then, select **Virtual Machines**.
51+
52+
Here's an example showing costs for just virtual machines.
53+
54+
:::image type="content" source="media/plan-to-manage-costs/virtual-machines-pricing-costs-service-filter.png" alt-text="Example of monthly costs for virtual machines in cost analysis in the Azure portal." lightbox="media/plan-to-manage-costs/virtual-machines-pricing-costs-service-filter.png" :::
55+
56+
In the preceding example, you see the current cost for the service. Costs by Azure regions (locations) and virtual machines costs by resource group are also shown. From here, you can explore costs on your own.
57+
58+
## Create budgets
59+
60+
You can create [budgets](../cost-management/tutorial-acm-create-budgets.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn) to manage costs and create [alerts](../cost-management-billing/costs/cost-mgt-alerts-monitor-usage-spending.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn) that automatically notify stakeholders of spending anomalies and overspending risks. Alerts are based on spending compared to budget and cost thresholds. Budgets and alerts are created for Azure subscriptions and resource groups, so they're useful as part of an overall cost monitoring strategy.
61+
62+
Budgets can be created with filters for specific resources or services in Azure if you want more granularity present in your monitoring. Filters help ensure that you don't accidentally create new resources that cost you more money. For more information about the filter options available when you create a budget, see [Group and filter options](../cost-management-billing/costs/group-filter.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
63+
64+
## Export cost data
65+
66+
You can also [export your cost data](../cost-management-billing/costs/tutorial-export-acm-data.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn) to a storage account. This is helpful when you need or others to do additional data analysis for costs. For example, a finance team can analyze the data using Excel or Power BI. You can export your costs on a daily, weekly, or monthly schedule and set a custom date range. Exporting cost data is the recommended way to retrieve cost datasets.
67+
68+
## Next steps
69+
70+
In this article, you learned how to monitor virtual machine costs, create budgets, and export cost data.
71+
72+
For more information on virtual machine cost optimization, see the following articles:
73+
74+
- Learn how to [plan to manage costs for virtual machines](cost-optimization-plan-to-manage-costs.md).
75+
- Review the [virtual machine cost optimization best practices](cost-optimization-best-practices.md).
76+
- Learn [how to optimize your cloud investment with Microsoft Cost Management](../cost-management-billing/costs/cost-mgt-best-practices.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
77+
- Learn more about managing costs with [cost analysis](../cost-management-billing/costs/quick-acm-cost-analysis.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
78+
- Learn about how to [prevent unexpected costs](../cost-management-billing/understand/analyze-unexpected-charges.md?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn).
79+
- Take the [Cost Management](/training/paths/control-spending-manage-bills?WT.mc_id=costmanagementcontent_docsacmhorizontal_-inproduct-learn) guided learning course.
80+
- Learn how to create [Linux](linux/quick-create-portal.md) and [Windows](windows/quick-create-portal.md) virtual machines.
81+
- Take the [Microsoft Azure Well-Architected Framework - Cost Optimization training](/training/modules/azure-well-architected-cost-optimization/).
82+
- Review the [Well-Architected Framework cost optimization design principles](/azure/well-architected/cost-optimization/principles) and how they apply to [virtual machines](/azure/well-architected/service-guides/virtual-machines-review#cost-optimization).

0 commit comments

Comments
 (0)