Recently, cloud platforms have emerged as a great way to build and deploy applications that require elastic scale, high reliability, and a rapid release cadence. By eliminating the need to buy and maintain hardware, the cloud gives developers inexpensive, on-demand access to computers, storage, and bandwidth without any commitment. Developing for the cloud also makes it easy and less risky to try out new ideas. If an idea is successful, it can be scaled up by adding more hardware. If an idea is unsuccessful, it can be shut down quickly.
The core benefits of the cloud were obvious from the start, but when I joined the Windows Azure team in 2007, the cloud was primarily seen as a way to provision virtual machines on demand. What excited me about Windows Azure was that it was a new kind of cloud platform that went beyond this. Microsoft set out to create a platform that made it easy for developers to build scalable and reliable applications without having to become experts in infrastructure. Today, I'm excited to see that the idea of a platform as a service (PaaS) model has grown and matured, and there are now many cloud providers that are recognizing this model.
As much as Windows Azure has changed and grown since I first joined the team, the core benefits have remained constant. Windows Azure offers an easy development experience, it gives developers the flexibility to choose their favorite tools, and it supports very demanding workloads.
Building Your First Cloud Application
Because Windows Azure supports many kinds of applications, programming languages, and tools, there are lots of ways you can get started, but let's start with an ASP.NET web application as an example.
The Installing the SDK and Getting a Subscription tutorial walks you through the process of getting your development environment ready for Windows Azure. Note that you don't actually need to sign up for Windows Azure to get the tools and start developing. The steps below are based on version 1.5 of the SDK.
Once you have the tools installed, start Visual Studio as an administrator, and create a new project based on the "Windows Azure Project" template as pictured in Figure 1.
Next, you'll be prompted to choose one or more "roles" for your application. In the next section, we'll learn more about roles and the part they play in cloud architecture. For now, just choose an ASP.NET MVC 3 Web Role by highlighting it and clicking the right arrow to add it to your solution, as in Figure 2.
As with any ASP.NET MVC application, the next screen will ask you what kind of MVC application you want to build. Just to get something to play with, I suggest choosing the "Internet Application" template; see Figure 3.
At this point, you have a functioning Windows Azure application. You can run it locally by pressing F5, and when you're ready to deploy to the cloud, you can choose either "Package" to create the files you'll need to deploy to the cloud, or "Publish" to deploy directly from Visual Studio; see Figure 4.
Now you can develop your custom application simply by editing the default ASP.NET MVC template, as you would for any ASP.NET application.
What you've seen so far may not look that impressive on the surface. We built a simple web application and ran it locally. It was easy to do, but we could have done that without Windows Azure. What's truly impressive is that this same application, without modification, can easily be deployed and scaled across many servers and even multiple data centers with ease. I can also update my application at any time without having to touch individual servers and without any downtime. All of this is possible because of Windows Azure's scalable programming model.
Scalable Programming Model
Not every application needs to grow to thousands of virtual machines and terabytes of data, but some do; and it's often the case that the developer of an application doesn't know what scale will ultimately be required. So, it's important to use a cloud platform that supports applications of any scale.
As is typical in the cloud, Windows Azure encourages a scale-out architecture. Scale-out means that your application's elastic scale is achieved by adding or removing virtual machines (not by moving to bigger and bigger servers, which would be called "scale up"). Scale-out architecture also gives your application reliability, high availability, and the ability to be upgraded without downtime.
In Windows Azure, this scale-out architecture is implemented by use of roles. A role is a component of your application that runs on multiple instances (virtual machines). Each instance of a role runs identical code, so a role can be scaled simply by adding or removing instances.
In the application we built in the previous section, our application had exactly one role (the ASP.NET MVC 3 web role). In a typical three-tier application, you might have a front-end web role and a back-end service role (along with a database for the third tier). Each role has its own code and can be scaled independently. Any role that accepts traffic from the internet (like a web application) sits behind a load balancer, ensuring that all instances contribute to your application's scalability.
For this architecture to work, each virtual machine needs to be identical. That means it needs to be running the same code (which it is, thanks to the concepts of roles). It also needs to have the same data. To make sure that all virtual machines have the same data, data should be centralized in a storage system. This model is exactly like a web farm with a database for storage.