AWS CLI Cheat Sheet/Filter results with JMESPath

Select fields from JSON output.

Section: Global Options, Output, and Queries

Filter results with JMESPath

bash
bash
aws ec2 describe-instances --query 'Reservations[].Instances[].{Id:InstanceId,State:State.Name,Type:InstanceType}'
Explanation

The `--query` option applies a JMESPath expression to the response.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Global Options, Output, and Queries
Override region for one command
Run a command in a specific region.
OpenIn sheetbashsame section
Use a specific profile
Run a command under a named profile.
OpenIn sheetbashsame section
Render tabular output
Format command results as a table.
OpenIn sheetbashsame section
Disable the default pager
Prevent output from opening in a pager.
OpenIn sheetbashsame section
Disable automatic pagination
Fetch only the first page of a paginated result set.
OpenIn sheetbashsame section
Control service page size
Reduce the number of items retrieved per service call.
OpenIn sheetbashsame section