Skip to content

Instantly share code, notes, and snippets.

@youhide
Created February 5, 2017 18:39
Show Gist options
  • Save youhide/c7ef7d0dbe4acd8389c88427bacc2101 to your computer and use it in GitHub Desktop.
Save youhide/c7ef7d0dbe4acd8389c88427bacc2101 to your computer and use it in GitHub Desktop.
Get IP's of AutoScaling Group (AWS)
#!/bin/bash
for i in `aws autoscaling describe-auto-scaling-groups --auto-scaling-group-name GROUPNAME | grep -i instanceid | awk '{ print $2}' | cut -d',' -f1| sed -e 's/"//g'`
do
aws ec2 describe-instances --instance-ids $i | grep -i PrivateIpAddress | awk '{ print $2 }' | head -1 | cut -d"," -f1
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment