开发者

Does Amazon S3's HTTP Uploads feature support web-hook style callbacks?

开发者 https://www.devze.com 2022-12-29 02:20 出处:网络
When uploading files to Amazon S3 using the browser http upload feature, I know I can specify a success_action_redirect field/value that will tell my browser where to go when the upload is done.

When uploading files to Amazon S3 using the browser http upload feature, I know I can specify a success_action_redirect field/value that will tell my browser where to go when the upload is done.

I'm wondering: is it possible to ask Amazon to make a web hook style POST request to my web server whenever a file gets uploaded?

Basically, I want a way of being notified whenever a client uploads a new file, so that my server can process the upload. I'd like to do this without relying on the client to make the request to my server to tell me the file has been uploaded (never trust the client,开发者_开发知识库 right?).


They just recently announced AWS Lambda which lets you run code in response to events, with S3 uploads being one of the supported events.


Amazon can publish a notification to SNS or SQS when an object has been created in your specified S3 bucket.

http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html


There is no support from Amazon regarding this as yet but we can get around this with other tools like s3cmd etc, which allow us to write cronjobs to notify us of any change in the keys on S3. So if a new key is created (notified via timestamp) we could have it send a GET request to our server endpoint listening for updates from S3 with the associated metadata.

We could use GET or POST here as the data would be very minimal I think. Probably a form data with POST should do.

0

精彩评论

暂无评论...
验证码 换一张
取 消