Running AllegroGraph on Amazon EC2

Introduction

This guide is intended for users of AllegroGraph that want to run on Amazon's Elastic Compute Cloud, a web service provided by Amazon that allows you the ability to execute your application in Amazon's computing environment. On EC2, you run an instance of an Amazon Machine Image. AMIs come in a variety of operating systems flavors, but we will focus here on 64-bit Linux, specifically Fedora 8.

All but the information specific to AllegroGraph is taken from the Amazon Elastic Compute Cloud Getting Started Guide (API Version 2008-02-01). We strongly recommend that you read the most recent version of that document, which will likely be accessible from this page.

The steps to getting AllegroGraph working on EC2 are:

Obtaining an Amazon EC2 account

You can obtain an Amazon Web Services account from this page on the Amazon website.

Installing the Amazon EC2 command line tools

Download the command line tools for manipulating Amazon Machine Instances (AMIs) from here. Set the environment variable EC2_HOME to the installation directory. Then, put this directory in your PATH.

The EC2 command line tools use Java, so you'll need a recent version of Sun's JRE or JDK. Make sure to set JAVA_HOME to the location where Java is installed.

Lastly, the EC2_PRIVATE_KEY and EC2_CERT environment variables are used by the tools to authenticate you when web service requests are made to EC2.

For example, for C shell users, put something like this in your $HOME/.cshrc:

setenv EC2_HOME $HOME/ec2-api-tools-1.3-19403
setenv JAVA_HOME /usr/java/jdk1.6.0_03
setenv EC2_PRIVATE_KEY $HOME/.ec2/pk-BCPQSCBGGB3QAGAPRFY4Z5ABK5FUNUFI.pem
setenv EC2_CERT $HOME/.ec2/cert-BCPQSCBGGB3QAGAPRFY4Z5ABK5FUNUFI.pem
set path=($path $EC2_HOME/bin $JAVA_HOME/bin)

Selecting a suitable AMI

Now that the EC2 command line tools are setup, you can run the command that lists the available AMIs:

% ec2-describe-images -o self -o amazon
IMAGE	ami-bd9d78d4	ec2-public-images/demo-paid-AMI.manifest.xml	amazon	available	public	A79EC0DB	i386	machine		
IMAGE	ami-26b6534f	ec2-public-images/developer-image.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ari-a51cf9cc	ec2-public-images/ec2-initrd-2.6.21.7-2.fc8xen.i386.manifest.xml	amazon	available	public		i386	ramdisk		
IMAGE	ari-b31cf9da	ec2-public-images/ec2-initrd-2.6.21.7-2.fc8xen.x86_64.manifest.xml	amazon	available	public		x86_64	ramdisk		
IMAGE	aki-a71cf9ce	ec2-public-images/ec2-vmlinuz-2.6.21.7-2.fc8xen.i386.manifest.xml	amazon	available	public		i386	kernel		
IMAGE	aki-b51cf9dc	ec2-public-images/ec2-vmlinuz-2.6.21.7-2.fc8xen.x86_64.manifest.xml	amazon	available	public		x86_64	kernel		
IMAGE	ami-f51aff9c	ec2-public-images/fedora-8-i386-base-v1.06.manifest.xml	amazon	available	public		i386	machine	aki-a71cf9ce	ari-a51cf9cc
IMAGE	ami-f21aff9b	ec2-public-images/fedora-8-x86_64-base-v1.06.manifest.xml	amazon	available	public		x86_64	machine	aki-b51cf9dc	ari-b31cf9da
IMAGE	ami-a21affcb	ec2-public-images/fedora-core-6-x86_64-base-v1.06.manifest.xml	amazon	available	public		x86_64	machine	aki-a53adfcc	ari-a23adfcb
IMAGE	ami-25b6534c	ec2-public-images/fedora-core4-apache-mysql.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ami-23b6534a	ec2-public-images/fedora-core4-apache.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ami-20b65349	ec2-public-images/fedora-core4-base.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ami-22b6534b	ec2-public-images/fedora-core4-mysql.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ami-36ff1a5f	ec2-public-images/fedora-core6-base-x86_64.manifest.xml	amazon	available	public		x86_64	machine		
IMAGE	ami-2bb65342	ec2-public-images/getting-started.manifest.xml	amazon	available	public		i386	machine		
IMAGE	ari-a23adfcb	ec2-public-images/initrd-2.6.20-1.3002.fc6xen.ari.manifest.xml	amazon	available	public		x86_64	ramdisk		
IMAGE	aki-9b00e5f2	ec2-public-images/vmlinuz-2.6.18-xenU-ec2-v1.0.i386.aki.manifest.xml	amazon	available	public		i386	kernel		
IMAGE	aki-9800e5f1	ec2-public-images/vmlinuz-2.6.18-xenU-ec2-v1.0.x86_64.aki.manifest.xml	amazon	available	public		x86_64	kernel		
IMAGE	aki-a53adfcc	ec2-public-images/vmlinuz-2.6.20-1.3002.fc6xen.aki.manifest.xml	amazon	available	public		x86_64	kernel		
% 
The AMI we will use is highlighted in bold. The important part of the output, which we will use shortly is ami-f21aff9b. This is the identifier used to specify a particular AMI. It is the one we will use.

Generating a keypair for securely logging into your running AMI

Before we can run an instance of the selected AMI, we must make sure we can ssh into it. This is done by running, once, the command ec2-add-keypair. For example,

% ec2-add-keypair agraph-large
The RSA public and private keys should now be saved in files in your ~/.ssh directory. I chose $HOME/.ssh/id_rsa-agraph-large and $HOME/.ssh/id_rsa-agraph-large.pub.

Running your selected AMI

Now that we have our keypair and AMI instance selected, we can run it:

% ec2-run-instances ami-f21aff9b -k agraph-large --instance-type m1.large
RESERVATION	r-23ae6a4a	210979525344	default
INSTANCE	i-b5935ddc	ami-f21aff9b			pending	agraph-large	0		m1.large	2008-05-14T16:51:18+0000	us-east-1b	aki-b51cf9dc	ari-b31cf9da
% 
It takes about a minute for the instance to boot, and when it does we will see something like this:
% ec2-describe-instances i-b5935ddc
RESERVATION	r-23ae6a4a	210979525344	default
INSTANCE	i-b5935ddc	ami-f21aff9b	ec2-99-99-99-99.compute-1.amazonaws.com	ip-10-145-155-95.ec2.internal	running	agraph-large	0		m1.large	2008-05-14T16:51:18+0000	us-east-1b	aki-b51cf9dc	ari-b31cf9da
% 
Note we now have an assigned hostname, ec2-99-99-99-99.compute-1.amazonaws.com.

Connecting to your running AMI

To make it easy to connect to our running EC2 instance, you could add this to your $HOME/.ssh/config file:

Host ec2
Hostname ec2-99-99-99-99.compute-1.amazonaws.com
IdentityFile ~/.ssh/id_rsa-agraph-large
That will allow us to do this:
% ssh root@ec2

         __|  __|_  )  Fedora 8
         _|  (     /    64-bit
        ___|\___|___|

 Welcome to an EC2 Public Image
                       :-)
    Base

[root@ip-10-145-155-95 ~]# 

Installing the AllegroGraph Java Edition

You can obtain the AllegroGraph Free Java Edition here. Once you have downloaded the file agraph-3.1.1-1.x86_64.rpm, you can copy it to EC2:

% scp agraph-3.1.1-1.x86_64.rpm root@ec2:
agraph-3.1.1-1.x86_64.rpm                       100%   28MB 349.7KB/s   01:22    
% 
Back on EC2, you can login and install agraph:
[root@ip-10-145-155-95 ~]# rpm --install agraph-3.1.1-1.x86_64.rpm
[root@ip-10-145-155-95 ~]# /etc/rc.d/init.d/agraph start
Starting AllegroGraphServer: log file is "sys:agraph.log (ie /usr/lib/agraph/agraph.log)"
Daemonizing... OK
[root@ip-10-145-155-95 ~]# 
AllegroGraph is now running on your EC2 instance.

NOTE: the installation instructions are the same for the Enterprise and Developer Editions of AllegroGraph. The only difference is how you obtain the downloaded file, contained in an email from us.

Copyright © 2010 Franz Inc., All Rights Reserved | Privacy Statement