Skip to content

Instantly share code, notes, and snippets.

@whiteley
Created May 26, 2012 17:59
Show Gist options
  • Save whiteley/2794789 to your computer and use it in GitHub Desktop.
Save whiteley/2794789 to your computer and use it in GitHub Desktop.
Nailgun wrapper for ec2-api-tools
$ brew install ec2-api-tools nailgun repl
$ ng-server 1>/dev/null &
[1] 69512
$ ng ng-cp $(brew --prefix)/Library/LinkedKegs/ec2-api-tools/jars/lib/*.jar
$ repl ./ng_ec2.sh
./ng_ec2.sh>> ec2-describe-regions
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com
./ng_ec2.sh>> ec2-describe-availability-zones
AVAILABILITYZONE us-west-2a available us-west-2
AVAILABILITYZONE us-west-2b available us-west-2
AVAILABILITYZONE us-west-2c available us-west-2
./ng_ec2.sh>> ^D
$ ng ng-stop
[1] + done ng-server > /dev/null
#!/usr/bin/env bash
set -o errexit
set -o nounset
_cmd="$1" && shift
_cmd=$(basename ${_cmd})
opts="$@"
ec2_apitools_bin="$(brew --prefix)/bin"
if [ -h ${ec2_apitools_bin}/${_cmd} ]
then
set $(grep ec2-cmd ${ec2_apitools_bin}/${_cmd})
cmd="$2"
fi
ng com.amazon.aes.webservices.client.cmd.${cmd} ${opts}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment