Created
August 27, 2012 14:32
-
-
Save terrancesnyder/3488986 to your computer and use it in GitHub Desktop.
discovery of amazon instances by tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export JAVA_HOME=/opt/java/current | |
export EC2_PRIVATE_KEY=/home/ubuntu/cloudstrap.io/modules/amazon/files/certs/pk.pem | |
export EC2_CERT=/home/ubuntu/cloudstrap.io/modules/amazon/files/certs/cert.pem | |
export EC2_HOME=/opt/ec2-api-tools-1.5.3.1 | |
export PATH=$PATH:$EC2_HOME/bin | |
ec2-describe-tags --filter "resource-type=instance" --filter "key=node" | while read x; | |
do | |
node=`echo $x | awk '{print $5}'` | |
instance=`echo $x | awk '{print $3}'` | |
url=`ec2-describe-instances --filter tag:node=$node --filter instance-state-code=16 | grep INSTANCE | awk '{print $15 ":8080/solr"}'` | |
echo $url/$node | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment