-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Using --query to select tag by value not tab delimitated #758
Comments
Looking... I'm guessing it's related to the bug fix for #751 reported here: https://forums.aws.amazon.com/thread.jspa?messageID=534743#534743 |
When I installed v1.3.1 and tried the query above I get the same output as shown in the bug linked in #751. The second value is a list value instead of just the value of the tag:
Is that the same output you were previously seeing? The reason this is now happening with the latest release is that list values are now written out on their own separate line. The JSON values from the above query looks like:
In order to get them all in a single row, they need to be in a single list like:
So specifically, you'll need to say you want the first element in the list of tag values. This is possible in the develop branch of the CLI, but is not in an actual release just yet. The syntax for this is:
I'll update this issue when a CLI release is pushed that has support for this syntax. |
Closing, version 1.3.8 of the CLI now supports this syntax. |
Umgh, how come I see the exact same issue with awscli aws-cli/1.9.8 Python/2.7.10 Linux/4.2.6-201.fc22.x86_64+debug botocore/1.3.8? aws ec2 describe-instances --query "Reservations[].Instances[].[State.Name,InstanceId,InstanceType,Tags[0].Value]" --output table aws ec2 describe-instances --query "Reservations[].Instances[].[State.Name,InstanceId,InstanceType,Tags[?Key=='Name'].Value]" --output table | running | As a workaround |
@Hount |
Just as a way to demonstrate a use case.
Looks like ..
|
Previously when I used --query to select a specific tag value by key it's text output was tab delimitated. After updating to the latest aws-cli (from 1.3.1 to 1.3.7) the tag value is now added after other values and on it's own line. For example:
aws ec2 describe-instances --query 'Reservations[].Instances[].[InstanceId, Tags[?Key==
Name
].Value, State.Name]' --output textThe output of such is
InstanceID State
TagValue
Whereas before it would show
InstanceId TagValue State
The text was updated successfully, but these errors were encountered: