In a Lambda function that processes API Gateway requests, which combination best ensures idempotent writes to DynamoDB when clients retry due to timeouts?

Answer

Use a conditional write with a deterministic partition key and an idempotency token stored as a unique attribute; return the existing item when the condition fails

Explanation

A conditional write tied to a stable idempotency token prevents duplicate side effects across retries. Reading/returning the existing item on condition failure preserves correctness under concurrency.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error
QuestionBack to list