“Everyone” knows about using cloud services for running web applications and databases. For example, Windows Azure offers a bevy of integrated compute, storage, messaging, monitoring, networking, identity, and ALM services across its world-wide data centers.
But what about the idea of leveraging the cloud for software development and testing? Of course there is great productivity in using hosted services for a lot of the ancillary tasks in software development – source control, issue tracking, and so on. Example cloud solutions for source control would include two that I use regularly, GitHub and Team Foundation Service (TFS). But what about for hands-on software development – creating, running, testing, and iterating on code?
There are really two significant ways you can go here. One way – that I will not be drilling into – is to use a cloud-hosted web browser-based development environment. This is what’s going on with Monaco, which is a cloud-hosted version of Visual Studio that runs entirely in a web browser – but (very awesomely) integrates with Windows Azure. There are also third-parties playing in this space, such as Cloud 9.
The other way – the one I am going to drill into – is using a Windows Azure Virtual Machine for certain development duties.
[Making a case for when and why one might create a dev-test environment in the cloud will be left for another time…]
With great power comes great responsibility
Spiderman knows this, and you need to know it as well.
Virtual Machines in the cloud cost money while they are deployed. It is your great responsibility to turn them off when you don’t need them.
The pricing for “normal” virtual machines (as opposed to MSDN Pricing which is described below) is listed at http://www.windowsazure.com/en-us/pricing/details/virtual-machines/. For example, at the time of this writing, the price for a Windows Server VM ranges from $0.02 (two cents) to $1.60 per hour, while the price for a Windows Server VM with SQL Server ranges from $2.92 to $7.40 per hour. The $7.40/hour VM is an instance running on a VM with 8 cores and 56 GB of RAM.
NOTE: just before publication time, Windows Azure announced some even larger “compute-intensive” VMs, A8 and A9 sizes. The A9 costs $4.90 per hour and sports 16 cores, 112 GB of memory, and runs on a “40 Gbit/s InfiniBand network that includes remote direct memory access (RDMA) technology for maximum efficiency of parallel Message Passing Interface (MPI) applications. […] Compute-intensive instances are optimal for running compute and network-intensive applications such as high-performance cluster applications, applications using modeling, simulation and analysis, and video encoding.” Nice! These are available for VMs in Cloud Services, and I would expect them to become available for all VMs in due course.
Some VMs cost more per hour (I’m looking at you BizTalk Server) and some costs are as yet unknown (such as for Oracle databases, which are in preview and production pricing has yet to be revealed).
VM prices vary for two reasons: (a) resources allocated (e.g., # of cores, how much RAM) and (b) licensing. For the same sized VM, one running SQL Server will cost more than one running Windows Server only. This is a feature – for example, you can rent a SQL Server license for 45 minutes if you like.
Of course, while inexpensive, and nearly inconsequential in small quantities, these prices can add up if you use a lot of VM hours. The good news is, you can release VM resources when you are not using them. You don’t incur VM costs when the VM is not occupying a VM, though there is a small storage cost that starts at $0.07 (seven cents) per GB per month.
Just don’t forget to free your resources before leaving for vacation.
Fortunately, VMs can easily be stopped in the portal, by using the Remove-AzureVM PowerShell cmdlet, by using the azure vm shutdown command from the cross-platform CLI, through management REST APIs, or using one of the language SDKs.
Example prices were expressed in terms of “per hour” but the pricing granularity is actually by the minute. In some clouds, usage granularity is hourly, or possibly “any part of the hour” meaning a VM deployed from, say, 7:50 to 8:10 would incur 120 minutes of billing (two hours), even though actual time was 20 minutes. In Azure, you would be billed 20 minutes. The billing granularity matters more when using VMs for focused tasks like developers and testers would tend to do.
Further, there’s a data transfer price for data leaving the data center.
You may be interested in Windows Azure Billing Alerts.
MSDN Pricing – A Big Cloudy Discount
If you have an MSDN account (not just for big companies, but also with startups) – as long as you claim your Azure benefits – magically, you are eligible for special MSDN Pricing. Check for the current MSDN discounted pricing, but as of this writing MSDN includes either $50, $100, or $150 of Azure credits per month, depending on your level of MSDN. Anyone on your team with an MSDN account will have their own Azure credits.
This means that your monthly bill will draw from this balance before you incur actual costs. You can also choose to configure the account to not allow overages, such that when your monthly allotment is exhausted, consumption stops. This way you know your credit card will not be charged. You can selectively re-enable it for the rest of the month. This is not a bad default setting to avoid runaway dev-test costs due to forgetting to turn off resources when you didn’t need them.
Beyond this, you get a huge discount on other VMs – no matter what the VM is, you never pay more than $0.06 per hour per small VM unit.
MSDN pricing only applies to resources used for Dev-Test – it is not licensed for production use, nor does it come with an SLA.
But that’s such a good deal, that anyone using Windows Azure for Dev-Test should take a hard look at this option if they don’t already have an MSDN account. But this post is all about creating a Dev-Test VM, so let’s get on with it.
Creating a Dev-Test Virtual Machine in Windows Azure
Let’s set up for C#, Python, and Node.js development.
First, log into your Windows Azure account at https://manage.windowsazure.com.
If the MSDN checkbox is disabled, you have logged into a Windows Azure account that is not associated with your MSDN account. Change to the correct account to proceed.
Select the MSDN checkbox to filter out any VM image not specific to MSDN subscribers, and see the list of available VM images change to the following:
Note the text on the descriptive text on the right-hand side, which I’ve included here since it provides some useful information.
The Visual Studio Professional 2013 developer desktop is an offering exclusive to MSDN subscribers. The image includes Visual Studio Professional 2013, SharePoint 2013 Trial, SQL Server 2012 Developer edition, Windows Azure SDK for .NET 2.2 and configuration scripts to quickly create a development environment for Web, SQL and SharePoint 2013 development.
To learn how to configure any development environment you can follow the links on the desktop.
We recommend a Large VM size for SQL and Web development and ExtraLarge VM size for SharePoint development.
Please see http://go.microsoft.com/fwlink/?LinkID=329862 for a detailed description of the image. Privacy note: This image has been preconfigured for Windows Azure, including enabling the Visual Studio Experience Improvement Program for Visual Studio, which can be disabled.”
Choose one of the Visual Studio images (I will choose Visual Studio Professional 2013) and go to the next page by clicking the arrow at the bottom-right.
Fill in the fields. The username and password will be needed later to RDP into the box. Click the arrow to go to the next page.
I kept most of the defaults, only changing the REGION to be “East US” to minimize latency to my current location. Click arrow to go to next page.
If I planned to use this for giving a talk in another geographic location, I may choose a different region. For example, I may choose “North Europe” (Dublin) if I was speaking in Ireland (which would be wonderful and I hope happens some day :-)).
No changes on this page, so click check-mark to finish.
The portal will “think” for a short time, then your new virtual machine – listed under the name you gave it (“vspro-demo” for me), with the corresponding cloud service that was created (“vspro-demo.cloudapp.net” for me) which also serves as its DNS name (that you’ll use to access it via RDP).
Once it finishes, you can select it and hit CONNECT. This will download a file that will launch the RDP client which will allow you to login.
I usually check off “Don’t ask me again…” because I know this connection is fine.
Note that here you will want to click “Use another account” so you can specify your VM-specific credentials.
Click OK then…
I usually check off “Don’t ask me again…” because I know this connection is fine.
Now I’m in!
Configuring your Dev-Test Machine on Windows Azure
When configuring a new machine, there are many tools you may want to install. For this exercise, I will keep it simple. (The following use my handy “which” function in PowerShell to find locations of commands in the path. If you add “which” to your environment, be sure to close your PowerShell shell and open a new one so that the new $PROFILE is processed. If you
choose to not install “which” then issue the same commands and you should just get errors instead.)
With a PowerShell shell, let’s investigate what we have on a new machine.
We can see that, in turn, that:
- While PowerShell is installed (we are running in a PowerShell shell), there are no PowerShell cmdlets with “Azure” in the name.
- Node.js is not found (no Node Package Manager (npm) and no Node runtime (node).
- The cross-platform (xplat) Command Line Interface (CLI) is not installed. This has Node.js as a dependency.
- No Python interpreter is installed.
- The Web Platform Installer actually is installed, so let’s use that to add the other pieces to our development environment.
After filtering, in succession, (in search box at the top-right)…
.. on PowerShell:
Click the “Add” button to add the latest “Windows Azure PowerShell” release.
.. on Cross-platform:
Click the “Add” button to add the latest “Windows Azure Cross-platform Command Line Tools” release.
and .. on Python:
Click the “Add” button to add the latest “Windows Azure SDK for Python” release.
Click the “Add” button to add the latest “Python Tools 2.0 for Visual Studio 2013” release. This includes some really cool python tooling for Visual Studio, though we won’t discuss it further in this post.
Now click the “Install” button to start the installation.
You can accept all the licensing with one click.
The installation will download and install the items you selected, including any dependencies.
(compiling Python distribution as part of the installation…)
Installation is complete.
Verifying the Installation
Open a new PowerShell Window to explore once again.
Note that we ran the “get-help azure” command through a filter (the Measure-Object cmdlet, which was used to count lines) since output would otherwise not have fit on one screen (there are a couple of hundred Azure cmdlets in the list). Of npm, node, azure, and python, only azure (via azure.cmd, the entry point to the CLI) shows up in our path. This is okay, since we can now run azure at the command line and it knows where to find Node.js.
As for python, that is now installed at c:\python27\python.exe. We can either add c:\python to our path, or invoke it explicitly using the full path. For our simple example, we’ll just invoke it explicitly. To see that the Windows Azure SDK for Python is installed, we can use pip, a Python package manager, to list the installed packages.
We can see that “azure (0.7.1)” is installed.
Done. Now go write some Python, Node, or C# code!
- Intro to using Python with Windows Azure (whitepaper)
- Windows Azure for Linux and Mac Users (whitepaper)
- Windows Azure SDK documentation
- Using Multiple Monitors when you RDP to Windows Azure VM