Monday, May 9, 2011

Neo4j graph database server image in Amazon EC2

About Neo4j Server image

Neo4j graph database server image is available in Amazon EC2. The purpose of the AMI is to offer instant and on-demand access to a Neo4j Server environment to help the rapidly growing Neo4j developer community to test and deploy Neo4j-enabled applications.

This Amazon Machine Image is produced and maintained by OpenCredo, UK consultancy delivery partner for Neo Technology.

The image is built on Elastic Block Storage (EBS) root device that enables data to be preserved when the machine is switched off and later restarted (terminating the instance will destroy all data). Other benefits of using EBS-backed instance in comparison to S3-backed instance are faster boot up time and the ability to resize the machine easily when extra processing capacity is needed.

Components

Components included in the image are the following
  • Amazon Machine Image
    • Regions and AMI IDs
      • US East: ami-1e56a977
      • US West: ami-b5bceff0
      • EU West: ami-5d6e5829
      • AP South East: ami-f29be2a0
      • AP North East:ami-ce842ecf
    • Source: 720777788660/Neo4j Server (Ubuntu 10.04.2 LTS)
  • Ubuntu 10.04.2 LTS
  • Sun JDK 1.6.0_24
    • Installed in /usr/lib/jvm/java-6-sun-1.6.0.24/
    • Installed from Ubuntu partner repository (http://archive.canonical.com/ lucid partner)
  • Neo4j Server v.1.3 Community Edition
    • Installed in /opt/neo4j/
    • Listening on port 7474
    • Server is configured to start-up automatically when instance is launced (runlevels 2-5)
    • Stop/start script is located in /etc/init.d/neo4j-server
  • Jython v.2.5.2
    • Installed in /opt/jython
    • Binary found in the path through symbolic link in /usr/bin
  • Jruby v.1.6.1
    • Installed in /opt/jruby
    • Binary found in the path through symbolic link in /usr/bin
  • Python 2.6/3.1
    • Python 2.6: /usr/bin/python
    • Python 3.1: /usr/bin/python3.1
  • Ruby 1.8
    • Ruby binary found in the path
  • Curl 7.19.7
    • Curl binary found in the path
  • EC2 API and AMI tools
    • EC2 API tools are located in /opt/ec2/ec2-api-tools/
    • EC2 AMI tools are located in /opt/ec2/ec2-ami-tools/
    • Both tools are updated automatically at instance start-up
    • Update process is triggered in /etc/rc.local by calling a script /opt/ec2/updateEC2Tools.sh
    • updateEC2Tools.sh is published under GPL license and available in https://github.com/jussiheinonen/scripts


Component Diagram


Get started with Neo4j Server instance in Amazon EC2


Locating Neo4j AMI

  1. Login to AWS Management Console [http://aws.amazon.com]
  2. Go to EC2 tab and click AMIs link
  3. Search for 'neo4j'
  4. Select the AMI and click Launch

Links to launch the Neo4j Server image  

Instead of searching for AMI you can use the following shortcuts to launch the image on AWS Console


  • Press play to launch Neo4j in US East (Virginia)
  • Press play to launch Neo4j in US West (California)
  • Press play to launch Neo4j in EU West (Ireland)
  • Press play to launch Neo4j in AP South East (Tokyo)
  • Press play to launch Neo4j in AP North East (Singapore)



Configuring AMI start-up parameters and launching instance

  1. Specify instance type, eg. Micro (t1.micro), and click Continue

  2. Enter a description for your instance in User Data field
  3. Optionally you may tick the box “Prevention against accidental termination”. This option disables theTerminate action in Instance Action -menu which is used to delete the instance and all user data stored on the EBS volume.
  4. You can associate tags (Key-Value pairs) with the instance Eg. “Neo 4j Server instance A”. Tags may be useful for managing EC2 environment that consists of multiple nodes.
  5. Associate a Key Pair with your instance. The private key of the Key Pair is used for accessing the instance over SSH. If no Key Pairs exist yet you can create a new Key Pair by selecting the option “Create a new Key Pair”
  6. Associate instance with a Security Group. Security Group is an access list that can be used to allow and block access to services run on the instance.
  7. In this example I'll associate instance with Security Group “Neo4j public access”. This Security Group is configured to allow connection from the internet to TCP ports 22 (SSH) and 7474 (Neo4j web administration interface)
  8. The final step is to confirm instance configuration details. Once confirmed click Launch button and your instance will start up within next couple of minutes.

Accessing instance over HTTP and SSH



Neo4j Web Administration access

Neo4j Server is configured to start-up automatically when instance is launched. Assuming the Security Group is configured to allow access from the internet to TCP port 7474 you can then access Neo4j web administration interface by using the Public DNS name associated with your instance. Public DNS name can be found in instance description view.

For example Public DNS name of running Neo4j instance is ec2-12-34-567-89.eu-west-1.compute.amazonaws.com. I can connect to web administration interface by entering address http://ec2-12-34-567-89.eu-west-1.compute.amazonaws.com:7474 in web browser.


SSH access

For SSH access you'll need 2 things: Public DNS name and a copy of the private key from the Key Pair that was selected at the instance configuration phase.

As an example let's say the Public DNS name is ec2-12-34-567-89.eu-west-1.compute.amazonaws.com and name of the private key file is myprivates.pem.

I can connect on SSH from command line by issuing the following command:
ssh -i myprivates.pem ubuntu@ ec2-12-34-567-89.eu-west-1.compute.amazonaws.com


Last word

That's all for now folks. I hope I managed to cover all relevant points regarding environment configuration and how to get started with your own Neo4j Server instance in Amazon EC2.

Update 11.05.2011/15:13 BST

Image is now available in all 5 regions and AMI IDs can be found on the Components list above.