Howdy Folks!
I was exploring Network Load Balancer in Azure Resource Manager and found out that you can also create an Internet Facing Load Balancer using Azure Portal. In this blog, I will show you How to create an External Load balancer using Azure Resource Manager. We will create two load balanced web-servers publically accessible through a common IP address. This IP address will be provided to the Internet facing load balancer that we will create in this blog post.
Scenario
xYz Corporation, a company that deals with financial services deals with managing the investment of all monies and accounting for all assets and capital project expenditures on daily basis. They provide services to both internal and external users. All these tasks are carried by a web server they have hosted publically.
The application is quite critical and hence the company can’t afford any downtime. The number of users accessing the web application may increase on a specific day. This can cause sudden crashing of the web application. Moreover, the organizations tends to update the application very frequently. They can’t afford any downtime while updating their web application. In this case, they tend to keep 2 separate similar servers. For the time being they can play with and perform updates in the second server while the original one is up and running. After verifying changes they could update the first one too.
Pre-Requirements
I will assume you have the following pre-requirements completed:
- An Azure Subscription
- Basic Networking knowledge
- 2 Windows server 2012 R2 Standard_A1 size VMs in the same VNET and corresponding subnet. Make sure both these VMs are in the Same Availability Set. They should have static private IPs and public IPs. (Public IPs are required to RDP into the machine to configure IIS)
In this Blog
- We will use 2 VMs in Resource Manager with IIS Role Installed. Both the VMs should be publically accessible using a Public IP(Public IP will be Required to RDP into the machine and install the IIS role and not for load balancing). Both the VMs are required to be in the same availability set with static private IPs.
- We will create a Load Balancer configuration with an Internet Accessible Public IP which clients will use to get connected to the website.
- We will create Backend Pools which will map your load balancer’s IP to both your Azure VM’s NICs.
- We will create a Health Probe so that when a probe fails to respond, Load Balancer stops sending new connections to the unhealthy instances. Existing connections are not impacted.
- At last we will create load balancing rule to Map public port 80 of your load balancer to your internal VMs.
Initial Configuration for IIS
Connect to both the VMs via RDP. Bind your IIS Website to the private IP address of your virtual machine. Perform this step for both the VMs. Make sure your firewall allows your server to be accessed publically. (I have turned off my firewall for the ease of explaining)
Afterwards, try to access your websites from your browser using the public IP addresses you assigned to them.
So your IIS in both the VMs have been successfully configured. Now lets move on to configuring load balancer.
Creating the load balancer
Click on `Browse’ on your Azure Portal and search for `Load Balancer’. Click On ADD to create a Load Balancer.
Add your Load Balancer’s Name. Choose Public as the scheme since we are creating the internet facing load balancer. Choose a Public IP for your VM. This IP will be used to access your websites externally. Using this particular IP all the requests will be routed to the internal web servers. Choose your subscription, resource group and Location.
Wait for your deployment to be finished. And after a couple of minutes, a new page will be opened where you can configure your LB’s settings.
Configuring the Load Balancer
Creating the Backend Pool
We will do configuration for Backend Pool first. In this menu, you can specify your Availability Set and specific VMs you want to be load balanced. In this menu, click on ADD and choose your availability set and specific VMs.
Creating the Probe
Select the Probes blade and provide it a name, your public port to connect to your VMs (80 here), and your desired configurations for path, interval and unhealthy threshold. Click Save.
Creating the Load balancing rules
Click on Load balancing rules ribbon. Click on ADD. Choose a Name, Protocol, Your Frontend Port(80 here) and the backend port. In the Backend Pool, choose the pool of those VMs we created in a previous step. Configure the rest options as desired or leave them as it is for testing.
Testing the Internet Facing Load Balancer
Since we have successfully created a load balancer and configured it accordingly, now is the time to test it. We will try browsing the public IP of the load balancer from our browser.
Here, you can see the requests are automatically routed to 1st server. We will try putting some load on the servers to see what happens. For this, I am using Visual Studio Load Tester.
After the load is thrown on the server, you will see all the incoming requests to the load balancer are routed to the second server.
So, thank you friends. This is it regarding the load balancers. If you have any queries feel free to ask in the comments. You can also follow me on twitter @SinghCloudy.
Thanks & Regards
Karanmeet Singh