Last active
May 16, 2018 22:07
-
-
Save gsantovena/7f18457c9ba8db5ff8d9 to your computer and use it in GitHub Desktop.
AWS CLI to get InstanceId and Private IP Address of Instances in AutoScalingGroup
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
aws --output text --region ${REGION} ec2 describe-instances --instance-ids $( | |
aws --output text --region ${REGION} \ | |
autoscaling describe-auto-scaling-instances \ | |
--query 'AutoScalingInstances[*].[AutoScalingGroupName,InstanceId]' | | |
grep ${ASG} | | |
awk '{ print $2 }' | |
) --query 'Reservations[*].Instances[*].[InstanceId,PrivateIpAddress]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment