amazon-web-servicesaws-cliec2-api-tools

AWS CLI filter OR logic


I am trying to retrieve a list of servers using the AWS CLI tools. I have 2 groups of servers, 1 will have the string "mind" in the Name tag, another group will have the string "intelligence" in the Name tag.

I can filter the output of DescribeInstances using wildcards but can I return instances that contain mind OR intelligence? in the Name?

Currently I have to run the command twice replacing the filter Value.


Solution

  • You can supply multiple values for a tag. I think something like this would work for you:

    aws ec2 describe-instances --filters Name=tag:Name,Values=mind,intelligence