获取当用户上传通知的S3存储? [英] Get notified when user uploads to an S3 bucket?

查看:172
本文介绍了获取当用户上传通知的S3存储?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  新S3的通知对象

Possible Duplicate:
Notification of new S3 objects

我们已经有了一个应用程序,存储在S3上的用户数据。我们的应用程序中处理该上传的部分是从该处理数据的部分脱钩。在某些情况下,用户将可以直接上传数据到S3,而无需通过我们的应用程序将在所有(这可能会发生,如果他们有自己的S3帐户和凭据向我们提供)。

We've got an app that stores user data on S3. The part of our app that handles the uploads is decoupled from the part that processes the data. In some cases, the user will be able to upload data directly to S3 without going through our app at all (this may happen if they have their own S3 account and supply us with credentials).

是否有可能得到通知,每当一个S3桶变化的内容是什么?这将是冷静,如果莫名其妙的消息可能会被发送,说:加入这个文件/更新/删除:富。

Is it possible to get notified whenever the contents of an S3 bucket change? It would be cool if somehow a message could get sent that says "this file was added/updated/deleted: foo".

简短的是,有一些时间戳的地方,我可以查询,将告诉上次桶被更新?

Short of that, is there some timestamp somewhere I could poll that would tell the last time the bucket was updated?

如果我不能做任何这些东西,那么唯一的办法是抓取了整个水桶和寻找变化。这将是缓慢且昂贵。

If I can't do either of these things, then the only alternative is the crawl the entire bucket and look for changes. This will be slow and expensive.

推荐答案

更新2014-11:

由于阿兰解毒,阿莫西林指出,在评论中,AWS现在支持从S3到SNS,它可以自动转发到SQS通知:的 http://aws.amazon.com/blogs/aws/s3-event-notification/

As Alan Illing points out in the comments, AWS now supports notifications from S3 to SNS, which can be forwarded automatically to SQS: http://aws.amazon.com/blogs/aws/s3-event-notification/

S3也可以将通知发送到AWS LAMBDA直接运行自己的code。

S3 can also send notifications to AWS Lambda to run your own code directly.

原反应,predicted S3-> SNS通知:

如果亚马逊支持这一点,他们会使用SNS来发送的对象已添加到水桶的通知。然而,在目前,通过S3和SNS支持的唯一斗事件是当亚马逊S3检测到它已经失去了减少冗余存储(RRS)对象的所有副本,不能再服务请求的对象来通知您。

If Amazon supported this, they would use SNS to send out notifications that an object has been added to a bucket. However, at the moment, the only bucket event supported by S3 and SNS is to notify you when Amazon S3 detects that it has lost all replicas of a Reduced Redundancy Storage (RRS) object and can no longer service requests for that object.

下面是由S3支持的SNS事件的文档:

Here's the documentation on the SNS events supported by S3:

http://docs.amazonwebservices.com/AmazonS3/latest/dev/ NotificationHowTo.html

根据该文件的写入方法,它看起来像亚马逊都有自己的想法为其他通知事件增加(比如,也许你的想法,找出在新的密钥已被添加)。

Based on the way that the documentation is written, it looks like Amazon has ideas for other notification events to add (like perhaps your idea for finding out when new keys have been added).

由于它直接通过亚马逊的S3客户端上传对象S3将需要触发通知,或者你需要做一些投票站的不支持。

Given that it isn't supported directly by Amazon, the S3 client that uploads the object to S3 will need to trigger the notification, or you will need to do some sort of polling.

自定义事件通知使用SNS,如果你想获得处理近实时更新,也可以通过SQS,如果你喜欢让通知堆放和处理出来来完成队列自己的步调。

Custom event notification for uploads to S3 could be done using SNS if you like to get near-real-time updates for processing, or it can be done through SQS if you like to let the notifications pile up and process them out of a queue at your own pace.

如果你是查询,你可以减少你需要通过让客户端上传了preFIX,比如说,要求按键的数量未处理/ ......后面的唯一关键。然后,您的查询软件可以查询开始与preFIX只是S3键。当它准备过程中,它可以改变的关键在于处理/ ......再后来,以加工/ ...或什么的。在S3对象通过复制当前更名+删除由S3执行的操作。

If you are polling, you could reduce the number of keys you need to request by having the client upload with a prefix of, say, "unprocessed/..." followed by the unique key. Your polling software can then query just S3 keys starting with that prefix. When it is ready to process, it could change the key to "processing/..." and then later to "processed/..." or whatever. Objects in S3 are currently renamed by copy+delete operations performed by S3.

这篇关于获取当用户上传通知的S3存储?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆