Skip to content

Instantly share code, notes, and snippets.

@tomlobato tomlobato/s3size.sh

Created Jan 24, 2016
Embed
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]";
done;
}
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.