Trigger S3 create event

后端 未结 3 1582
半阙折子戏
半阙折子戏 2021-02-12 17:45

I use S3 Create events to trigger AWS-Lambdas. If my processing fails I want to do some magic and then trigger the \"event\" again to start my processing ones more. So far the o

3条回答
  •  长情又很酷
    2021-02-12 18:16

    It is not possible to have an S3 Event trigger again without uploading the file again. However, for a failed processing event if you are using Lambda it will automatically be retried 3 times per the FAQ:

    For Amazon S3 bucket notifications and custom events, AWS Lambda will attempt execution of your function three times in the event of an error condition in your code or if you exceed a service or resource limit.

    If your processing is failing and you want to have more control over the retry you could instead use SQS to receive the S3 Events. That way your application is able to read messages off the queue and if the processing failes/dies the visibility timeout will eventually be reached and the SQS message can be processed again. This way you can retry indefinitely and also control the visibility timeout period between successive retries.

    If you are using Lambda and want to use SQS in combination, this is still possible by scheduling a Lambda function to run every 5 minutes and have that Lambda function read messages off of the queue. Combine this with the 5 minute limit for a Lambda functions run time you can nearly continuously consume messages off of an SQS queue.

提交回复
热议问题