Get s3 bucket size from terminal

Get s3 bucket size from cli
aws s3 ls --summarize --human-readable --recursive s3://bucketname | grep "Total Size:" | cut -d":" -f2

Get all s3 size bucket size from shell script

#!/bin/bash
for s3dir in `aws s3 ls | awk  '{print $3}'`
do
    buketsize=`aws s3 ls --summarize --human-readable --recursive s3://$s3dir | grep "Total Size:" | cut -d":" -f2`
    echo "$s3dir $buketsize"
done

Share on Google Plus

About Md. Shahzad Alam

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment