A Lambda function processes SQS messages in batches and updates DynamoDB. To ensure “at-least-once” processing doesn’t create duplicates or inconsistent state, which design is most robust?

Answer

Use a unique idempotency key per message (e.g., messageId) stored in DynamoDB with a conditional write, and make the update conditional/transactional where needed

Explanation

SQS can redeliver, and batch partial failures complicate processing. Idempotency via conditional writes prevents duplicate side effects and keeps state consistent.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error
QuestionBack to list