In this column you will see how to setup and start using the Amazon Web Services’ -AWS- most popular offering with C#. Probably you’re reading this column because you’ve been trying to figure out for a while what are the Amazon Web Services -AWS- and you are still full of questions and new words/acronyms.

Simply put, AWS is a collection of more than 25 services, each one of them focuses in a particular area of cloud computing (i.e. storage, load balancing and so on). In its early days AWS was called by their competitors as an “Infrastructure as a service (IaaS)” provider, but nowadays the line between IaaS and “Platform as a service (PaaS)” is thinner than ever.

The most popular services are: Amazon EC2, Elastic Load Balancer, Amazon Elastic Block Storage -EBS-, Amazon S3, Amazon DynamoDB, Amazon SimpleDB, Amazon Simple Queue Service, Amazon Simple Notification Service, Amazon Cloudwatch and Amazon RDS.

Some of the names are very meaningful, so I will focus on the strange ones. The Amazon EC2 is the starting point, is at the bottom of the pyramid and is basically a virtual machine that you can provision with the Operative System that you want and with the hardware capacity that you want. The most important thing to know here is that you have access to the virtual machine using a remote desktop connection and that you have full control of it, however as much as you manually modify the machine, as much you won’t scale easy.

E2C Instances come in two flavours: standard and reserved. Standard instances are similar to the “Pay As You Go” model, while the reserved instances are more like a compromise of future usage. Familiarise yourself with the instances’ world:

  • The instance’s hard discs are ephemeral storage, so should not be used (think about it as placing your documents and operative system files together, it’s a best idea to have an instance separated storage volume).
  • You will be billed based on an hourly fee, so no matter if you don’t use the instance; if it’s turned on you’ll be charged.
  • An AMI is an image/template of whatever you want to install into the instance.
  • Amazon takes care of the AMI only (updates and patches), so you have to update the instance by yourself.

EBS and S3 are like large hard disks (the most important difference is that S3 exist without instances). DynamoDB is a no-SQL data base and SimpleDB is a non-relational data base. Bear in mind that no-SQL is not the same that non-relational. The Cloudwatch is a monitoring service and RDS is like a wrapper around the most popular databases in the market (MS SQL Server, Oracle and MySQL). That’s it. No pain.

There is also the AWS Management Console, which is a simple Web Console that makes easier accessing to all services in one place. If you’re deploying a small web site or blog maybe you will be comfortable with using only an E2C instance, so for you AWS will look identical to any other kind of hosting, but if you’re planning an enterprise application or a consumer application you will look for the cloud-computing “economy of scale” promise.

Let’s do this simple scenario (wondering why the excessive use of the “simple” word): imagine you want an application deployed into an E2C instance and a data base under RDS’s control, so before starting please sign up in Amazon to get an account, then download the AWS SDK for .Net here and finally login into the AWS Management Console.

First select E2C and create a new instance. During this process you you’ll be asked some few questions about the features you want; the wizard (shown in the next image) makes the process easy, so let’s move to the next step.

The second step is preparing the data base which is also what you usually do when deploying an application. Don’t get in panic, in the AWS world a data base is (from a minimalist point of view) the same data base technology that you already know, with the difference that don’t directly create and maintain the infrastructure but you do it through Amazon and the get the connection string required to point your application to the right service. At this moment I point you to this good resource at the Amazon site for you see how a data base instance is created. I only what to recall about two things: 1) you can create an instance using any of the available data base engines, including MySQL, Oracle and SQL Server as shown in the next image and 2) you can opt paying a monthly fee for backup and maintenance services.

The first and second steps were almost evident but now you may be wondering which of the 25+ services is next: maybe the load balancer stuff is next? Or the storage service? well, there are pretty good news: there is a service called “Elastic Beanstalk” which is an even easier way to deploy and manage applications. From Visual Studio, open the AWS explorer and you will see the AWS Explorer as shown in the image below (go here for more information on the AWS SDK for .Net).

From there you can right click on the AWS Elastic Beanstalk to create a new application. The process is easy and abstracts you from the complexity behind it, so let me point to you this video for following the steps. Just make sure you double check the region as described in the next picture.

After watching the video you will see the Elastic Beanstalk’s results: a set up environment with all required settings for load balancing, auto scaling, monitoring and notifications. Isn’t it cool? Yes, it is. See in the next image how to define the minimum and maximum number of server when auto-scaling.

Another nice feature is the “Load Balancer” which makes a pretty good job demystifying the software developer’s expected complexity because in turn it makes easy to setup and understand the whole routing stuff, as it’s shown in the next image. No pain, again.

But nothing is perfect and sometimes abstraction involves a lose of control over specific features, from a C# developer point of view, the Elastic Beanstalk’s publish wizard lacks many options to property configure a web.config file or IIS’ application pool as it’s shown in the next image (it’s in fact too generic).

By reading this column and the suggested links I hope you have an application working in the cloud. If not, keep trying, mistakes may happen but unless you embrace and try any new technology you won’t learn. I have seen sometimes that the E2C machines never get the Windows Administrator password or MySQL instances requiring extra steps to simply create a stored procedure, but nothing that you can not solve by doing some searching.

[UPDATE 17.07.2012: MySql instances on Amazon are case sensitive and the parameter is no editable via the Management Console. More info here and here]

Cheers,

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP
Intel Black Belt Software Developer