Skip to content

Instantly share code, notes, and snippets.

@tomlobato tomlobato/

Created Jan 24, 2016
What would you like to do?
Find Amazon S3 bucket usage
function s3size() {
for path in $*; do
size=$(aws s3 ls "s3://$path" --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{printf "%.2fGb\n", (total/1024/1024/1024)}');
echo "[s3://$path]=[$size]";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.