S3 Buckets: Is looping over all the files and adding it up the only way to get the size of a bucket?

StackOverflow https://stackoverflow.com/questions/8770733

  •  14-04-2021
  •  | 
  •  

I have an S3 bucket and I'm using the S3 gem in rails.

I wouldn't mind checking the size of bucket every now and again.

Is the only way to do this loop over all the files in a bucket and add them up, or is there simple way to just get the bucket size?

Cheers.

有帮助吗?

解决方案

Yes.

If you are on heroku or similar, you likely will want to launch the counting process on Ironworker (which I have tried and seems easy) to do that calculation. Heroku will only allow 40 second 'jobs', as its built for customer facing website stuff.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top