我有一个工作流,它在 S3 存储桶中获取一个文件,并根据文件内容进行大量处理和进一步的请求。目前,客户端必须在上传文件后手动触发工作流。这对我来说似乎是一个很常见的用例,那么有什么方法可以在文件上传后立即触发工作流程?
我想在两者之间应该有一个 SNS 通知,但有没有办法将通知直接发送到 SWF,而无需服务使用它们并启动工作流?
最佳答案
更新
AWS 终于推出了New Event Notifications for Amazon S3今天,这确实只是扩展了长期可用的PUT Bucket notification API 附加 event types用于通过 S3 API(例如 PUT、POST 和 COPY)创建对象:
s3:ObjectCreated:*
s3:ObjectCreated:Put
s3:ObjectCreated:Post
s3:ObjectCreated:Copy
s3:ObjectCreated:CompleteMultipartUpload
初步回答
[...] is there any way to send the notification directly to the SWF, without having a service consuming them and starting the workflow?
不幸的是,没有这样的方法,您确实需要中介服务 - 而 PUT Bucket notification显然也被设计为允许其他类型的事件,Amazon S3不支持 Amazon SNS除 Enabling RRS Lost Object Notifications 之外的任何内容的通知从今天开始:
This implementation of the PUT operation uses the
notification
subresource to enable notifications of specified events for a bucket. Currently, thes3:ReducedRedundancyLostObject
event is the only event supported for notifications. Thes3:ReducedRedundancyLostObject
event is triggered when Amazon S3 detects that it has lost all replicas of an object and can no longer service requests for that object. [emphasis mine]
关于amazon-web-services - 上传到 S3 后触发 SWF 工作流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23816892/