I have customer assets stored in S3 an account-related value serving as the first element in the path to each asset, e.g.
- account-1/media/video/382476581823.mp4
- account-1/images/2348752.png
I would like to find the total amount of storage being consumed by all assets for an account -- all the assets that have a prefix of "account-1" for the path in the above example. I have a working solution that iterates over the ObjectSummary objects returned by the S3 query but it's too slow for my needs because it performs an HTTP request for each object.
I'm wondering if it's possible to perform the calculation in an S3 query similar to what you might do with DynamoDB -- ask S3 to perform the calculation and return the total.
Note: Using aws-sdk-ruby