Skip to content

Commit 5957848

Browse files
authored
Merge pull request #221884 from MicrosoftDocs/release-vmss-tutorials
Merge VMSS Tutorials
2 parents 98d9402 + b409b9f commit 5957848

19 files changed

+1353
-1184
lines changed

articles/virtual-machine-scale-sets/.openpublishing.redirection.virtual-machine-scale-sets.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"redirect_url": "/azure/virtual-machine-scale-sets/quick-create-template-linux",
5656
"redirect_document_id": false
5757
},
58+
{
59+
"source_path_from_root": "/articles/virtual-machine-scale-sets/tutorial-install-apps-template.md",
60+
"redirect_url": "/azure/virtual-machine-scale-sets/tutorial-install-apps-cli",
61+
"redirect_document_id": false
62+
},
5863
{
5964
"source_path_from_root": "/articles/virtual-machine-scale-sets/virtual-machine-scale-sets-deploy-scaling-app-template.md",
6065
"redirect_url": "/azure/virtual-machine-scale-sets/quick-create-template-linux",

articles/virtual-machine-scale-sets/TOC.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,43 @@
2626
href: flexible-virtual-machine-scale-sets-rest-api.md
2727
- name: Tutorials
2828
items:
29-
- name: 1 - Create / manage scale set
29+
- name: Create and manage
3030
items:
3131
- name: Azure CLI
3232
href: tutorial-create-and-manage-cli.md
3333
- name: Azure PowerShell
3434
href: tutorial-create-and-manage-powershell.md
35-
- name: 2 - Use data disks
35+
- name: Connect to Instances
36+
items:
37+
- name: Azure CLI
38+
href: tutorial-connect-to-instances-cli.md
39+
- name: Azure PowerShell
40+
href: tutorial-connect-to-instances-powershell.md
41+
- name: Modify a scale set
42+
items:
43+
- name: Azure CLI
44+
href: tutorial-modify-scale-sets-cli.md
45+
- name: Azure PowerShell
46+
href: tutorial-modify-scale-sets-powershell.md
47+
- name: Use data disks
3648
items:
3749
- name: Azure CLI
3850
href: tutorial-use-disks-cli.md
3951
- name: Azure PowerShell
4052
href: tutorial-use-disks-powershell.md
41-
- name: 3 - Use a custom VM image
53+
- name: Use a custom VM image
4254
items:
4355
- name: Azure CLI
4456
href: tutorial-use-custom-image-cli.md
4557
- name: Azure PowerShell
4658
href: tutorial-use-custom-image-powershell.md
47-
- name: 4 - Deploy apps to a scale set
59+
- name: Deploy apps to a scale set
4860
items:
4961
- name: Azure CLI
5062
href: tutorial-install-apps-cli.md
5163
- name: Azure PowerShell
5264
href: tutorial-install-apps-powershell.md
53-
- name: Template
54-
href: tutorial-install-apps-template.md
55-
- name: 5 - Autoscale a scale set
65+
- name: Autoscale a scale set
5666
items:
5767
- name: Azure CLI
5868
href: tutorial-autoscale-cli.md
Loading

articles/virtual-machine-scale-sets/tutorial-autoscale-cli.md

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ ms.author: jushiman
66
ms.topic: tutorial
77
ms.service: virtual-machine-scale-sets
88
ms.subservice: autoscale
9-
ms.date: 11/22/2022
9+
ms.date: 12/16/2022
1010
ms.reviewer: mimckitt
1111
ms.custom: avverma, devx-track-azurecli
1212

1313
---
1414
# Tutorial: Automatically scale a Virtual Machine Scale Set with the Azure CLI
15-
16-
> [!NOTE]
17-
> This tutorial uses Uniform Orchestration mode. We recommend using Flexible Orchestration for new workloads. For more information, see [Orchesration modes for Virtual Machine Scale Sets in Azure](virtual-machine-scale-sets-orchestration-modes.md).
18-
1915
When you create a scale set, you define the number of VM instances that you wish to run. As your application demand changes, you can automatically increase or decrease the number of VM instances. The ability to autoscale lets you keep up with customer demand or respond to application performance changes throughout the lifecycle of your app. In this tutorial you learn how to:
2016

2117
> [!div class="checklist"]
@@ -31,28 +27,26 @@ When you create a scale set, you define the number of VM instances that you wish
3127
- This tutorial requires version 2.0.32 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
3228

3329
## Create a scale set
34-
35-
Create a resource group with [az group create](/cli/azure/group) as follows:
30+
Create a resource group with [az group create](/cli/azure/group).
3631

3732
```azurecli-interactive
3833
az group create --name myResourceGroup --location eastus
3934
```
4035

41-
Now create a Virtual Machine Scale Set with [az vmss create](/cli/azure/vmss). The following example creates a scale set with an instance count of *2*, and generates SSH keys if they do not exist:
36+
Now create a Virtual Machine Scale Set with [az vmss create](/cli/azure/vmss). The following example creates a scale set with an instance count of *2*, and generates SSH keys if they don't exist.
4237

4338
```azurecli-interactive
4439
az vmss create \
4540
--resource-group myResourceGroup \
4641
--name myScaleSet \
4742
--image UbuntuLTS \
48-
--upgrade-policy-mode automatic \
43+
--orchestration-mode Flexible \
4944
--instance-count 2 \
5045
--admin-username azureuser \
5146
--generate-ssh-keys
5247
```
5348

5449
## Define an autoscale profile
55-
5650
To enable autoscale on a scale set, you first define an autoscale profile. This profile defines the default, minimum, and maximum scale set capacity. These limits let you control cost by not continually creating VM instances, and balance acceptable performance with a minimum number of instances that remain in a scale-in event. Create an autoscale profile with [az monitor autoscale create](/cli/azure/monitor/autoscale#az-monitor-autoscale-create). The following example sets the default, and minimum, capacity of *2* VM instances, and a maximum of *10*:
5751

5852
```azurecli-interactive
@@ -67,10 +61,9 @@ az monitor autoscale create \
6761
```
6862

6963
## Create a rule to autoscale out
64+
If your application demand increases, the load on the VM instances in your scale set increases. If this increased load is consistent, rather than just a brief demand, you can configure autoscale rules to increase the number of VM instances in the scale set. When these VM instances are created and your applications are deployed, the scale set starts to distribute traffic to them through the load balancer. You control what metrics to monitor, how long the application load must meet a given threshold, and how many VM instances to add to the scale set.
7065

71-
If your application demand increases, the load on the VM instances in your scale set increases. If this increased load is consistent, rather than just a brief demand, you can configure autoscale rules to increase the number of VM instances in the scale set. When these VM instances are created and your applications are deployed, the scale set starts to distribute traffic to them through the load balancer. You control what metrics to monitor, such as CPU or disk, how long the application load must meet a given threshold, and how many VM instances to add to the scale set.
72-
73-
Let's create a rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that increases the number of VM instances in a scale set when the average CPU load is greater than 70% over a 5-minute period. When the rule triggers, the number of VM instances is increased by three.
66+
Create a rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that increases the number of VM instances in a scale set when the average CPU load is greater than 70% over a 5-minute period. When the rule triggers, the number of VM instances is increased by three.
7467

7568
```azurecli-interactive
7669
az monitor autoscale rule create \
@@ -81,10 +74,9 @@ az monitor autoscale rule create \
8174
```
8275

8376
## Create a rule to autoscale in
84-
8577
On an evening or weekend, your application demand may decrease. If this decreased load is consistent over a period of time, you can configure autoscale rules to decrease the number of VM instances in the scale set. This scale-in action reduces the cost to run your scale set as you only run the number of instances required to meet the current demand.
8678

87-
Create another rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that decreases the number of VM instances in a scale set when the average CPU load then drops below 30% over a 5-minute period. The following example defines the rule to scale in the number of VM instances by one:
79+
Create another rule with [az monitor autoscale rule create](/cli/azure/monitor/autoscale/rule#az-monitor-autoscale-rule-create) that decreases the number of VM instances in a scale set when the average CPU load then drops below 30% over a 5-minute period. The following example defines the rule to scale in the number of VM instances by one.
8880

8981
```azurecli-interactive
9082
az monitor autoscale rule create \
@@ -95,31 +87,9 @@ az monitor autoscale rule create \
9587
```
9688

9789
## Generate CPU load on scale set
98-
9990
To test the autoscale rules, generate some CPU load on the VM instances in the scale set. This simulated CPU load causes the autoscales to scale out and increase the number of VM instances. As the simulated CPU load is then decreased, the autoscale rules scale in and reduce the number of VM instances.
10091

101-
First, list the address and ports to connect to VM instances in a scale set with [az vmss list-instance-connection-info](/cli/azure/vmss):
102-
103-
```azurecli-interactive
104-
az vmss list-instance-connection-info \
105-
--resource-group myResourceGroup \
106-
--name myScaleSet
107-
```
108-
109-
The following example output shows the instance name, public IP address of the load balancer, and port number that the Network Address Translation (NAT) rules forward traffic to:
110-
111-
```json
112-
{
113-
"instance 1": "13.92.224.66:50001",
114-
"instance 3": "13.92.224.66:50003"
115-
}
116-
```
117-
118-
SSH to your first VM instance. Specify your own public IP address and port number with the `-p` parameter, as shown from the preceding command:
119-
120-
```console
121-
ssh [email protected] -p 50001
122-
```
92+
To connect to an individual instance, see [Tutorial: Connect to Virtual Machine Scale Set instances](tutorial-connect-to-instances-cli.md)
12393

12494
Once logged in, install the **stress** utility. Start *10* **stress** workers that generate CPU load. These workers run for *420* seconds, which is enough to cause the autoscale rules to implement the desired action.
12595

@@ -166,7 +136,6 @@ exit
166136
```
167137

168138
## Monitor the active autoscale rules
169-
170139
To monitor the number of VM instances in your scale set, use **watch**. It takes 5 minutes for the autoscale rules to begin the scale-out process in response to the CPU load generated by **stress** on each of the VM instances:
171140

172141
```azurecli-interactive
@@ -193,21 +162,19 @@ Every 2.0s: az vmss list-instances --resource-group myResourceGroup --name mySca
193162
Once **stress** stops on the initial VM instances, the average CPU load returns to normal. After another 5 minutes, the autoscale rules then scale in the number of VM instances. Scale in actions remove VM instances with the highest IDs first. When a scale set uses Availability Sets or Availability Zones, scale in actions are evenly distributed across those VM instances. The following example output shows one VM instance deleted as the scale set autoscales in:
194163

195164
```output
196-
6 True eastus myScaleSet_6 Deleting myResourceGroup 9e4133dd-2c57-490e-ae45-90513ce3b336
165+
6 True eastus myScaleSet_6 Deleting myResourceGroup 9e4133dd-2c57-490e-ae45-90513ce3b336
197166
```
198167

199168
Exit *watch* with `Ctrl-c`. The scale set continues to scale in every 5 minutes and remove one VM instance until the minimum instance count of two is reached.
200169

201170
## Clean up resources
202-
203171
To remove your scale set and additional resources, delete the resource group and all its resources with [az group delete](/cli/azure/group). The `--no-wait` parameter returns control to the prompt without waiting for the operation to complete. The `--yes` parameter confirms that you wish to delete the resources without an additional prompt to do so.
204172

205173
```azurecli-interactive
206174
az group delete --name myResourceGroup --yes --no-wait
207175
```
208176

209177
## Next steps
210-
211178
In this tutorial, you learned how to automatically scale in or out a scale set with the Azure CLI:
212179

213180
> [!div class="checklist"]

articles/virtual-machine-scale-sets/tutorial-autoscale-powershell.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ ms.custom: avverma, devx-track-azurepowershell
1616
> [!NOTE]
1717
> This tutorial uses Uniform Orchestration mode. We recommend using Flexible Orchestration for new workloads. For more information, see [Orchestration modes for Virtual Machine Scale Sets in Azure](virtual-machine-scale-sets-orchestration-modes.md).
1818
19-
[!INCLUDE [requires-azurerm](../../includes/requires-azurerm.md)]
20-
2119
When you create a scale set, you define the number of VM instances that you wish to run. As your application demand changes, you can automatically increase or decrease the number of VM instances. The ability to autoscale lets you keep up with customer demand or respond to application performance changes throughout the lifecycle of your app. In this tutorial you learn how to:
2220

2321
> [!div class="checklist"]
@@ -244,7 +242,6 @@ To remove your scale set and additional resources, delete the resource group and
244242
Remove-AzureRmResourceGroup -Name "myResourceGroup" -Force -AsJob
245243
```
246244

247-
248245
## Next steps
249246
In this tutorial, you learned how to automatically scale in or out a scale set with Azure PowerShell:
250247

0 commit comments

Comments
 (0)