Howto setup load balanced IaaS Linux virtual machines using the Windows Azure LoadBalancer
Recently a customer brought us a bunch of Linux machines with various application servers already installed on them that should be brought to Windows Azure.
The initial customer environment included 2 separate Linux based Load Balancers we finally could replace easily by using the Windows Azure built in Load Balancer.
This step not only reduces administration complexity but also saves the customer money ( 2 machines less to operate/run)
I want to describe the necessary steps in the following step by step:
Using the Windows Azure Portal we started by provisioning the first Linux machine. You can both use one of the available stock images –or– virtual machines build up by your own (It’s even possible to convert Linux VM Images that ran on VMWare, check out how to convert them to the *.vhd format we use on Windows Azure: https://blogs.msdn.com/b/robertvi/archive/2013/03/14/howto-move-a-linux-vm-from-vmware-to-windows-azure-vm.aspx
Creating the first Linux application server (in the picture I’m using a stock image, but it’s exactly the same procedure using your existing *.vhd’s)
Choose your operating system. If you want to use your own disk (instead of a stock image) you need to choose “FROM GALLERY” and follow the steps to create the machine based on a 'MY DISKS' (*.vhd) you uploaded to your Windows Azure Storage Account before. Finalize your settings and let Azure create the machine.
Quick win … the first machine is running ...
Now we want to create the second VM, it’s important here not to use QUICK Create, but to use “FROM GALLERY”.
The reason for this is that only “FROM GALLERY” gives us the advanced options we need later on.
The creation itself is straight forward:
The next step is the important one:
We connect this 2nd machine to the already existing 1st machine already during the setup process:
Note, we now have a second machine, but this machine shows the same external DNS name as the first one.
We can connect to the machines by using SSH, the connection parameters are available in the Dashboard section for each
Virtual machine in the portal, you need to click on the little arrow to get there. (yes, sometimes we hide good things a little;-)
scroll down a little on the right side you something like this:
Simply cut and paste the entire connection info (including the port number!) and start f.e. putty with it:
(putty is smart enough to recognize the port number from command line…) so we can see the 2 machines and their different internal IP's
Next we configure the endpoints that should be available to the outside world, ..starting on machine 1
Guess what ? .. the little arrow is your friend again ;-)
By clicking on “ENDPOINTS” we specify one or more connections that are visible to the “internet side” of the Azure Load Balancer.
In our case, since it’s a web server we use port 80. Please note that we cloud use a different port on the ‘inner’ side if we want, or add more ports (f.e. 443 for SSL)
We end up with port 80 being opened to the outside world on the first machine. Note that it still knows nothing about being load balanced!
Now we do the same for the second machine:
On the second machine we specify this to be a load balanced port, and (magic ;-), it already shows us the ports we can add as load balanced
That’s all!
If you switch back to the ENDPOINTS view you can see this port now as LOAD BALANCED for both VM’s
Finished!
The procedure is the same if you put the VM's into a VPN within Azure.
Johann Weinzierl