Last active
February 27, 2023 19:11
-
-
Save andytumelty/b5631e2d6534b12c4095420c9a79ea16 to your computer and use it in GitHub Desktop.
AWS CLI Get Instances in ASG and return ID, name, state
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=asg1 aws ec2 describe-instances --filters "Name=tag:aws:autoscaling:groupName,Values=$ASG" |\ | |
jq '.Reservations[].Instances[] | [.InstanceId, (.Tags | map(select(.Key == "Name").Value)[0]), .State.Name]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment