Skip to content

Instantly share code, notes, and snippets.

@msanjaypandit
Last active March 29, 2018 05:18
Show Gist options
  • Save msanjaypandit/f7a3d77bcf987bbdcdf2c1f37ca0178d to your computer and use it in GitHub Desktop.
Save msanjaypandit/f7a3d77bcf987bbdcdf2c1f37ca0178d to your computer and use it in GitHub Desktop.
[AWS CLI] #aws-cli #aws #cli #a3

Aws cli configuration

AWS Access Key ID [None]: YOURKEY
AWS Secret Access Key [None]: YOURSECRETKEY
Default region name [None]: us-west-2
Default output format [None]: json

Space in S3 Bucket
aws s3api --profile PROFILE_NAME list-objects --bucket BUCKETNAME --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