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

Post a Comment

Mới hơn Cũ hơn