bijoshtj
bijoshtj

Reputation: 309

How to give error response in aws lambda function when it is configured as s3 notification handler

I have a lambda function configured for receiving eventes whenever a file is dropped to my s3 bucket.

My requirement is to configure a dead letter queue for lambda function, so that any failure happened, event should go to dlq.

My question is that, what response should be given from lambda function, so that it will push event to dlq?

Eg scenario: I have an event validator module within lambda, if validation fails, i wanted to move it to dlq configured for my lambda function.

Upvotes: 3

Views: 318

Answers (1)

FelixEnescu
FelixEnescu

Reputation: 5102

Just throw an exception and make sure your function is idempotent:

Any Lambda function invoked asynchronously is retried twice before the event is discarded

See Dead Letter Queues in AWS Lambda Developer Guide.

Upvotes: 2

Related Questions