How to calculate total space used by S3 ?


AllCloud Blog:
Cloud Insights and Innovation

Here’s a little script that uses s3cmd and calculate the total data size stored in all S3 buckets for the same account.

#!/bin/bash
for bucket in $(s3cmd ls |awk '{print $3}'); do
size=$(s3cmd du ${bucket} |awk '{print $1}')
total=$(expr $total + $size);
#echo $total
done
echo "total=$total kb"

Enjoy, Lahav

Lahav Savir

Founder and CTO, Cloud Platforms

Read more posts by Lahav Savir

Copyright 2021 | AllCloud | All Rights Reserved