Skip navigation
All Places > Alfresco Content Services (ECM) > Blog > 2011 > October

Alfresco 4.0 in Amazon EC2

Posted by wabson Employee Oct 16, 2011
Update January '12: These instructions are now deprecated. A simpler procedure, allowing easy creation of EBS-boot images is now documented as a follow-up post.

I've just added a new AMI for Alfresco 4 onto my Alfresco EC2 Images list. Running these files is now even easier, based on the method used by Eric Hammond's, with a link next to each image that allows you to click directly through to the AWS Management Console. If you have an AWS account, you're now just a few clicks away from launching your own cloud-based instance of Alfresco 4.0.

Of course, the usual disclaimers apply here. These are not official images in any way, and should not be used for production purposes. But if you want to try out Alfresco 4 without the hassle of managing your own install, hopefully it will be useful.

It's also worth pointing out that the scripts I use to create these are public, hosted on the alfresco-ubuntu-qs project on Google Code.

You should be able to create your own Alfresco 4 AMIs by following these simple steps

  1. Start by running up a preconfigured Ubuntu or other Linux AMI - I use Eric Hammond's list for the latest versions. Pick the right one for your geography and size requirements, I use the most recent 32-bit instance-store AMI from the W Europe region

  2. While the instance is starting up, download the latest Quickstart scripts from Google Code

  3. Once the machine is started, check you can connect to it via SSH, using the keypair you specified when starting the image and the username 'ubuntu'

  4. Create a new directory named 'ec2' in your home directory on the running instance

  5. Use SCP or rsync to copy the quickstart scripts bundle, plus your AWS certificate and private key files (cert-blah.cert and from your local machines. Place the script bundle in /home/ubuntu and the certificate and key files in the new /home/ubuntu/ec2 directory

  6. Back in your SSH session on the instance, extract the contents of the quickstart bundle and change into the new alfresco-ubuntu-qs directory

  7. Use the script to install Alfresco and its dependencies on the instance by typing sudo ./ For 4.0.a and 4.0.b, which do not support the DOD Records Management module, you will need to add the --no-install-dod option to the command.

  8. The script will run through and you will be prompted for a MySQL password. You must enter 'alfresco' unless you have changed the value of $MYSQL_USER in the script to something else.

  9. The script will indicate that it has finished installing Alfresco. Do not start Tomcat, since this will bootstrap the repository data, which you do not want to do before bundling.

  10. Change back into your home directory

  11. Create the AMI files using the sc2-bundle-vol command

    sudo ec2-bundle-vol -d /mnt -p alfresco-community-mysql-4.0.a-i386 -u  111111111111 -k ec2/pk-*.pem -c ec2/cert-*.pem -e  /home/ubuntu/ec2,/home/ubuntu/.ssh,/home/ubuntu/.cache,/home/ubuntu/.sudo_as_admin_successful,/home/ubuntu/.byobu,/home/ubuntu/alfresco-ubuntu-qs,/home/ubuntu/alfresco-ubuntu-qs-*.tar -s 4096

    You must set your numerical AWS account ID using the -u flag. Also you should review the list of excluded files to ensure that you are not bundling any files that you do not want to.

  12. Once the bundling process has finished, upload it to your S3 bucket using the ec2-upload-bundle command

    ec2-upload-bundle -b my-s3-bucket -m /mnt/alfresco-community-mysql-4.0.a-i386.manifest.xml -a aid -s secret --location EU

    You must specify your S3 bucket name using the -b option, and ensure that you set your AWS access key and AWS secret key using the -a and -s options

  13. Once the upload has completed, log into your AWS EC2 web console, navigate to the AMIs section and click the Register New AMI button to register your new image. Enter the path of the uploaded manifest file within the bundle you just uploaded, this will be something like 'my-s3-bucket/alfresco-community-mysql-4.0.a-i386.manifest.xml'

  14. Now your AMI is registered you can see if it works by creating a new instance of it. If it does, then you can safely shut down the originial Ubuntu instance as you will no longer need this.

  15. If you want others to be able to run your image then you will need to add the necessary permissions for this, using the web console.

If you've not come across the project before, Share Import-Export provides a set of Python scripts to export sites and their supporting data into a standardised structure based on ACP and JSON, and can also then import these definitions into another Alfresco system. As well as the scripts, a set of sample sites from the Alfresco Cloud Trial are provided to help you get started.

With version 1.3 of Share Import-Export fresh out of the door, I wanted to post a quick update on the changes in this version, which are designed to provide even more options for those early adopters of Alfresco 4.0. So you can read on for more details, or download the new version straight away.

Tag support

The first major addition is the new support for importing and exporting the tags associated with site content. Share sites just look more complete with tags populated, so this has been on the list for a little while.

Unfortunately the ACP format used doesn't currently allow tag definitions to be embedded in exports of site content, but tag information can be easily pulled out in JSON format and this can be easily persisted to an additional file alongside the ACP.

You should see this if you run with the --export-tags option, and I've also added tag data for the sample sites in the package, so you should see the definitions in the data folder too.

When importing sites with, again the tag definitions aren't yet included by default, but you can include these using the the --import-tags option.

The idea is that this will help when demonstrating Alfresco Share in 4.0, but it's not limited to that version and works well with 3.4 in my own tests. So please do try this out and post your feedback.

Bootstrap your sites

The second improvement is specific to 4.0, but allows sites that you've exported using the scripts to be packaged up as bootstrappable components - complete with Spring configuration - inside a single JAR file, which can be automatically imported when Alfresco is started up.

The format used is the same as the Web Site Design Project site, first introduced in Alfresco Team, and also included in Alfresco 4.0, which provides the default sample content. So you can install additional users and sites alongside the out-of-the-box site, or completely replace it. (Look for the bean with id patch.siteLoadPatch.swsdp in the patch-services-context.xml file in WEB-INF/classes/alfresco/patch inside the Alfresco webapp, which you can comment out to disable the default site)

[caption id='attachment_394' align='alignnone' width='408' caption='Bootstrap your own site definitions alongside the default sample site'][/caption]

Of course you can also continue to import sites manually using the script, but if you're distributing Alfresco instances to others (say a demo package used across your sales team) then the bootstrap packages can be useful to automatically import the sites when Alfresco is started up.

To package up a site in this format, you must previously have exported the site from Alfresco into the normal local structure using You can then point the new script to this local definition and tell it the name of the JAR file to produce, containing the bootstrap components, for example

python data/sites/branding.json sample-branding-site.jar --users-file=data/cloud-users.json

You should find that this builds a JAR file named in the current directory, using the contents of the Company Rebranding site from the bundled cloud trial sites. If you have problems, or you want to know what other options, type --help for more information.

Other improvements

Lots of bug fixes and small improvements have gone into this release, based on testing across various versions of Alfresco from 3.2 to 4.0.

Download packages

If you check out the downloads page you'll see that there's now a choice of packages there. The full 54MB package, with scripts and full Green Energy sample sites and users, is still recommended for most users and is linked to from the home page. However, you can also grab a version with just the scripts plus user data (8MB), or with just the scripts themselves and no sample data (61kB). If you don't need the full sample data, you might find one of these smaller packages useful.

Download Share Import-Export from Google Code


This blog post explains how you can speed up the development of creating pages in Alfresco Share by using a couple of  'out of the box templates'.

The idea is that when creating a 'simple' page in Share with 1, 2 or 3 column you shouldn't have create your own template-instance.xml and template.ftl file. Instead you can re-use one of the 6 out of the box templates described below. That means that you only need to define 1 page.xml-definition in which you tell which webscripts to display inside each region.

The out of the box templates described below are using 'page scoped' regions which means that they can be configured from within a page.xml file. They also make use of a new Spring Surf feature that makes it possible to associate multiple webscripts to a single template region, a feature that was made available in Alfresco Community 4.0.a release.

Note! The actual out of the box templates were made available on HEAD in revision 31068. - They are thereby NOT included in the 4.0a release, so to use them you need to either download the Alfresco Community 4.0.b release OR (to use them in Alfresco Community 4.0.a) do the following...

  1. Download the patch (which contains the 6 out of the box templates)

  2. Rename it from .zip to .jar

  3. Place it in your <SHARE_TOMCAT_HOME>/shared/classes directory

  4. Restart your server

Now we will take a look at how the new templates look and then give an example of how to use them.


The templates

Below you can see the 6 templates in action. I have created sample pages using them to make it easy for you to understand the structure of each template.

I am using the components/title/simple-title.get webscript to display the blue title (i.e. 'TEST 1 COLUMN') and a custom webscript created for this blog post (components/test/echo.get available in the source code for this blog post) to display the 'Echo strings' (i.e. 'Echo: FIRST').

To test out them out yourself just:

  1. Download the sample source code (which contains the test pages & the Echo webscript).

  2. Rename it from .zip to .jar.

  3. Place it in your <SHARE_TOMCAT_HOME>/shared/classes directory.

  4. Restart your server.

  5. Follow the links below to view each template.


1-column (regions: title & column)



2-columns (regions: title, left-column & right-column)



2-columns-narrow-left (regions: title, left-column & right-column)



2-columns-narrow-right (regions: title, left-column & right-column)



2-columns-resizable (regions: title, left-column & right-column)



3-columns (regions: title, left-column, middle-column & right-column)



How to create a page that uses one of the templates

We will create a page named 'test-1-column' that will use the 1-column template and will be reachable at http://localhost:8081/share/page/my-1-column-test.

As you can see below the 1-column template contains 2 'page scoped' regions (title & column) that therefore can be configured from within a  page.

To get the result as above do the following:

  1. Create the following directory stucture <SHARE_TOMCAT_HOME>/shared/classes/config/alfresco/site-data/pages

  2. Create a new page in the directory above and name it to my-1-column-test.xml

  3. In my-1-column-test.xml reference the webscripts you want to include in each region, i.e. using the code below.


<?xml version='1.0' encoding='UTF-8'?>


   <title>Test 1 column</title>

   <description>Test 1 column</description>




      <!-- Title -->





            <title>TEST 1 COLUMN</title>



      <!-- Column -->




            <sub-component id='first'>






            <sub-component id='second'>










First note that we use the <template-instance> element to define that the 1-column template shall be used.

Then note that the syntax used to 'bind in' the webscripts into a region are different in the two regions.

In the 'title' region we only need one webscript and therefor we use the same old syntax that has been used in Share since day 1.

In the 'column' region, however, we want to add in multiple webscripts into the same region. We therefore  have to use the new <sub-components>-syntax to get the job done (available since the Alfresco Share Community 4.0a release). Using this syntax means that you can add in as many webscripts as you like in 1 region. Note! Make sure you make the 'id' attribute in the <sub-component> element 'unique per region'.

To test your page make sure you have installed as described earlier, if so just point your browser to: http://localhost:8081/share/page/my-1-column-test


Further reading

More about the new syntax for 'binding in' webscripts into a region can be found here:

Filter Blog

By date: By tag: