You need to process an S3 upload event and write derived metadata to DynamoDB. Occasionally S3 notifications arrive more than once. Which combination is the best way to guarantee idempotent writes and handle failures reliably?

Answer

Write a deterministic item key derived from the object ETag and upsert in DynamoDB; also use an SQS queue as an event source with a DLQ

Explanation

Deriving a deterministic key enables safe upserts even when events repeat. SQS with a DLQ prevents poison-message loops and supports robust retries.

Last reviewed: October 2026

Reviewed by FirstInTest Editorial Team

Report an error

Related questions

When building an event-driven system with SNS to trigger Lambda, you observe that sometimes consumers receive events out of order and may process duplicates. How should the consumer design be optimized for correctness?

View question →

A Lambda author uses environment variables for configuration, but the values contain secrets (API tokens). They also observe that after updating the Lambda configuration, some invocations still use older values. What is the best remedy?

View question →

In DynamoDB, you use a GSI to query by customerId and filter by status. Query latency is high, and the filter expression is broad. Which redesign most likely reduces read cost and latency while keeping updates consistent?

View question →

You are developing a Java-based AWS Lambda function behind API Gateway using the AWS SDK. You want to reduce latency and avoid thread starvation during high concurrency. Which approach is best?

View question →

A Step Functions workflow coordinates three Lambdas: A (writes to DynamoDB), B (calls an external API), and C (writes final result). Lambda A sometimes succeeds but times out near completion; the external API should not be invoked unless A’s write is committed. What is the most robust approach?

View question →

You have an API backed by Lambda using API Gateway. A developer reports intermittent 502 errors only when many clients concurrently request a resource that performs a DynamoDB read and then calls another downstream service. Which design best improves resilience while preserving least-privilege?

View question →

QuestionBack to list