How to Run Windows & IIS in the Cloud on Amazon EC2 (in 15 mins)

Choices abound for those looking for a place to run Web applications on Windows.  The purpose of this blog post is to show a quick walkthrough of how to setup your first Windows computer in the cloud on Amazon EC2.  If you’re already familiar with hosting and the cloud, skip the next few paragraphs. 

The traditional approach is to use a Windows hosting provider, like DiscountASP.NET, MaximumASP.com, CrystalTech.com, etc.  These long-time Windows hosting providers offer a flat monthly fee for shared (Web site) and dedicated server (full server) offerings ranging from a few dollars a month to a few hundred dollars a month.  This works great for anyone who wants to set up everything from a simple family or community Web site to a small business or low traffic corporate site that can run on one server.  If your site really takes off, and you want to scale it out onto many servers, you can of course pay for additional servers, and for the consulting services of your hoster to setup load balancing and more advanced network topologies.  Some Windows hosters will even help you with the management of your new Web farm, which ends up being a complex set of gymnastics to backup your data , balance traffic, and deploy and manage your Web site’s content and code across a set of distributed servers.  The cost and complexity of running a Web site on more than one server goes up pretty quickly.  And if the traffic to your site grows and shrinks based on events related to your business, you are usually stuck with the high cost of the number of servers required to host your peak load. 

New to the game are “cloud hosting” services, including Microsoft’s own Windows Azure (currently available for free in beta form), Mosso’s Cloud Sites, and Amazon’s Elastic Compute Cloud (EC2).  These cloud computing offerings differ from traditional hosting in several ways.  First, they offer a more ‘elastic’ capacity model that can grow and shrink on demand.  You tell your hosting provider how much capacity you need, and they automatically ramp up or down the number of servers to meet the demand.  The cost of the service is usually based on usage (like your electricity bill – which is why some often refer to this cloud computing as ‘utility computing’).  Microsoft, Mosso and Amazon all do this in different ways, and offer a variety of capabilities and features that are unique to each.  In some future post I may take the time to review the pros and cons of each, but for now you’ll want to read up on them yourself and decide which is the best for you.  

The purpose of this post is to provide a quick walkthrough of how to setup your own EC2 account and run Windows and IIS in about 15 mins.  Amazon’s approach to cloud computing will be familiar to anyone who is already running Windows Server themselves, as it essentially offers Administrative access to virtual server instances running on Amazon’s infrastructure.  Once you’ve created your first instance of Windows server in EC2, you can log on to your Amazon-based Windows Server via Remote Desktop and install software and manage the server the same way you would if it was running in your home or office.  Amazon just released their EC2 Web Console, which makes deploying new instances of Windows Server, and connecting to them, very easy. 

 

How to setup an Amazon EC2 account and launch your first Windows computer in the cloud

Step 1) get a free AWS account.  Navigate to http://aws.amazon.com/  Unfortunately, I found a bug in IE7 that prevents some of the console from working properly, so you’ll want to use IE6 or Firefox.  If you don’t have an AWS account, click the “Sign up Now” button.  If you already have an account, go to Step #6.

step1

 

Step 2) enter your email address and password, and click “sign in using our secure server”

step2

 

Step 3) Enter your full name, and your password

step3

 

Step 4) Enter your contact information, read and accept the license agreement by checking the checkbox at the bottom of the screen.

step4

 

Step 5) Choose “Amazon Elastic Compute Cloud”

step5

 

Step 6) Click the “Sign up for Amazon EC2” button

step6

 

Step 7) Review the current pricing.  Note to run a Windows Server the cost ranges from $0.125 to $1.20 per instance hour (and more if you include SQL Server).  At the bottom of the page, enter your credit card information and click submit.

step7

 

Step 8) Enter a new address for your billing information, or select the existing address if it is the same.

step8

 

Step 9) Click the “Complete Sign Up” button at the top of the page to begin.

step9

 

Step 10) You’ll need a certificate to authenticate with Amazon.  If you already have one, click “Upload your…”, otherwise, click “Create a New X.509 Certificate”.

step10

 

Step 11) Click Yes to generate your certificate

step11

 

Step 12) Download your private key and certificate files.  Keep them in a safe place that is protected from other users, and back them up!  When you’re done, click the “AWS Management Console” link on the left.

step12

 

Step 13) Click the “Amazon EC2” tab.  You may need to sign in again.

step13

 

Step 14) To create a new instance of Windows, click the “Launch Instances” button.

step15

 

Step 15) There are several pre-built images of Windows available.  If you want one with IIS, SQL Express, and ASP.NET pre-installed, choose the first one.

step16

 

Step 16) You’ll need a key pair in order to securely connect to your instance.  Click the “Create & Download your Key Pair” button (note IE7 beta doesn’t like this step)

step17

 

Step 17) Enter a security group name and description, and click “Continue”.  Security groups are the way you configure policy for your Web server.  For instance, you can open and close ports on a security group.  I created a Webserver security group.

step18

 

Step 18) Enter the number of instances (virtual machines) you want to create.  For testing, I enter (1).  I also leave it to “Small” instance type.  Select your key pair name and select the security groups you want to associate this instance with (for applying policy, like firewall ports).

step19

 

Step 19) Amazon will now launch your instance.  Click on the “view instances” link.

step20

 

Step 20) Note the instance is in the “starting” status.  Wait 3-5 mins for the instance to be created and to boot.

 

step21

 

Notice the “status” has changed to “running”.  Click on the instance and choose “password”.

step22

 

Step 21) you’ll want to remote desktop into your instance, which means you need the Administrative password.  By default, Amazon encrypts this password.  It takes a few minutes to generate and encrypt it.

step23

 

Once it is encrypted you’ll be able to click the “password” button again and see the screen below.  Open the keypair file you generated in Step 16 and copy + paste it into the private key field below.

step24

 

Step 22) Write down (or copy into the clipboard) the decrypted password shown.  Close the dialog.

step25

 

Step 23) Click on the “Connect” button and note that port 3389 is not currently opened, which is the port that remote desktop needs.  We’ll need to click on “security groups” in order to open it.

step26

 

Step 24) Click on the security group you created in step 17) and choose “RDP” from the list of protocols below, then click “Save”

step27

 

Step 25) Now click “Instances” and click the “connect” button for your instance.  Note you can download a shortcut file using the link provided, which makes it easy to connect (just double click the file that downloads). 

step28

 

Step 26) Otherwise, fire up Remote Desktop and enter the computer name for your Amazon EC2 instance.  Log in as Administrator using the password provided.

step28a

 

Step 27) The remote computer has an automatically generated certificate that is not automatically identified.  Click “View Certificate”

step29

 

Step 28) To install the certificate to your computer, click “install certificate” and follow the wizard.

step30

 

Step 29) you should now be connected.  Enter your Admin credentials from Step 22.

step31

 

Step 30) Open up IIS Manager and start creating your Web site!

step32

 

Step 31) You should also visit http://microsoft.com/web/channel/products/WebPlatformInstaller.aspx and install the Microsoft Web PI tool, which helps you get all the latest extensions and update in one place.

step33

step34

 

You’ll notice that Amazon currently only has Windows 2003 available, which means that it isn’t yet possibly to run IIS7!  If you’re like me, this is a real bummer as IIS7 has so many cool new features.  Please send Amazon a note letting them know you would like to see Windows 2008 available on EC2!

20 Comments

  • thanks for the post. this is great for getting a box/machine set up and running.

  • Great Article Bill - I am hoping also that Amazon moves quickly to implement IIS 7

    Dave

  • i thought 2003 did use iis7... hmm... at least its a fully featured 6 if not allowing multiple sites etc.

  • Note: Windows 2003 includes IIS6 and allows for as many web sites as you want.

  • The killer for me on this is price. $800/mo for a low-end windows server is hard to justify.

  • Very interesting and helpful! Thanks.

    Does anyone know how the costs are computed? Is the meter running as long as the instance is running? Or only when the CPU is accessed? I'm a little confused.

  • I checked it out in a glance and it was great.
    Thanks for the post.

  • If they lowered the cost and got windows server 2008 and sql server 2008 then they would get mass adoption

  • Anyone know if it is possible to buy our own windows web server 2008 for 500 and sql server standard 2008 for about 1000 and then somehow put those up on amazon ec2? Is this possible and if it is would it be a lower monthly cost because I supplied my own licensed windows server 2008 and sql server 2008??? Thanks for any perspective and great tutorial.

  • It's too costly. I can get it hosted at a datacenter for a much lower price.

  • The problem with their service is that if the instance fails for whatever reason, all data on the instance is wiped out. You need to use Elastic Block Storage for any data you want to hang around if and when the instance blows up. Elastic Block Storage is an additional expense, and it is slower than the disks (it gets charged on both data storage per month, and I/O calls). So you need to create a volume of Elastic Block Storage and associate it to the instance.
    To get set up properly you need to create an instance and configure the OS exactly how you need it, then image that instance. Then you need to buy some Elastic IP addresses, or when and if the instance blows up you get randomly reassigned a new IP address. This is also an additional expense. Furthermore, there is no means to automatically map the IP to the instance, or have the instance automatically reset itself and reload its image if and when it dies.

    This is not a reliable solution for anything but an off-site development workstation at this time. It is not viable for a production system.

  • thanks.

  • interested in this.. does it apply to users from Asia as well?

  • I received this tidbit from an Amazon Web Services representative when inquiring about Windows Server 2008.

    "Thank you for contacting Amazon Web Services. Although we are currently only able to support Windows Sever 2003, we are working to add support for Windows Server 2008 also. We anticipate being able to offer Windows Server 2008 early this year, although there are no specific dates I can provide at this point. Thank you for your interest in Amazon EC2."

  • Thank you, an excellent article, wish I had found it sooner, but it still saved me time. Excellent, excellent, Excellent !!!

  • FYI - Mosso is part of Rackspace Cloud Hosting division and offers Windows Server 2008/IIS7. Also they allow you to run PHP5 Linux/Apache servers as well. Your choice. And there is no need to add servers at peak times, this is done automatically. So you only pay for what you need, when you need it.

  • really in 15mins ? looks longer than that :)

  • Can anyone explain me about how the ASP.NET application files stored in Amazon EC2 and how to upload the image files dynamically to Amazon S3. And explain me how Amazon EC2, Amazon SimpleDB and Amazon S3 linked each other.

  • is "bills" calculation correct? My understanding is that you are only charged CPU time when your CPU is actually working.....much like your electric meter on your house. CPU's work for fractions of seconds at a time to accomplish tasks.

    If that is the case, it is overstating the costs to assume that the CPU will be in use at all times. Sure, there may be times when it is, but middle of the night?

    Is that correct?

  • Another interesting short storry could be how to install your own applications and save this to your own AMI, to have a own server on demand.

    is there a tutorial somewhere, that is as easy as this (great) one ?

    cheers
    Ralf

Comments have been disabled for this content.