This is the first in a series of blog posts on getting started with building .NET applications in Windows Azure. We’ve been a big fan of Azure for a lot of years, and we’ve used it for SportsCommander.com’s event registration site since the very beginning.
I started off writing a blog post on automatically deploying web applications to Azure from TeamCity, but I ended up with too many “this blog assumes…” statements, so I figured should take care of those assumptions first.
What the deuce is Windows Azure any why should I care?
According to Wikipedia, Windows Azure is:
Windows Azure is a Microsoft cloud computing platform used to build, deploy and manage applications through a global network of Microsoft-managed datacenters. Windows Azure allows for applications to be built using many different programming languages, tools or frameworks and makes it possible for developers to integrate their public cloud applications in their existing IT environment. Windows Azure provides both Platform as a Service (PaaS) and Infrastructure as a Service (IaaS) services and is classified as the “Public Cloud” in Microsoft’s cloud computing strategy, along with its Software as a Service (SaaS) offering, Microsoft Online Services.
According to me, Windows Azure is:
A hosting platform, sort of line Amazon EC2, because you can deploy to virtual machines that abstract away all of the physical configuration junk that I don’t want to care about, but even better because it also abstracts away the server configuration stuff that I also don’t want to care about, so I can just build code and ship it up there and watch run without having to care about RAID drives or network switches or load balancers or whether someone is logging into these servers and running Windows Update on them.
Azure has grown into a lot of things, but as far as I’m concern Azure primary product is a Platform-as-a-Service (Paas) offering called Cloud Services. Cloud Services lets you use combination of Web Roles and Worker Roles to run web applications and background services.
These types of terms get thrown around a lot these days, so let’s defined them.
Before the cloud came in to overshadow our whole lives, we had the these options:
- Nothing-as-a-Service: You went to Best Buy and bought a “server.” You’re running it under your desk. Your site goes down when your power goes out or someone kicks the plug out of the wall. Or when your residential internet provider changes your IP because you won’t shell out the money for a business account with static IPs. Then the hard drive fan dies and catches fire, your mom complains about the burning smell and tells you to get a real job.
- Co-Location: This is a step up. You still bought the server and own it, but you brought it down the street to hosting company that takes care of it for you, but you are still responsible for the hardware and software, and when the hard drive dies you have to shlep down to the store to get a new one.
- Dedicated Hosting: So you still have a single physical box, but you don’t own it, you rent it from the data center. This cost hundreds up to thousands per month, depending on how fancy you wanted to get. You are responsible for the software, but they take care of the hardware. When a network card dies, they swap it out for a new one.
- Shared Hosting: Instead of renting a whole server, you just rent a few folders. This option is very popular for very small sites, and can cost as little as $5-$10/month. You have very little control over the enviornment though, and you’re fighting everyone else on that server for resources.
- Virtual Hosting: A cross between Dedicated and Shared hosting. You get a whole machine, but it’s a virtual machine (VM) running on a physical machine with a bunch of other virtual machines. This is the ground work for Infrastructure as a service. You get a lot more control of the operating system, and supposedly you are not fighting with the other VMs for resources, but in reality there can always be some contention, especially for disk I/O. The cost is usually significantly less than dedicated hosting. You don’t care at all about the physical machines, because if one piece of physical hardware fails, you can be transferred to another physical machine.
In today’s brave new cloudy buzzword world, you have:
- Infrastructure-as-a-service: This is basically Virtual Hosting, where you get a virtual machine and all of the physical machine info is abstracted away from you. You say you want a Windows 2008 Standard Server, and in a few minutes you have a VM running that OS. Amazon EC2 is the classic example of this.
- Platform-as-a-Service: This is one level higher in the abstraction. It means that you write some code, and package it up in a certain way, give it some general hosting information like host name and number of instances, and then the hosting company takes it from there. Windows Azure is an example of this, along with Google App Engine.
- Software-as-a-Service (SaaS): This means that someone is running some software that you depend on. Either you interact with it directly, or your software interacts with it. You don’t own or write or host any code yourself. The classic example of this is SalesForce.com.
So why is Azure and PaaS more awesome than the other options?
Because it let’s me focus on the stuff that really care about, which is building software. As long as I follow the rules for building Azure web applications, I don’t have to worry about any of the operations stuff that I’m really not an expert in, like have I applied the right Windows updates and is my application domain identity setup up correctly and how do I add machines to the load balancer and a whole lot of other stuff I don’t even know that I don’t know.
Some IT balk at this and insist that you should control your whole stack, down to the physical servers. That is a great goal once you get big enough to hire those folks, but when you are getting started in a business, your time is your most valuable asset, and you need a zero-entry ramp and you need to defer as much as possible to experts. If you are spending time running Windows Updates on your servers when you are the only developer and you could be coding, you are robbing your company blind.
Shared hosting platforms were close to solving this problem. As long as your website was just a website, and it’s small, you could host it on a shared hosting service and not worry about anything, until somebody else pegs the CPU or memory. Or if you need to go outside the box a little and run a persistent scheduled background process. Also, scaling across mulitple servers is pretty much out of the question, you are stuck with “less than one server” of capacity, and you can never go higher.
But after you grow out of shared hosting and move up to dedicated hosting or virtual hosting, it costs a whole lot more per month (like 5x or 10x), and the increased maintenance effort is even worse. It’s a pretty step cliff to jump off from shared to dedicated/virtual hosting.
Azure fills that gap more cleanly nicely. You are still just focusing on the application instead of the server, but you get a lot more power with features like Worker Roles and Azure Storage, and you can even expand out into full blown VMs if you really need it.
Ah ha, VMs! What about them? And Azure Websites?
By the time you’ve read this blog post, I’m sure the Azure team will have come out with 27 new features. Ever since the Scott Gu took over Azure, the rate at which Azure’s been releasing new features has gotten a little ridiculous. Two for of the more interesting features are Azure VMs and Azure Websites.
Azure VMs were late feature that it seems like the Azure team didn’t even really want to add. Every Azure web instance is actually a VM, so this lets you remote into the underlying machine like it was a regular Windows server, or even create new VMs by uploading the an existing VM image. This was introduced so that companies could have an easier migration path to Azure. If they app still needed some refactoring to fit cleanly into an Azure web or worker role, or it had dependencies on other systems that would not fit into an Azure application, it gives them a bridge to get there, instead of having to rewrite the whole world in one day. But to be clear, this was not introduced because it’s a good idea to run a bunch of VMs in Azure, because it misses out on the core abstraction and functionality that Azure offers. If you really just want VMs, just go to Amazon EC2, they are the experts.
Azure Website are a more recent feature (still in Beta) which mimics shared hosting in the Azure world. While the feature set is more involved than your run of the mill shared hosting platform, it does not nearly give you the power that Azure Cloud Services provides. They work best with simple or canned websites, like DotNetNuke, Orchard CMS, or WordPress. In fact, right now we’re testing out moving this blog and the MMDB Solutions website to Azure Websites to consolidate and simplify our infrastructure.
In the coming blog posts, I’ll cover some more stuff like creating an account, setting up an Azure web application, deploying it, dealing with SQL Azure, and lots more. Stay tuned.