Amazon’s EC2 and ColdFusion / FMS
April 22, 2008
Posted by on
This last weekend I finally had enough time to play with Amazon’s Web Services (AWS). Amazon Web Services are a set of pay-for utilities that allow developers (among others) to host files, products, or servers in Amazon’s cloud. At last month’s Mid-Michigan ColdFusion User’s Group meeting, there was a presentation from Rick Mason on Amazon S3. S3, a storage system in the cloud is not something that really peaked my interest, but another related tool, EC2, did.
EC2 is a service where you can rent a VPS, or virtual server by the hour. You literally pick a server ‘image’ or AMI, and tell it to boot. Once you have your machine booted up, you can access it, login as root, and away you go.
However, in spite of all the great marketing, EC2 is a real bear to setup.
- The tools take FOREVER to get setup correctly. On Windows, you have to download the tools, install the Java SDK (if you don’t already have a current version), setup a bunch of DOS Environment Variables, generate and download your server certificate and private-key certificate, break your pk certificate into a private and public key set (if you want to use any tools other than Cygwin SSH client), and setup your SSH client. Providing a simple tool written for Win/Mac (using something like AIR) could drop this down to two steps.
- Find an AMI that you wish to base your image off of. Amazon offers about a dozen base installs — based on various OSs and software packages. There are hundreds of other ‘public’ AMI images that have everything from Postgress SQL to SugarCRM pre-installed. Amazon tags these images with an ‘AMI’ code.
- Launch an instance (start your VPS) of that AMI based image using the following information: You are now paying by the hour
- AMI Code
- Your Private Key
- Your Server Key
- A group to launch the instance in (‘default’ by default)
- Wait a few moments while the machine boots up, and then you must do an inquiry into which instances you are currently running. Write this instance ID down, as it is sometimes the only way to figure out what is running. It should list back a public domain name, and a private domain name. Write down which group it was launched in.
- Open up the correct firewall ports so you can access your server. Port 22 is for SSH. There a bunch of features with the firewall, where you can even lock it down to your specific address on the net.
- Connect using your client you setup in step-1. Login is ‘ROOT’ for most AMI’s, and it will use your private/public key file as the password.
- Download and install software. The CentOS Amazon images don’t include many tools to download files — you can however use yum to install a text-based web browser (called lynx) to download things. Installing them is no harder than any other VPS. For example, ColdFusion, you download the .BIN file, chmod +x coldfusion_801.bin, and then ./coldfusion. You may need to find out where your copy of Apache is installed before you do this.
- Once you are done installing and setting up your software, you need to create your own AMI. Since the instances don’t persist for anything besides a reboot (at this time). In the base installs of CentOS, they included the tools to do this via command line. You will need to upload your Private Key, your Public Key (to the /mnt/ folder!), and get your Amazon Account Number (from the website). Creating my AMI image that included ColdFusion and Flash Media Server took about 15 minutes. Write down the location to the manifest.xml file that is created.
- Next, you will want to send your new AMI images to somewhere. AMI images stored on Amazon’s S3 service can be booted by just knowing the AMI code. You will need to setup a bucket to store the AMI in, and upload it to S3.
- Register the AMI image so that is is bootable. You will need a bunch of info again, and you will need the location to that manifest.xml document.
That’s it (I hope). Most of this can and should be integrated into some easy-to-use tools. Right now it is really an experience that Unix Admins love (everything is command line!), but the rest of the world will have a hard time with.
Side note: There is a tool out for Firefox which helps simplify some of these steps, however, because of the terminology that they use, you still need to be familiar with these steps to figure out what is going on.