Skip to content

v0.2.0 - k9 query command

Choose a tag to compare

@skuenzli skuenzli released this 14 Jul 23:52
· 21 commits to main since this release
ce9e7db

The k9 CLI now supports the query command to query and filter:

  • principals
  • principal access summaries
  • resources
  • resource access summaries

These sub commands print the data from the eponymously named report view in either csv or json format. You can filter the data using the --names and --arns flags.

See example commands below:

# Query specific principals
k9 query principals \
    --customer_id $K9_CUSTOMER_ID \
    --account $K9_ACCOUNT_ID \
    --analysis-date 2022-07-01 \
    --arns arn:aws:iam::139710491120:role/k9-dev-appeng \
    --names k9-auditor \
    --format json | jq '.'

# Query principal access summaries for specific principals
k9 query principal-access \
    --customer_id $K9_CUSTOMER_ID \
    --account $K9_ACCOUNT_ID \
    --analysis-date 2022-07-01 \
    --arns arn:aws:iam::139710491120:role/k9-dev-appeng \
    --names k9-auditor \
    --format json | jq '.'
    
# Query specific resources
k9 query resources \
    --customer_id $K9_CUSTOMER_ID \
    --account $K9_ACCOUNT_ID \
    --analysis-date 2022-07-01 \
    --arns arn:aws:rds:us-east-1:139710491120:cluster:int-test-pg-01 \
    --names qm-dev-k9-reports \
    --format json | jq '.'

# Query resource access summaries for specific resources
k9 query resource-access \
    --customer_id $K9_CUSTOMER_ID \
    --account $K9_ACCOUNT_ID \
    --analysis-date 2022-07-01 \
    --arns arn:aws:rds:us-east-1:139710491120:cluster:int-test-pg-01 \
    --names qm-dev-k9-reports \
    --format json | jq '.'