@@ -5,11 +5,12 @@ description: This quickstart shows how to create a public load balancer using th
5
5
author : asudbring
6
6
ms.service : load-balancer
7
7
ms.topic : quickstart
8
- ms.date : 11/23/2020
8
+ ms.date : 03/16/2022
9
9
ms.author : allensu
10
10
ms.custom : mvc, devx-track-js, devx-track-azurecli, mode-api
11
11
# Customer intent: I want to create a load balancer so that I can load balance internet traffic to VMs.
12
12
---
13
+
13
14
# Quickstart: Create a public load balancer to load balance VMs using Azure CLI
14
15
15
16
Get started with Azure Load Balancer by using Azure CLI to create a public load balancer and two virtual machines.
@@ -77,8 +78,11 @@ To create a zonal public IP address in Zone 1 use the following command:
77
78
This section details how you can create and configure the following components of the load balancer:
78
79
79
80
* A frontend IP pool that receives the incoming network traffic on the load balancer.
81
+
80
82
* A backend IP pool where the frontend pool sends the load balanced network traffic.
83
+
81
84
* A health probe that determines health of the backend VM instances.
85
+
82
86
* A load balancer rule that defines how traffic is distributed to the VMs.
83
87
84
88
### Create the load balancer resource
@@ -109,15 +113,17 @@ Create a health probe with [az network lb probe create](/cli/azure/network/lb/pr
109
113
--lb-name myLoadBalancer \
110
114
--name myHealthProbe \
111
115
--protocol tcp \
112
- --port 80
116
+ --port 80
113
117
```
114
118
115
119
### Create the load balancer rule
116
120
117
121
A load balancer rule defines:
118
122
119
123
* Frontend IP configuration for the incoming traffic.
124
+
120
125
* The backend IP pool to receive the traffic.
126
+
121
127
* The required source and destination port.
122
128
123
129
Create a load balancer rule with [ az network lb rule create] ( /cli/azure/network/lb/rule#az_network_lb_rule_create ) :
@@ -136,7 +142,6 @@ Create a load balancer rule with [az network lb rule create](/cli/azure/network/
136
142
--disable-outbound-snat true \
137
143
--idle-timeout 15 \
138
144
--enable-tcp-reset true
139
-
140
145
```
141
146
142
147
## Create a network security group
@@ -216,12 +221,13 @@ It can take a few minutes for the Azure Bastion host to deploy.
216
221
217
222
In this section, you create:
218
223
219
- * Three network interfaces for the virtual machines.
224
+ * Two network interfaces for the virtual machines.
225
+
220
226
* Two virtual machines to be used as backend servers for the load balancer.
221
227
222
228
### Create network interfaces for the virtual machines
223
229
224
- Create three network interfaces with [ az network nic create] ( /cli/azure/network/nic#az_network_nic_create ) :
230
+ Create two network interfaces with [ az network nic create] ( /cli/azure/network/nic#az_network_nic_create ) :
225
231
226
232
``` azurecli
227
233
array=(myNicVM1 myNicVM2)
@@ -261,7 +267,8 @@ Create the virtual machines with [az vm create](/cli/azure/vm#az_vm_create):
261
267
--zone 2 \
262
268
--no-wait
263
269
```
264
- It may take a few minutes for the VMs to deploy.
270
+
271
+ It may take a few minutes for the VMs to deploy. You can continue to the next steps while the VMs are creating.
265
272
266
273
[ !INCLUDE [ ephemeral-ip-note.md] ( ../../includes/ephemeral-ip-note.md )]
267
274
@@ -286,7 +293,6 @@ Add the virtual machines to the backend pool with [az network nic ip-config addr
286
293
287
294
To provide outbound internet access for resources in the backend pool, create a NAT gateway.
288
295
289
-
290
296
### Create public IP
291
297
292
298
Use [ az network public-ip create] ( /cli/azure/network/public-ip#az_network_public_ip_create ) to create a single IP for the outbound connectivity.
@@ -349,7 +355,6 @@ Use [az vm extension set](/cli/azure/vm/extension#az_vm_extension_set) to instal
349
355
--resource-group CreatePubLBQS-rg \
350
356
--settings '{"commandToExecute":"powershell Add-WindowsFeature Web-Server; powershell Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $($env:computername)"}'
351
357
done
352
-
353
358
```
354
359
355
360
## Test the load balancer
@@ -378,11 +383,14 @@ When no longer needed, use the [az group delete](/cli/azure/group#az_group_delet
378
383
379
384
## Next steps
380
385
381
- In this quickstart
386
+ In this quickstart:
382
387
383
388
* You created a standard public load balancer
384
- * Attached virtual machines
389
+
390
+ * Attached two virtual machines
391
+
385
392
* Configured the load balancer traffic rule and health probe
393
+
386
394
* Tested the load balancer
387
395
388
396
To learn more about Azure Load Balancer, continue to:
0 commit comments