Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 589
Dan P Avatar asked Jul 31 '15 10:07

Dan P


People also ask

What can AWS CLI do?

The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

What AWS CLI output format is most readable by a person?

The table format produces human-readable representations of complex AWS CLI output in a tabular form. You can combine the --query option with the table format to display a set of elements preselected from the raw output.

How do I see all ec2 instances in all regions?

Go to VPC dashboard https://console.aws.amazon.com/vpc/home and click on Running instances -> See all regions .


1 Answers

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
like image 176
garnaat Avatar answered Sep 23 '22 13:09

garnaat