Configure Azure Public Load Balancer Part -2

This is part-2 of previous article and we are configuring a public load balancer in Azure which for distributing/load balancing traffic between VMs where we host an application or service.

Please read Part-1 before going through steps in this article.

In Part-1 lab, we have added two VMs (Windows Server 2016), specified Virtual Network, configured Availability sets and their public IPs. We also did setup and deploy a web application on IIS in both VMs and tested accessing those using individual URLs.

In Azure portal, add a load balancer as shown below:

AzureLoadBalancer-21

Choose the type of load balancer as “Public”

AzureLoadBalancer-22

AzureLoadBalancer-27

Next step is to select new Load Balancer that is created and go to “Front end IP configuration” and add a public IP address. Note that once completed, we will be using this IP address for accessing the web application (MyWebApp that we created in Part-1 lab) instead of individual IPs for VMs.

AzureLoadBalancer-31

 

Select “Backend Pools” next and click “Add”. Select your availability set where both of our VMs are associated.

AzureLoadBalancer-33

AzureLoadBalancer-34

 

Now you will be able to associate  both VMs to the backend pool of load balancer as shown below.

AzureLoadBalancer-36.png

Once done, go to Health Probes, and add a health probe for this load balancer with default settings.

The next important step is to set Load balancing rules. Add one as shown below.

AzureLoadBalancer-40

AzureLoadBalancer-41

Go to LoadBalancer Front End and you can find the public IP address has been associated and configuration is looking good

AzureLoadBalancer-42.png

 

Now it is time to test accessing your web application. Note that we access the web application using  LoadBalancer public IP.

http://<load balancer IP address>/MyWebApp

The demo below shows the results when I accessed it using two browser instances. Loadbalancer directed one to VM1 and the other to VM2

AzureLoadBalancer-43.png

 

Assume that one of your Virtual Machine is down or under maintenance, the load balancer auromatically redirects the traffic to other available VMs. In our case, I have stopped VM1 (WebServerVM1) to simulate such a scenario.

AzureLoadBalancer-44.png

Once VM is stopped, refresh the browser instance which was loaded from that VM1. Note that the load balancer redirects the request to VM2 as shown below.

AzureLoadBalancer-45.png

Details of internal load balancing scenarios will be discussed in another article.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s