Determine size of an S3 bucket or folder
Writing by shivdev on Wednesday, 16 of March , 2016 at 6:01 pm
Ensure that you have awscli installed as well as your keys setup in ~/.aws/credentials
To determine the size of an S3 Bucket or a folder, you can summarize the output as follows.
aws s3 ls –summarize –human-readable –recursive s3://mybucket/directory/
…
2015-03-05 19:57:33 71 Bytes directory/sub1/sub2/file.gz
…
Total Objects: 71
Total Size: 81.9 MiB
To determine the size of an S3 Bucket, you can also use s3api list-objects as shown below.
aws s3api list-objects –bucket mybucket –output json –query “[sum(Contents[].Size), length(Contents[])]”
[
351885203186,
4668
]
For more info refer to ServerFault
Leave a comment
Category: AWS
- Add this post to
- Del.icio.us -
- Digg -
- -
- Tweet -
-
-