Created
August 29, 2017 23:30
-
-
Save justinclayton/65b05497f73dc77840005e9954e0b684 to your computer and use it in GitHub Desktop.
Get private IPs of instances in an AWS autoscaling group
This file contains 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
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