Skip to content

Instantly share code, notes, and snippets.

@bepcyc
Created June 19, 2020 12:40
Show Gist options
  • Save bepcyc/b6727c5a2c90899815f076495946ee32 to your computer and use it in GitHub Desktop.
Save bepcyc/b6727c5a2c90899815f076495946ee32 to your computer and use it in GitHub Desktop.
S3 buckets file count
FILENAME=/tmp/buckets
for b in $(aws s3api list-buckets | jq -r ".Buckets[].Name"); do aws s3api list-objects --bucket $b --output json --query "[length(Contents[])]" | jq -c ".[0]" | xargs -I {} echo -e {}"\t$b" >>$FILENAME ; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment