[updated - see end of post]
Over the weekend I got to try out Amazon’s EC2 (Elastic Computing Cloud) service.
Google seem to get all the love from the blogosphere but Amazon have been doing cool stuff for years. Amazon were WebService pioneers. I started playing around with their webservices in 2003. S3 was interesting but EC2 is very compelling from a developer perspective.
EC2 is a service which basically offers dedicated hosting at what seems like a compelling price. I’m currently paying $160/month to my current provider and EC2 offers similar hosting for $72 / month. What’s not to like ? With EC2 you can configure and run multiple server images (all the images are based on RedHat Fedora Core).
What better way to kick the tyres on EC2 than by installing the PXN8 photo-editing application on an EC2 instance ? The procedure for configuring and running an EC2 Server (also known as an Instance) is relatively straightforward – just be sure to read the appendix if you’re using putty on Windows) and is documented on Amazon’s Developer website so I won’t cover it here. The following is a list of things I did to get PXN8 up and running on an Amazon EC2 instance. I figure some of my customers may eventually go this route too so I hope it comes in useful. At the very least it also offers a useful guide to setting up PXN8 on a Fedora Core box…
First off, for some bizarre reason, the default EC2 image doesn’t come with GCC installed (at least on my instance it wasn’t present)…
[1] Install GCC (if not already present)
$ which cc
if no cc is found…
$ yum install gcc
[2] Install libjpeg-devel (needed for imagemagick)
$ yum install libjpeg-devel
[3] Install LWP::Simple (needed by pixenate)
$ perl -MCPAN -e shell
> install LWP::Simple
> quit
[4] Install ImageMagick from source …
[4.1] $ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
[4.2] $ gunzip -c ImageMagick.tar.gz | tar xvf -
[4.3] $ cd ImageMagick-6.?.?
[4.4] $ ./configure –with-perl=/usr/bin/perl
[4.5] $ make; make install
[5] Ensure that the ImageMagick libraries will be picked up by the system.
Edit /etc/ld.so.conf and add the following line to the end of the file…
/usr/local/lib/
Then run the following command to update the library database…
$ /sbin/ldconfig
[6] Test that PerlMagick works…
$ perl -MImage::Magick -e 1
(If the output from this command is blank then all is well. If instead you get an error saying the Image::Magick module can’t be found then read http://jim.mmdc.net/archives/2004/12/getting_imagema.html)
[7] Configure Apache to run perl scripts…
edit /etd/httpd/conf/httpd.conf and add the following line…
AddHandler cgi-script .pl
Add the ExecCGI option to the DocumentRoot folder declaration.
[8] Download and Install PXN8
$ wget –user=${user} –password=${password} http://sxoop.com/release/${date}/pxn8.tar.gz
$ mv pxn8.tar.gz /var/www/html/pxn8.tar.gz
$ tar -xzvf pxn8.tar.gz
[9] Test the install…
go to http://domain/pixenate/themes/toolbar1/index.html
and try editing an image.
I must admit it took a bit of trial and error. ImageMagick wasn’t installed by default. When I tried installing using ‘yum install’ , PerlMagick wouldn’t work. I installed from source but there was no JPEG support. Eventually I got it working using the steps above.
This post is for my own and customer’s reference.
You can see PXN8 running on EC2 here…
UPDATE:
It took a full day after playing around with EC2 but the penny did eventually drop ;-) Essentially what EC2 is (and I think most of the journalists covering this have missed) is a Server Provisioning API. What it means is you can put a system in place that requests new servers as your load increases. This is the on-demand aspect – most of the coverage of EC2 has focussed on the pay-as-you-go aspect when in reality it’s the programmability of EC2 that is the really exciting stuff. Amazon are changing the game !