The default format in which AWS CLI data is returned is JSON. The JSON data that is returned can be queried with the query language JMESPath.
For example, using the AWS CLI, I can list the details of the volumes associated with my CLI profile. (aws ec2 describe-volumes)
Now, lets say there are many more volumes returned from this CLI command and from that output I want to find the volume(s) that were created before a specific date. (January 01, 2017)
I can utilize the query option on the AWS CLI command to return specifics from the JSON results. (aws ec2 describe-volumes –query ‘Volumes[?CreateTime<`2017-01-01`].VolumeId’)
However, sometimes getting the JMESPath syntax correct is not always easily. The extra tools that I utilize to help me are Visual Studio Code with the JMESPath plugin.
So with this VSCode plugin, you can quickly validate your JMESPath syntax if you need. One note when using the “–query” option on the CLI is that the processing is happening on the Client machine, unlike the “–filter” option that happens on the server.