Skip to content

Instantly share code, notes, and snippets.

@colehocking
Created July 30, 2020 16:55
Show Gist options
  • Save colehocking/1994c6b9cb028e01cf77db16690e33b6 to your computer and use it in GitHub Desktop.
Save colehocking/1994c6b9cb028e01cf77db16690e33b6 to your computer and use it in GitHub Desktop.
Get the S3 bucket size
aws s3api --profile PROFILE_NAME list-objects --bucket BUCKET_NAME --output json --query "[sum(Contents[].Size), length(Contents[])]" | awk 'NR!=2 {print $0;next} NR==2 {print $0/1024/1024/1024" GB"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment