Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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