Skip to content

Instantly share code, notes, and snippets.

@justinclayton
Created August 29, 2017 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinclayton/65b05497f73dc77840005e9954e0b684 to your computer and use it in GitHub Desktop.
Save justinclayton/65b05497f73dc77840005e9954e0b684 to your computer and use it in GitHub Desktop.
Get private IPs of instances in an AWS autoscaling group
asg_to_ips() {
local asg=$1
local instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names ${asg} \
| jq '[.AutoScalingGroups[].Instances[].InstanceId]')
aws ec2 describe-instances --instance-ids ${instances} | jq -r '.Reservations[].Instances[].PrivateIpAddress'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment