最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - how to get s3 bucket size via aws-sdk (javascript or node) - Stack Overflow

programmeradmin2浏览0评论

I tried to find/get s3 bucket information using javascript/nodejs aws-sdk, but I didnt find such apis. How to get s3 bucket size / information via aws-sdk (javascript or node) api.

I tried to find/get s3 bucket information using javascript/nodejs aws-sdk, but I didnt find such apis. How to get s3 bucket size / information via aws-sdk (javascript or node) api.

Share Improve this question asked Oct 14, 2016 at 11:32 sk16sk16 531 silver badge5 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Once a day the size of the bucket is reported to CloudWatch. The Metric is called BucketSizeBytes and you can supply the BucketName as a dimension and the StorageType (AllStorageTypes, StandardStorage, StandardIAStorage, ReducedRedundancyStorage).

You can use the JavaScript SDK to acceess the data in CloudWatch via the getMetricStatistics of the CloudWatch client. http://docs.aws.amazon./AWSJavaScriptSDK/latest/AWS/CloudWatch.html#getMetricStatistics-property

There is no API to get the bucket size other than enumerating all the objects.

One alternative approach would be to investigate the billing, but I think that will only yield inaccurate data as the billing handles a specific size over a specific time.

发布评论

评论列表(0)

  1. 暂无评论