Monday, June 11, 2012

Reintroducing Windows Azure, Part 4: Linux Virtual Machines

In this series we’re taking a fresh look at Windows Azure, which was re-launched on June 7 with a highly-publicized Meet Windows Azure event. In Part 3 we looked at the new Virtual Machines feature from a Windows perspective, and here in Part 4 we’ll do it from a Linux perspective.


The Linux Experience
We’ve already seen how Virtual Machines work generally, but Windows Azure now also supports Linux. What is the Linux experience? We’ll perform the same tasks we did in Part 3, this time using Linux. You’ll see that the procedures are similar though not identical for working with Linux VMs. Well cover creating a Linux VM, remote connecting to a cloud VM, creating an image from a VM, and creating instances from an image.




Creating a Linux VM
We can create a Linux VM by selecting CREATE A NEW VIRTUAL MACHINE in the Virtual Machines area of the portal, or by clicking + New at the bottom left. Select FROM GALLERY, and a list of images will be displayed that includes several flavors of Linux such as OpenLogic CentOS, SUSE Linux Enterprise Server, Ubuntu Server, and openSUSE. We’ll choose openSUSE here.



As we complete the wizard, we’re prompted to provide the following information:
· A name and DNS name for our Virtual Machine (we’re going with “susie” in our example)
· Administrator credentials for remote connections
· VM size
· Region (the data center to provision in)

You’re also accepting the license terms of the Linux distribution as you do this.



With the wizard complete, provisioning begins. You’ll initially see a Starting (provisioning) status.



When you see a status of Running, which will take a few minutes, provisioning is complete and the VM can be used.

Windows Azure Virtual Machines are persistent, meaning the disk is backed by triple-redundant storage, so we don’t have to worry about losing changes to local disk files.
Soon, we’ll be able to see the usage metrics of our VM in the portal. Metrics include CPU performance, data in/out, and disk read/write throughput.


Remote Connecting to a Linux VM
There are several ways to connect to a Linux VM, such as ssh, vnc, and putty. To connect from a Windows PC, ssh or putty can be used. Here, we’ll be connecting from a Windows PC using putty.exe.

By clicking through to the detail page on the portal, we can see the information we need to make a remote connection.


Clicking Open makes a connection….



Now we’re connected. We enter the administrator credentials we specified when we created the VM to log in.

After performing whatever work we want, we can log out and end the session.

At this point you might just start using your VM, but sometimes you'll want to  derive a reusable image from it. That's what we'll do in the next step.

Creating a Reusable Image from a Linux VM
After setting up a Linux VM the way we want it, we may want to use this configuration again in the future without having to set it up manually again. We do this by creating an image. This involves three steps:

1.       Prep the VM for capture.
2.       Shut down the VM.
3.       Capture the VM’s disk and create an image from it.

Step 1: We invoke the Windows Azure Linux Agent with the command waagent -deprovision. Note, the exact path for this command may vary from one Linux distro to the next.

Step 2: With the image deprovisioned, we shut it down, using the portal’s SHUTDOWNcommand. Wait until the status changes to Stopped.





Step 3: With the VM stopped, we capture its VHD into an image using the portal’s CAPTURE command. We name our image and confirm that we have de-provisioned the VM.




With completion of the capture, our original VM is decommissioned but we now have an image named MySuse listed in the Images section:



Now we can create instances from this image. Let’s create a new virtual machine from our gallery. Our newly created MySuse image is listed in the gallery along with the default images from Microsoft:




We complete the wizard, and soon our VM instance is provisioned.




We can proceed to create additional instances from the same image. Let’s create another, named MySuse-02, and link it to the first image (MySuse-01) so they can work together (for example, to share a load-balanced endpoint).



Lastly, we can put these two machines in the same availability set. That means they will be distributed across different fault domains in the data center, so that even a large failure (such as a power supply or a rack switch) will not take out all servers.

When provisioning completes, we have two VM instances created from our gallery image.


If our VMs were set up to handle web traffic, we would next add a load-balanced HTTP endpoint just as we did in Part 3. The procedure is identical, so we won’t repeat it here.

Summary
Windows Azure Virtual Machines provides an exciting IaaS counterpart to the platform’s traditional PaaS offering. The new portal and ability to do in-cloud VM composition make this feature very accessible. In this post we showed that the capabilities and level of experience for Linux match that provided for Windows. The support for both operating systems is top notch.

No comments: