3

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": [ ....
0

2 Answers 2

9

Change from single quotes to double quotes:

aws ec2 describe-volumes --profile TEST1 --region us-east-1 --query "Volumes[0]"
Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

PowerShell accepts both single and double quotes. The vanilla command line does not. See superuser.com/questions/324278/….

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.