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 2009-04-04). 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 | grep /fedora-8
IMAGE	ami-84db39ed	amazon/fedora-8-i386-v1.14-std	amazon	available	public		i386	machine	aki-94c527fd	ari-96c527ff		ebs
IMAGE	ami-86db39ef	amazon/fedora-8-x86_64-v1.14-std	amazon	available	public		x86_64	machine	aki-54ce2c3d	ari-56ce2c3f		ebs
IMAGE	ami-f51aff9c	ec2-public-images/fedora-8-i386-base-v1.06.manifest.xml	amazon	available	public		i386	machine	aki-a71cf9ce	ari-a51cf9cc		instance-store
IMAGE	ami-2b5fba42	ec2-public-images/fedora-8-i386-base-v1.07.manifest.xml	amazon	available	public		i386	machine	aki-a71cf9ce	ari-a51cf9cc		instance-store
IMAGE	ami-5647a33f	ec2-public-images/fedora-8-i386-base-v1.08.manifest.xml	amazon	available	public		i386	machine	aki-a71cf9ce	ari-a51cf9cc		instance-store
IMAGE	ami-48aa4921	ec2-public-images/fedora-8-i386-base-v1.10.manifest.xml	amazon	available	public		i386	machine	aki-6eaa4907	ari-42b95a2b		instance-store
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		instance-store
IMAGE	ami-2a5fba43	ec2-public-images/fedora-8-x86_64-base-v1.07.manifest.xml	amazon	available	public		x86_64	machine	aki-b51cf9dc	ari-b31cf9da		instance-store
IMAGE	ami-2547a34c	ec2-public-images/fedora-8-x86_64-base-v1.08.manifest.xml	amazon	available	public		x86_64	machine	aki-b51cf9dc	ari-b31cf9da		instance-store
IMAGE	ami-f61dfd9f	ec2-public-images/fedora-8-x86_64-base-v1.10.manifest.xml	amazon	available	public		x86_64	machine	aki-a3d737ca	ari-7cb95a15		instance-store
% 
The AMI we will use is highlighted in bold. The important part of the output, which we will use shortly is ami-f61dfd9f. 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 aws-us-east
The RSA private key will be printed by the above command. Save the the text including and between
-----BEGIN RSA PRIVATE KEY-----
and
-----END RSA PRIVATE KEY-----
into the file ~/.ssh/aws-us-east.pem. The public key is held by AWS.

Running your selected AMI

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

% ec2-run-instances ami-f61dfd9f -k aws-us-east --instance-type m1.large
RESERVATION	r-23ae6a4a	210979525344	default
INSTANCE	i-b5935ddc	ami-f61dfd9f			pending	aws-us-east	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-f61dfd9f	ec2-99-99-99-99.compute-1.amazonaws.com	ip-10-145-155-95.ec2.internal	running	aws-us-east	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/aws-us-east.pem
User root
That will allow us to do this:
% ssh 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-see-3.3-1.x86_64.rpm, you can copy it to EC2:

% scp agraph-see-3.3-1.x86_64.rpm root@ec2:
agraph-see-3.3-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-see-3.3-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 © 2012 Franz Inc., All Rights Reserved | Privacy Statement
Delicious Google Buzz Twitter