Ben
Ben

Reputation: 69

aws cli --query doesn't filter output in windows command promt

I am following the documentation to use the --query option in aws cli. However it doesn't work for me at all. I have defined profiles because I have several accounts to pull the data. If I omit the --query, it returns the data successfully. Any insight into this please?

Thank you

> aws --version
aws-cli/1.14.8 Python/3.6.3 Windows/10 botocore/1.8.12

> aws ec2 describe-volumes --profile TEST1 --region us-east-1 --query 'Volumes[0]'
"Volumes[0]"

> aws ec2 describe-volumes --profile TEST1 --region us-east-1
{
    "Volumes": [
        {
            "Attachments": [ ....

Upvotes: 3

Views: 1491

Answers (2)

John Hanley
John Hanley

Reputation: 81444

Change from single quotes to double quotes:

aws ec2 describe-volumes --profile TEST1 --region us-east-1 --query "Volumes[0]"

Upvotes: 9

Ben
Ben

Reputation: 69

As soon as i switched to powershell, it works successfully. Although I am not sure why it requires using powershell.

Upvotes: 0

Related Questions