Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 376
bijoshtj Avatar asked Jan 17 '26 09:01

bijoshtj


1 Answers

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.

like image 113
FelixEnescu Avatar answered Jan 20 '26 00:01

FelixEnescu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!