新 S3 对象的通知 [英] Notification of new S3 objects
问题描述
我有一个场景,我们有很多客户端上传到 s3.
I have a scenario where we have many clients uploading to s3.
- 知道有新文件的最佳方法是什么?
- 让我每隔几秒轮询一次存储桶是否现实/好主意?
推荐答案
更新:
自 2014 年 11 月起,S3 支持以下事件通知:
Since November 2014, S3 supports the following event notifications:
s3:ObjectCreated:Put
– 对象是由 HTTP PUT 操作创建的.s3:ObjectCreated:Post
– 一个对象是通过 HTTP POST 操作创建的.s3:ObjectCreated:Copy
– 在 S3 复制操作中创建了一个对象.s3:ObjectCreated:CompleteMultipartUpload
– 通过完成 S3 分段上传创建对象.s3:ObjectCreated:*
– 对象是由上面列出的事件类型之一或由将来添加的类似对象创建事件创建的.s3:ReducedRedundancyObjectLost
– 一个以减少冗余存储的 S3 对象已丢失.
s3:ObjectCreated:Put
– An object was created by an HTTP PUT operation.s3:ObjectCreated:Post
– An object was created by HTTP POST operation.s3:ObjectCreated:Copy
– An object was created an S3 copy operation.s3:ObjectCreated:CompleteMultipartUpload
– An object was created by the completion of a S3 multi-part upload.s3:ObjectCreated:*
– An object was created by one of the event types listed above or by a similar object creation event added in the future.s3:ReducedRedundancyObjectLost
– An S3 object stored with Reduced Redundancy has been lost.
这些通知可以发送到 Amazon SNS、SQS 或 Lambda.查看艾伦的回答中链接的博文,了解有关这些新通知的更多信息.
These notifications can be issued to Amazon SNS, SQS or Lambda. Check out the blog post that's linked in Alan's answer for more information on these new notifications.
原答案:
虽然 Amazon S3 有一个存储桶通知系统,但它不支持除 s3:ReducedRedundancyLostObject 事件之外的任何通知(请参阅其 API 中的 GET Bucket 通知部分).
Although Amazon S3 has a bucket notifications system in place it does not support notifications for anything but the s3:ReducedRedundancyLostObject event (see the GET Bucket notification section in their API).
目前检查新对象的唯一方法是以预设的时间间隔轮询存储桶或在上传客户端中构建您自己的通知逻辑(可能基于 Amazon SNS).
Currently the only way to check for new objects is to poll the bucket at a preset time interval or build your own notification logic in the upload clients (possibly based on Amazon SNS).
这篇关于新 S3 对象的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!