how.wtf

Get size of an S3 bucket with AWS CLI

· Thomas Taylor

Using the AWS CLI, S3 bucket sizes can retrieved.

Finding the S3 Bucket Size

Use the s3 list command with the --summarize option.

1aws s3 ls --summarize --human-readable --recursive s3://bucket-name/

Output:

12023-02-27 00:11:33    5.1 KiB object1name
22023-02-06 00:31:42    5.5 KiB object2name
3
4Total Objects: 2
5   Total Size: 10.6 KiB

If the output is too noisy, we can retrieve the last 2 lines of the output:

1aws s3 ls --summarize --human-readable --recursive s3://bucket-name/ | tail -2

Output:

1Total Objects: 2
2   Total Size: 10.6 KiB

#aws   #aws-cli  

Reply to this post by email ↪