I want to filter multiple tags on AWS CLI.
I have something like this:
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query 'Reservations[*].Instances[*].Tags[*]'
this command gives me all my tags on instances.
I have like 900 instances and 30 tags for each of them.
What I'm trying to do is
1)Sort by three tag:
"Key:a && Key:b && Key:c"
2) After I get Key I want to search for value too:
"Key:a, Value:x && Key:b, Value=y && Key:c, Value=Z"
Basically, I need to search through these instances by tag name from CLI.
If you wish to filter by tags so that the response only contains instances with those tags, you can add more --filters
:
--filters Name=instance-state-name,Values=running Name=tag:a,Values=x Name=tag:b,Values=y Name=tag:c,Values=z