- How to load balance http traffic to 2 webserver VMs
- Create an external load balancer using the Azure portal
- Learn to know the requirements for an Azure external load balancer and how to configure it.
Our final architecture should look like this:
At first you will deploy the start environment and then you will add the external load balancer.
In this directory there is an ARM-template which includes 2 web server VMs and its requirements (networking, disks,...):
Deploy this scenario into your subscription by clicking on the
button.
Name | Value |
---|---|
Resource group | (new) rg-lbwww |
Location | West Europe |
Admin user | demouser |
Admin password | %some complex value% |
Vm Size | Standard_B2s or try e.g. Standard_F2s_v2 |
Disk Sku | StandardSSD_LRS |
The result should look similar to this:
Now let's add an external Azure load balancer in front of the two parallel web server machines.
[Azure Portal]
-> '+' Add
-> Search the marketplace for 'Load balancer'
Name | Value |
---|---|
Resource group | rg-lbwww |
Name | lb-wwwfarm |
Region | West Europe |
Type | Public |
SKU | Basic |
Frontend Configuration | %Use existing public IP% pip-wwwfarm |
To get your load balancer working you need to configure the following:
-
A backend pool that contains the endpoints i.e. the VMs to which the traffic will be routed.
-
A health probe for TCP port 80 (http) to check if the endpoints are 'responsive' to web requests
-
A lb rule to forward incoming traffic (TCP port 80) on lb's frontend IP address to backend pool (TCP port 80)
To check if your lb is working do a HTTP request to the endpoint http://%PIP of your lb%
. Depending which endpoint serves your request the result should look like:
- Stop one VM and verify if the webpage is still served.
- Restart the VM and check if the lb notices it and re-balances load.
Delete the resource group rg-lbwww
.