Last active
August 29, 2015 14:15
-
-
Save toshihirock/08cef2f72ed933cac012 to your computer and use it in GitHub Desktop.
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 ec2 describe-instances --filter "Name=instance-state-name,Values=running" | jq '.Reservations[].Instances[].InstanceId' | |
# filter tag name | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Name" "Name=tag-value,Values=dev-hoge" | jq '.Reservations[].Instances[].InstanceId' | |
# or | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Name" "Name=tag-value,Values=dev-hoge,verification-hoge" | jq '.Reservations[].Instances[].InstanceId' | |
# get name in Tags | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Group" "Name=tag-value,Values=hoge-fuga" | jq '.Reservations[].Instances[].Tags[] | select(.Key == "Name") | .Value' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment