Skip to content

Instantly share code, notes, and snippets.

@thejohnny
Created January 19, 2010 18:54
Show Gist options
  • Save thejohnny/281163 to your computer and use it in GitHub Desktop.
Save thejohnny/281163 to your computer and use it in GitHub Desktop.
# List public hostnames of instances in an Elastic Load Balancer (ELB)
instances=`elb-describe-instance-health name-of-elb --show-long | cut -d"," -f2`
for instance in $instances
do
echo $instance -\> `ec2-describe-instances $instance | egrep "^INSTANCE" | cut -f4`
done
# same as one-liner
#for instance in `elb-describe-instance-health name-of-elb --show-long | cut -d"," -f2`; do echo $instance -\> `ec2-describe-instances $instance | egrep "^INSTANCE" | cut -f4`; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment