Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
Last active September 15, 2021 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinhooke/068302c33e029435f21b6af6f6da4439 to your computer and use it in GitHub Desktop.
Save kevinhooke/068302c33e029435f21b6af6f6da4439 to your computer and use it in GitHub Desktop.
Filter aws cli resource lists for a specific single attribute value
# Lambda ARNs
aws lambda list-functions | jq '.Functions[].FunctionArn'
# multiple properies: outputs on separate lines
aws lambda list-functions | jq -r '.Functions[] | .FunctionArn, .FunctionName'
# multiple properties as arrays
aws lambda list-functions | jq -r '.Functions[] | [.FunctionArn, .FunctionName]'
# multiple properties as arrays, converted to csv
aws lambda list-functions | jq -r '.Functions[] | [.FunctionArn, .FunctionName]. | @csv'
# or, map selected attribtues to csv list
aws lambda list-functions | jq -r '.Functions[] | {FunctionArn, FunctionName} | to_entries | map(.value) | @csv'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment