Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save stefanolaru/78d491973ff62ebf6ebb91e1a2c21f83 to your computer and use it in GitHub Desktop.
Save stefanolaru/78d491973ff62ebf6ebb91e1a2c21f83 to your computer and use it in GitHub Desktop.
List S3 buckets size
for bucket in $(aws s3api list-buckets --query "Buckets[].Name" --output text); do echo $bucket
aws s3api list-objects --bucket $bucket --output json --query "[sum(Contents[].Size), length(Contents[])]"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment