A Java service publishes events to SNS, and multiple Lambda subscribers consume them. One subscriber sometimes fails transiently due to an external dependency outage. You must retry failed processing without duplicating irreversible side effects. What is the best option?
Answer
Use SNS to SQS subscription for that critical path and implement idempotency in the consumer; allow SQS redrive policies for retries
Explanation
SNS-to-SQS allows controlled retry behavior via SQS visibility timeouts and redrive policies, while idempotency prevents duplicate irreversible side effects. This balances retry reliability with correctness.
Last reviewed: October 2026
Reviewed by FirstInTest Editorial Team
Related questions
You need to ensure idempotency for an order-processing Lambda triggered by SQS messages. Messages might be delivered more than once, and processing must not double-charge. Which design is most appropriate?
View question →
A Lambda function reads multiple items from DynamoDB using BatchGetItem. The function should return a consistent view for a specific request, but the application does not require full transaction semantics across multiple tables. How can you best achieve request-level consistency?
View question →
A backend service uses API Gateway (HTTP API) to invoke a Lambda function. The Lambda writes to DynamoDB and occasionally needs to read additional details from S3. To meet least-privilege and avoid hardcoding credentials, which combination of AWS features is most appropriate?
View question →
You’re designing an AWS SDK-based .NET application that uploads objects to S3. The application must support resumable uploads and should minimize unnecessary retries and connection setup. What approach best fits the requirement?
View question →
In a serverless app, developers want to standardize how Lambda functions call external services with caching to reduce latency. They also want the cache to be shared across multiple concurrent function instances. The team proposes using an in-memory cache inside the Lambda handler, and also suggests storing tokens in environment variables for convenience. They need a robust approach that works across cold starts, supports token refresh, and avoids leaking secrets into logs or deployments.
View question →
A Node.js Lambda updates an item in DynamoDB using UpdateExpression and expects the update to fail if the record has changed since the client last read it. The client provides a version attribute. What DynamoDB strategy best ensures correct concurrency control?
View question →