-
-
Save diplodata/9afe41bf5c50ca58b7e98ea90e47aa13 to your computer and use it in GitHub Desktop.
AWS S3 List all buckets size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for dir in $(aws s3 ls | awk '{print $3'}); do | |
size=$(aws s3 ls s3://${dir} --recursive | grep -v -E "(Bucket: |Prefix: |LastWriteTime|^$|--)" | awk 'BEGIN {total=0}{total+=$3}END{print total/1024/1024" MB"}'); | |
echo "${dir} => $size" | tee -a disk.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment