aws configure

cli output filtering

For basic syntax, please refer to https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html

This article only share some practical examples.

server side filtering with option –filter

Server-side filtering in the AWS CLI is provided by the AWS service API. The AWS service only returns the records in the HTTP response that match your filter, which can speed up HTTP response times for large data sets. Since server-side filtering is defined by the service API, the parameter names and functions vary between services.

Notice:

  • –filter and –filters does not support regular expressions.
  • –filter-expression does support expression, but only a few aws service support this option

client side filtering with optioin –query

The AWS CLI provides built-in JSON-based client-side filtering capabilities with the –query parameter. The –query parameter is a powerful tool you can use to customize the content and style of your output. The –query parameter takes the HTTP response that comes back from the server and filters the results before displaying them. Since the entire HTTP response is sent to the client before filtering, client-side filtering can be slower than server-side filtering for large data-sets.

Client Side Filtering with jq

aws sts

aws ec2

aws s3

aws eks

cloudfront

acm

route53

ecr