Getting the download count of a specific S3 object

我的未来我决定 提交于 2019-12-10 18:32:09

问题


I've got a number of S3 objects that are available to my customers. Since I'd like to bill my customers by usage, I wondered if there is any smart kind of way to get the number of times a given file has been downloaded?

Alternatively, I suppose I could parse the log files provided by S3, but with 10m+ fetches per customer this might be bit of a task.

Any ideas?


回答1:


If you let them download via HTTP then you could use a URL shortener service to redirect to your file (like goo.gl). I suppose they can handle load and they also provide some nice stats next to total clicks.




回答2:


You could redirect through a script on your site that increments a count before redirecting to the S3 URL.




回答3:


There'd be some assembly required and it needs some cleanup, but I wrote an app for this based on node.js and Couchbase. I need to update it a bit more, but it will count HTTP 200s based on object size rather than just hitcount alone (which is inaccurate) and I've just been updating it to aggregate HTTP 206s.



来源:https://stackoverflow.com/questions/3028103/getting-the-download-count-of-a-specific-s3-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!