Sunday, September 28, 2008

Stage 2 - Create Server AMI

OK, now to the real thing - create the Amazon Machine Images (AMIs) for the server and the client. I started with the server.
Using Elasticfox I choose one of the Ubuntu Hardy basic images, run it, logged in.
Two things to install on the server machine:
  • Java
  • Terracotta server
Java is easy - apptitude install sun-java6-jdk, and this is it. Accept the EULA, export JAVA_HOME, done.

Terracotta was more complicated. I didn't find debian distro for it, nor public download link on the site, so I scp-ed the tar.gz archive from my computer. Unzip it, and it runs!

Next step was to create AMI from the current setup, upload it to Amazon S3 storage and to register it in EC2. Step-by-step instructions are here.

Time to check the server. Terracotta server runs by default on port 9510. I created new permissions group in which this port is open (using Elasticfox, of course), and next I chose my own (!) image from the available images, and booted an instance with two permissions groups - default (for SSH etc.) and my custom one. Hooray, it is already preconfigured and has everything I need! The only thing I have to improve is to add the terracotta server startup to init.d.

Now, the problem arose. In the tc-config.xml file I have to specify the server's IP, but the IP I get from EC2 changes every time I boot new instance.
Elastic IP to the rescue! I can register IPs for my AMI user, and assign them to running instances. This is exactly what I need. I registered elastic IP using Elasticfox, and assigned it to my running server instance.

The sharedqueue sample runs smoothly. I am sceptical, so I want to check if it really use the server on EC2. I checked the logs on the server, and it is! The server got connection from my local IP!

P.S. Useful links for EC2 config and run:
  • EC2 Getting Started Guide - command line utilities, most of their operations can be done in Elasticfox, but gives great picture of what's going on.
  • Firefox EC2 UI screencast - shows old version of Elasticfox in action. The basics are the same, so it is useful.

No comments: