wabson

New Community 4.0.c Amazon EC2 AMI

Blog Post created by wabson Employee on Jan 23, 2012
Since Alfresco Community 4.0.c was quietly slipped out over the Christmas break, I'd been meaning to get round to creating an AMI with the new release. After I was asked by a colleague who was trying to do something similar with our upcoming Enterprise version, I managed to grab a short amount of time to revisit the image creation process that I wrote about back in November.



First off, I decided to reduce some of the complexity by breaking with the past and going for an EBS boot image only, rather than the S3-backed instance-store types that I previously put together. As well as being simpler to create, EBS boot images offer several advantages, the chief one being that by virtue of their EBS-backed storage, they can persist their state when turned off.



From my initial testing, the EBS boot images seem to perform well too, so unless I get any reports of significant problems I'll be using the same method to create all future AMIs as well.

Running the images



The new 4.0.c image is listed on the Alfresco EC2 Images page. Launching it is easy using the AWS web console.



  1. Click the Launch in AWS Management Console icon next to the version you want to run


  2. Log in using the e-mail and password you registered with Amazon, if you are not already logged in


  3. Step through the wizard, making sure that you select Small in the instance size


  4. When you get to the security part, make sure you select a security profile that has inbound SSH (port 22) and HTTP (port 80) enabled, plus any other interfaces you want to allow into Alfresco



After the wizard has completed you can monitor the start-up of your instance in the Instances area of the EC2 web console. To connect to Alfresco Share on your instance, simply paste the public DNS name of the instance into your browser address bar. It may take up to five minutes for the repository to run through the bootstrap process, after which you will be redirected to the normal Share login page.

Creating your own images



There's nothing to stop you creating your own Alfresco AMIs, using the same procedure that I've used here. As I mentioned, when creating EBS boot instances the procedure is much simpler, and there is no need to copy private key files across the network onto the host.



There are a few steps to carry out, but I've tried to make these as straightforward as possible

1. Start up your base image



Start by running up a pre-configured Ubuntu or other Linux AMI – see Canonical’s list for the latest official versions. You should pick the right one for your geography and size requirements, but I use the most recent 32-bit EBS boot AMI from the West Europe region.



To start up the image, just click the relevant link in the list, or use the Launch wizard in the EC2 Management Console to pick an alternative Linux-based AMI. The scripts have been tested with Ubuntu 11.10 and 12.04 32-bit instances, so I'd recommend either of those where possible. 64-bit AMIs do not seem to run well on small instances, so if you use one of those then ensure you pick a larger instance size.

2. Log in via SSH



I use PuTTY to connect to the newly-created instance. You'll need to have created a keypair for your AWS account and have imported it into PuTTY. You can then connect via SSH as the relevant user account (the Ubuntu images use the user 'ubuntu') and the correct key file.



There is general information on connecting to Linux instances in the EC2 help and Eric Hammond has a page that explains some more about securely connecting to the official Ubuntu images, which should be accurate for all the AMIs listed on his site.

3. Download and extract the Ubuntu Quickstart scripts



These are now available as a ZIP download from the alfresco-ubuntu-qs project on Google Code. Find the latest version in the Downloads section and right click to copy the download link to your clipboard.



Back in your SSH client you can then download the files using the following commands (modify as needed for the latest version of the scripts), or you can skip the first line by downloading the file from the project site and SCP'ing it up to your Amazon instance.

curl http://alfresco-ubuntu-qs.googlecode.com/files/alfresco-ubuntu-qs-0.9.8.tar.gz -o alfresco-ubuntu-qs-0.9.8.tar.gz

tar xzf alfresco-ubuntu-qs-0.9.8.tar.gz


4. Install Alfresco



Now we can install the Alfresco files using the install.sh script supplied in the Ubuntu Quickstart package.

cd alfresco-ubuntu-qs

sudo ./install.sh --alf-version 4.2.b --jdk-version openjdk-7 --no-install-dod


Note that the --no-install-dod option to install.sh is only needed for version 4.0, for which the DoD5015.2 add-on module is currently unavailable.



For Alfresco Community 4.2, only JDK7 is required, which you must enable using --jdk-version openjdk-7.



You can follow the progress of the script in your SSH client. When you are prompted for a MySQL password, you must enter ‘alfresco’ - unless you have changed the value of $MYSQL_USER in install.sh to something else.



When the script has finished it will tell you that installation is complete and that Alfresco can be started. DO NOT START ALFRESCO UP AT THIS TIME - unless you want a pre-installed repository to be part of your AMI.



5. Create your AMI



One of the benefits of EBS boot instances is that you can create images with a single command using the AWS API tools, or directly from the EC2 web console.



To create your AMI from the web console, right-click the running instance in the Instances section, select Create Image from the menu, enter an appropriate file path in the 'name' field, and confirm.



The image creation process should take no more than a few minutes - far quicker than the instance-store method! Once it is done, you should be able to see your image in the AMIs section of the web console. You can test it by starting up an instance of it as per the steps in Running the images, above.

6. Cleaning up



Last but not least, make sure that the instance that you used to create your image is terminated, so it will not keep on consuming billable resources! You should do the same for any additional instances that you've fired up to test your image.

Outcomes