Skip to content

Instantly share code, notes, and snippets.

@mmirolim
Created April 5, 2018 15:11
Show Gist options
  • Save mmirolim/644a08529662614f3f01e350f3c0dcca to your computer and use it in GitHub Desktop.
Save mmirolim/644a08529662614f3f01e350f3c0dcca to your computer and use it in GitHub Desktop.
total size of s3 storage
#!/bin/bash
for bucket in $(aws s3 ls |awk '{print $3}'); do
echo $bucket
for size in $(aws s3 ls s3://${bucket} --recursive |awk '{print $3}'); do
total=$(expr $total + $size);
echo "total=$total b"
done
done
echo "total=$total b"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment