Tuesday, March 8, 2011

Book Review - Programming Amazon EC2

March 08, 2011 Posted by Jason , No comments

Disclosure: I received a review copy of Programming Amazon EC2 from O’Reilly.

Programming Amazon EC2

I read somewhere that Programming Amazon EC2 is a title for people looking to adopt Amazon’s cloud platforms while avoiding a large amount of trial and error. I’ve been wanting to play around on this platform for a long time but have been a little intimidated by the myriad of terms and acronyms used to describe the available tools and configurations at my disposal. I fit firmly into the demographic that wants to get up and running with Amazon but doesn’t have the time to learn in this manner. The book is a pretty quick read and is packed full of useful information. Despite a couple of issues this is the de facto guide to Amazon’s web offerings and should (and will) act as a bible for anyone embarking on such a project. This book will undoubtedly save me countless hours in my future endeavors with these services and will pay for itself in no time. I highly recommend it.

While this book had a far narrower focus than most of the titles I’ve read recently it fit my needs perfectly and fulfilled its goal of getting me up and running with these services with little fuss. It is a pretty short title but very detailed, breaking down the key technologies and working through examples of improving the infrastructure of existing applications by adopting said technologies. The book starts with a brief timeline of when each technology was created by Amazon and, more interestingly, what gap they were created to fill. This was somewhat insightful and especially interesting when you consider the scale of Amazon’s online store and their adoption of said technologies. The proceeding chapters go into each technology in detail. The authors really know their stuff and there are some great tips from real life experience – some of which have the potential to save a lot of experimentation and frustration as one works their way through some existing idiosyncrasies. Furthermore the authors are cost-conscious and in a number of places provided guidance with regard to maintain resource utilization levels for optimum return on investment. The book provides a number of very useful scripts not only to create an environment but to monitor interesting metrics and planning for improvement once in the wild.
The book’s greatest strength is also its greatest weakness. As mentioned above, the content is based firmly on real world production applications. The issue with this is that it is written mostly from the standpoint of taking existing applications and moving them to the cloud. For greenfield projects there are some very important omissions which I found somewhat frustrating. Firstly, the authors do not discuss alternative development/testing environments. Specifically, when using a service where you pay money based on time, bandwidth etc. I wonder if there is any way to develop offline in a local sandbox or, for the two years it takes to bring the product to market, I am expected to pay regular Amazon rates associated with a production environment? Furthermore, am I expected to be constantly connected when developing a solution against SimpleDB, SQS, etc. It may seem like a small point but, when planning a new project, is extremely important. The answer might be straightforward (and I’m willing to bet most organizations develop against real AWS instances and are online all the time) but having read the title cover to cover I still don’t know the answer. Secondly, the authors omit information about licensing. Most of the discussion is Linux based, but I was really hoping for a breakdown of what is required if, say, I want to run Windows Server and SQL Server Enterprise. How does licensing work in these scenarios? If I get an AMI with these loaded then are my licensing costs included in the fees I am already paying, etc. Again, this is information that I would need before suggesting that my organization adopt AWS, but at this point in time I do not know.

Other than the above issues I really can’t say much bad about this book. It does exactly what it promises and provides a great introduction to the acronym laden world of Amazon’s web infrastructure. The material is extremely specific so this isn’t something I’d recommend to just anyone. But if you’re thinking about moving to the cloud then this title is a must. I could make a pretty good business case for Amazon to offer this title free to developers as it makes a very strong case for using their services.

Saturday, March 5, 2011

Up and running with IIS 7.5 Express

March 05, 2011 Posted by Jason , 6 comments

I’ve been excited to play around with IIS Express since Scott Guthrie’s announcement. I recently loaded up VS2010 SP1 and decided it was time to play around with IIS. The promise is wonderful – a  lightweight but rich version of IIS – including SSL, URL Rewrite, media support, etc. - that doesn’t require elevated privileges to run and can even run on Windows XP. 

After installing IIS Express through the Web Platform Installer things went awry. From the reading I had done on the subject it seemed like the express version would be a quick and easy alternative to the full blown IIS, but unfortunately configuration is (right now) a bit of a PITA requiring IIS Express config file editing, net shell configuration changes and quite a bit of trial and error.

I was expecting IIS Express to be a portable solution – but now see that it is going to be a bit of a pain to get configured how I like it when I move PCs or reimage my box. A certain amount of this is necessary due to the elevated privileges we need but are trying to circumvent (in my example below using well-known/reserved ports 80 and 443) but I wonder if updates to IIS Express application bindings could have been moved from the applicationhost.config file to individual websites’ web.config files allowing everything to be stored in version control systems, allowing multiple users to share said configurations and, in general, making life a little easier for everyone concerned…As things stand it is actually a lot easier – when one has admin permissions on their box – to get up and running quickly with the full blown version of IIS...

The Adventure

I immediately ran into problems using IIS Express with an ASP.NET MVC 3 application that relies on port 80 for http and 443 for https. Essentially, IIS express expects ports between 44300 (defaulting to this value) and 44399 to be used for SSL and trying to use another port, say 443, results URL binding failure…

A Great Intro to IIS Express

Too late in the process I came across the following video from MvcConf which goes over IIS Express in great detail and is a must for anyone using this tool:


Step #1 – Enable SSL in IIS Express

Add the following binding to the applicationhost.config file:

<binding protocol="https" bindingInformation="*:44300:localhost" />

Step #2 – Change SSL PORT

IIS 7.5 Express uses port 44300 by default – not 443. RequiresSSL seems to default to port 443 causing secured pages to fail loading. The following resources led me to figuring out the issue:




The following needs to be executed from the command prompt running as Administrator…

' if you already have port 443 setup, you'll need to remove your existing entry
netsh http delete sslcert ipport=
' Get SHA1 thumbprint - You will need to remove spaces
certmgr.exe /c /s /r localMachine MY
' Create a unique UUID using 
netsh http add sslcert ipport= certhash=<your SHA1 thumbprint> appid={<your UUID>}
' add access control list entry to allow port 443 to be used by IIS Express when running as non-admin user
netsh http add urlacl url=https://localhost:443/ user=everyone
' restart http service
net stop http
net start http

Step #3 – Add binding for port 80

The next two steps are essentially a rinse and repeat of steps 1 and 2, but things are a little quicker this time round since we don’t have any certificate information to figure out. Add an additional http binding in your applicationhost.config file, this time binding port 80

<binding protocol="http" bindingInformation="*:80:localhost" />

Step #4 – Add ACL entry for port 80

netsh http add urlacl url=http://localhost:80/ user=everyone

net stop http

net start http


That’s it. If you followed these steps – and made sure all instances of IIS Express have been stopped and restarted – you should now be able to use ports 443 and 80 using IIS Express. Not a whole lot of fun but you should now be able to run a pretty feature rich web server without the need to run VS as an administrator…