Just a second...

Tools for Amazon™ Elastic Compute Cloud (EC2)

This is a description of a number of tools and adaptations which are provided for use when using Diffusion™ with Amazon EC2™.

Diffusion includes in tools/ec2/ a number of files useful when deploying Diffusion to an Ubuntu® image on an EC2 virtual machine.

diffusion.conf

Ubuntu makes use of the Upstart daemon as a replacement for init. Copied to /etc/init/diffusion.conf this file contains configuration for Upstart to begin Diffusion at boot-time in a background process as a unprivileged user. It establishes iptables rules to route traffic from privileged ports to Diffusion.

Users can stop and start Diffusion using Upstart commands, for example, to start the server

service diffusion start

To stop Diffusion

service diffusion stop

To check the status of Diffusion

service diffusion status

In the event that something goes amiss Upstart writes a log file to /var/log/upstart/diffusion.log

etc/Connectors.xml

Except for two port number changes this is an otherwise regular copy of etc/Connectors.xml normally found in a Diffusion installation. Use this file in conjunction with the iptables rules established in diffusion.conf

ec.xml

An illustrative Apache™ Ant™ script that can be used to start, stop, and get status from a Diffusion server running on an Amazon EC2 Linux™ host. It also demonstrates an inelegant means of deploying and undeploying a DAR file to/from the remote server, by copying the file to the remote server, then moving it into the deploy directory.

Table 1. Targets
Property Purpose
start Runs sudo service diffusion start on remote host using SSH
stop Runs sudo service diffusion stop on remote host using SSH
status Runs sudo service diffusion status on remote host using SSH
deploy Uploads local DAR file to staging dir, then moves it into Diffusion deploy directory
undeploy Removes DAR file from deploy directory, signaling Diffusion to undeploy related publishers (where possible)

The script is driven by named properties:

Table 2. Properties for targets start, stop and status
Property Purpose
remote.host EC2 host running sshd
remote.username Authentication username, default of ubuntu
remote.keyfile PEM encoded key use during authentication
Table 3. Additional properties for targets deploy and undeploy
Property Purpose
dar.file Name of a DAR file to deploy or undeploy
remote.diffusion.dir Root directory of the remote Diffusion installation

Example deployment:

ant -Dremote.host=54.235.65.36 \
	-Dremote.keyfile=$HOME/.ssh/ec2-push1.pem \
	-Ddar.file=$HOME/Applications/Diffusion6.2.7/demos/drawingboard.dar \
	-Dremote.diffusion.dir=/home/ubuntu/Diffusion/Diffusion6.2.7 \
	deploy

The script uses no proprietary Diffusion code and is open to extension during development of a solution. Both the sshexec and scp tasks depend on the jsch library which might have to be downloaded.