Question 1 of 17
How would you design an SQS-triggered Lambda consumer to tolerate duplicate delivery, and why does idempotency matter?
Strong Interview Answer
I would make the handler idempotent by using a durable idempotency key, such as the message ID or business transaction ID, and recording it with a conditional write before applying side effects. SQS and Lambda can redeliver a message, so a duplicate should become a safe no-op.
What to Listen For
- SQS duplicate delivery
- idempotency
- durable processed-ID record
- safe retries
Caution
This question tests the ability to implement a strategy to prevent duplicate actions in a Lambda function processing messages from an SQS queue.