Mementos from the life of Kevin Johnson

Wednesday, January 19, 2011

Creating a Windows AMI that can be bootstrapped

Creating an ami from a windows instance is pretty easy. I launched an instance of the default Windows Server 2008 ami provided by Amazon. After getting it set up the way that I wanted (including enabling bootstrapping, more on that later) I went to the ec2 console and stopped the instance. (Note, stopped, not terminated). Once the instance was stopped I right clicked on the stopped instance and selected "Create Image (EBS AMI)". Give it a name and a description and in a few minutes your AMI will be created.

Bootstrapping the Windows AMI

The hardest part of getting the Windows AMI set up was going through the bootstrapping process. Essentially this enables you to get a base image, and then select at startup what the server will be serving. It turns out that, unlike the ubuntu images, Windows has no built in facility for executing a script provided by user-data. So, I had to make one.

I have posted an installer here that installs a service on your windows machine. This will check the user-data field on bootup. It is looking for the name of a zip file that lives in the cs462-packages bucket. This zip file should contain the files that should end up in c:\inetpub\wwroot. I know, it's a bit hardcoded, but it fits my needs and I wasn't writing it for the public in general. If you belong to the CS 462 class at BYU Winter 2011 you are welcome to set up your own Windows AMI using this service to help you bootstrap.

The nice thing about this, is that your user-data will consist of a single line, for example:
mylab1.zip

That's it! Then when your computer boots up it will download that package, extract it to inetpub\wwwroot and life will be good!

GO Windows! Happy .NET Coding!

Thursday, January 13, 2011

Getting Started

So, contrary to the suggestion of the TA, I have chosen to use the Windows operating system (rather than ubuntu) and I will be using C# as my development platform for our 462 distributed systems project this semester.

I have gone through the process of setting up a windows server on Amazon's EC2 service. It is super simple. The only drawback is that it takes 20 min or so to start up. I'm guessing this is due to sysprep doing it's first run thing. Oh well, it's a small price to pay to be able to interact with the operating system in a remote control session. The AMI (Amazon Machine Image?) that I found comes with Windows 2008 and IIS 7.0 with .NET 3.5 installed. So, basically the only thing left to do, once the machine comes up, is copy over an asp.net website into the inetpup\wwwroot folder. It worked like a dream.

I don't anticipate everything going this smoothly, but so far so good for using Windows for this class.