Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andytumelty/b5631e2d6534b12c4095420c9a79ea16 to your computer and use it in GitHub Desktop.
Save andytumelty/b5631e2d6534b12c4095420c9a79ea16 to your computer and use it in GitHub Desktop.
AWS CLI Get Instances in ASG and return ID, name, state
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