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
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top