Skip to content

Instantly share code, notes, and snippets.

Avatar

Dan Pritts danpritts

View GitHub Profile
View gist:a49cc673ad20a1e7fb56

Using aws-cli and jq

list all instances for all ASGs

aws autoscaling describe-auto-scaling-instances \
  | jq '.AutoScalingInstances[] | {AutoScalingGroupName, InstanceId}'

list instance IDs for a particular ASG

@hummus
hummus / gist:8592113
Last active Sep 10, 2020
aws cli + jq example
View gist:8592113
wget http://stedolan.github.io/jq/download/linux64/jq
aws ec2 describe-instances --filters "Name=tag:Name,Values=$NAME" \
"Name=instance-state-name,Values=running" \
| jq -r \
".Reservations[] | .Instances[] | .InstanceId" \
aws ec2 describe-volumes --filters \
"Name=status,Values=available" \
| jq -r ".Volumes[] | .VolumeId" \
You can’t perform that action at this time.