-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
having trouble getting multiple filters to work #582
Comments
Does it do what you want if you separate the two tags as distinct arguments to the filters option?
I agree that it is a bit odd to pass multiple values to a single option in *nix commands, but it works for me. |
@ehammond perfect, thanks! I still think what is meant by "list" should be documented in the help
perhaps instead of (list) it can say I realize this may be an implementation detail of whichever opt parser is used under the covers... |
Please note that even the example in the help is wrong. On the
The command doesn't do what's in the description. It took me several puzzled looks, and I found the solution only after I found this bug. |
@tobiaspal This has been fixed here. This will go out in the next release. Will look at updating the doc synopsis as well. |
Doc synopsis has been updated now. Closing out issue. |
… to use AND logic. See aws/aws-cli#582 for details
The following JSON format appear to work:
|
also works but it appears to be OR relationship while the JSON format appears to be AND relationship between the two filters. |
This is so confusing! Thank God I found this page! |
@michaelxwang I just noticed this too. That inconsistent behavior has got to be a bug... |
List the all the Instances With all the Instances Details along with attached Volume Details it must include Volume Name, Volume, and Size Using this command I can be able to list the volume details with instance id and volume size. aws ec2 describe-volumes –-query "Volumes[*].[Attachments[0].VolumeId,AvailabilityZone,Attachments[0].InstanceId,Attachments[0].State,Size]" --output text > test.txt But my query I have to consolidate the whole instance list its includes instance id, instance state, region, platform, key pair name along with attached volumes name, volume id, volume size and mount path name like /dev/sda1, Please help me with this. Using this command can be able to get the instance details but I need to single query to get all the details. aws ec2 describe-instances --filters "Name=instance-state-name,Values=*" --query "Reservations[].Instances[].[Tags[?Key==Name]| [0].Value,InstanceId,State.Name,InstanceType,Placement.AvailabilityZone,PrivateIpAddress,VolumeInfo:BlockDeviceMappings" --output text > instances.txt |
In the particular case of querying a tag key and value, you can also do something like this:
In that case, 'Patch Group' is a tag key. |
Did this formatting just change ? I had script running successfully - all of a sudden it fails to filter with the OR statement here on the filter. e.g. ec2_id1lst1=$(aws ec2 describe-instances --region $region --filter "Name=tag:Name,Values=$ec2_name1upper,Name=tag:Name,Values=$ec2_name1lower" --query 'Reservations[].Instances[].[InstanceId]' --output text | sed '$!N;s/\n/ /') Looks like the OR statement was changed to AND. Is there instruction somewhere on this change and how to use a different OR for the filter? |
I had a script fail recently as well, this below is currently working ...
aws ec2 describe-images --owners 099720109477 --filters "Name=name,Values=*ubuntu*bionic*" "Name=architecture,Values=x86_64"
aws ec2 describe-images --owners 099720109477 --filters "Name=name,Values=*ubuntu*bionic*" "Name=architecture,Values=x86_64,arm64" |
multiple values can be used as a proxy for OR |
Currently, `sam validate` requires AWS Creds (due to the SAM Translator). This commits adds the ability to pass in the credientials through a profile that is configured through `aws configure`.
* fix: Functional tests must run on localhost to work in Windows (aws#552) * fix: spacing typo in Log statement in start-lambda (aws#559) * docs: Fix syntax highlighting in README.md (aws#561) * docs: Change jest to mocha in Nodejs init README (aws#564) * docs: Fix @mhart link in README (aws#562) * docs(README): removed cloudtrail, added SNS to generate-event (aws#569) * docs: Update repo name references (aws#577) * feat(debugging): Fixing issues around debugging Golang functions. (aws#565) * fix(init): Improve current init samples around docs and fixes (aws#558) * docs(README): Update launch config to SAM CLI from SAM Local (aws#587) * docs(README): Update sample code for calling Local Lambda Invoke (aws#584) * refactor(init): renamed handler for camel case, moved callback call up (aws#586) * chore: aws-lambda-java-core 1.1.0 -> 1.2.0 for java sam init (aws#578) * feat(validate): Add profile and region options (aws#582) Currently, `sam validate` requires AWS Creds (due to the SAM Translator). This commits adds the ability to pass in the credientials through a profile that is configured through `aws configure`. * docs(README): Update README prerequisites to include awscli (aws#596) * fix(start-lambda): Remove Content-Type Header check (aws#594) * docs: Disambiguation "Amazon Kinesis" (aws#599) * docs: Adding instructions for how to add pyenv to your PATH for Windows (aws#600) * docs: Update README with small grammar fix (aws#601) * fix: Update link in NodeJS package.json (aws#603) * docs: Creating instructions for Windows users to install sam (aws#605) * docs: Adding a note directing Windows users to use pipenv (aws#606) * fix: Fix stringifying λ environment variables when using Python2 (aws#579) * feat(generate-event): Added support for 50+ events (aws#612) * feat(invoke): Add region parameter to all invoke related commands (aws#608) * docs: Breaking up README into separate files to make it easier to read (aws#607) * chore: Update JVM size params to match docker-lambda (aws#615) * feat(invoke): Invoke Function Without Parameters through --no-event (aws#604) * docs: Update advanced_usage.rst with clarification on --env-vars usage (aws#610) * docs: Remove an extra word in the sam packaging command (aws#618) * UX: Improves event names to reflect Lambda Event Sources (aws#619) * docs: Fix git clone typo in installation docs (aws#630) * docs(README): Callout go1.x runtime support (aws#631) * docs(installation): Update sam --version command (aws#634) * chore(0.6.0): SAM CLI Version bump (aws#635)
What if you want to use multiple filters with an AND condition instead of OR? |
I want to describe all instances that match two tags. Perhaps I don't have the syntax right, but I can't find it documented anywhere.
aws ec2 describe-instances --filters "Name=tag:Name,Values=xxx,Name=tag:env,Values=dev"
gives me all instances by tag:env, and ignores tag:Name
The text was updated successfully, but these errors were encountered: