Playing with EC2 and Catalyst
tracy — Sun, 01/24/2010 - 16:11
I am changing jobs this February. One of the main differences is that it will mean less work with Drupal, but I am really looking forward to working with the Perl Catalyst framework. In hopes of getting a head start on learning this new system, I bought a book from Amazon and created a custom AMI on Amazon.
You might be wondering why I would bother with building a custom AMI when I could just install Catalyst on either my MacBook Pro or my Windows 7 netbook. The truth is, installing Catalyst can try the patience of a saint and I would hate to have a change in versions of a module break the system for the rest of my development. It's one of the most lasting memories from my last attempt to play around with the framework and is one of the main reasons I didn't use it during my previous jobs. I had tried to use the Catalyst AMI that was already set up, but it didn't have new enough versions of a number of modules so it was really no better than creating my own version. Besides, I know that the people at my job are at least curious about EC2 so any further information I could gather had to be a win.
The first task on tap was to install the Amazon EC2 command line tools on my mac. I followed the instructions in tutorial to do so. Although I use the web interface provided by Amazon to do most of my tasks, such as launching or terminating an instance, these tools are both handy and referenced in the tutorial I found for customizing an AMI.
After I got the command line tools installed, I worked on customizing an image. I decided to work with an existing Ubuntu Hardy Heron image. More information on using the Ubuntu images can be found here. Once I got an instance started, I began the process of loading the various other software bits I would need. Among the first were emacs, subversion, and sqlite3. Of the linux text editors, I know emacs the best but feel free to substitute in your favorite, such as vi or nano. The Catalyst tutorial can be easily downloaded using subversion and it employs the sqlite3 database. I also installed the Catalyst and other Perl modules so that I could run through the tutorial. It's the sort of process that just takes some time and can be sort of confusing. The best bit of advice I can give, though, is the following. If the same module keeps getting prepended for installation, cancel the current install and install that individual module. I'm not entirely sure, but I think there are some modules that depend on each other for installation. When I went and installed those modules individually, things suddenly worked.
Once the Perl modules were finally all installed, I started the process of saving the instance as a custom AMI. I found a great tutorial for customizing an AMI. The tutorial claims that it's for Windows, but I was able to modify it for OS X without any problems. I followed all the steps, registered the new AMI, and then launched a new instance with the new AMI to verify it worked.
Now that I had a working customized AMI, I set up an elastic block store. One way of thinking about these is to think of them as an external hard drive. This gives the ability to create files that persist even when an individual instance goes away. Since I am only running a Catalyst instance when I'm actively studying, I am keeping all of my scripts and notes in that volume.
So that's where I am so far. I'm about a third of the way through The Definitive Guide to Catalyst: Writing Extensible, Scalable and Maintainable Perl–Based Web Applications. As for the book, it seems to be a pretty good introduction and has plenty of examples. The one thing I will note is that there are a number of typos and style inconsistencies, enough to annoy me a bit.