If we need to fetch the S3 bucket storage size we need to trace via individual bucket under metrics we get the storage size.
on one go use the below script to get the bucket name with storage size.
s3list=`aws s3 ls | awk '{print $3}'`
for s3dir in $s3list
do
echo $s3dir
aws s3 ls "s3://$s3dir" --recursive --human-readable --summarize | grep "Total Size"
done
- create the .sh file
- copy the code on the file
- Excecute the script to get the s3 bucket details
Top comments (0)