Skip to content

Instantly share code, notes, and snippets.

@Voronenko
Created August 26, 2015 19:53
Show Gist options
  • Save Voronenko/8ee8e8be4c7c73776aa4 to your computer and use it in GitHub Desktop.
Save Voronenko/8ee8e8be4c7c73776aa4 to your computer and use it in GitHub Desktop.
Get public IPs of the instances currently linked to aws load balancer named LB1
aws elb describe-instance-health --load-balancer-name bla --region us-east-1 | awk '{ print $2 }' | grep "i-" | cut -d '=' -f 2 | sed -e 's/,$//' | xargs aws ec2 describe-instances --instance-id | grep PublicIpAddress | awk '{print $2}' | cut -d '=' -f 2 | sed -e 's/,$//'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment