Skip to content

Instantly share code, notes, and snippets.

@frosforever
Created October 18, 2017 13:11
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 frosforever/464a717880dc4125aa081292bb985357 to your computer and use it in GitHub Desktop.
Save frosforever/464a717880dc4125aa081292bb985357 to your computer and use it in GitHub Desktop.
recursive size of contents in bucket prefix
aws s3api list-objects --bucket BUCKET_NAME --prefix "whateverprefix/" --output json --query "[sum(Contents[].Size), length(Contents[])]"
@frosforever
Copy link
Author

also to get total usage of gp2 volumes:

 aws ec2 describe-volumes --query "[sum(Volumes[].Size), length(Volumes[])]" --filters Name=volume-type,Values=gp2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment