I have an S3 bucket named camera-assets
, in that bucket I have a separate folder for each camera and each folder contains millions / billions of files. I want to get a total number of files and storage of each folder in my bucket.
I tried following CLI command:
aws s3api list-objects --bucket camera-assets --prefix 1011-front-external/snapshots/ --output json --query "[sum(Contents[].Size), length(Contents[])]"
But failed to get the result because folder has million/billion of files. It works if there are only a few files.
Please help me to get files count and storage.
AWS command line interface tool has --summarize
option (have to use along with --recursive
), which shows number of objects & total size:
$ aws s3 ls s3://camera-assets --summarize --recursive
...
Total Objects: xx
Total Size: xx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With