DVA-C02 practice question 26 of 35
A company has an application that uses an AWS Lambda function to process customer orders. The company notices that the application processes some orders more than once. A developer needs to update the application to prevent duplicate processing. Which solution will meet this requirement with the LEAST implementation effort?
Full set: 598 questionsDomain Troubleshooting and Optimization
The most efficient and standard method to prevent duplicate processing in a Lambda function is to implement an idempotency check. Using Amazon DynamoDB as a control database is a common serverless design pattern for this purpose. The function can extract a unique identifier (e.g., orderid) from the event and attempt to write it to a DynamoDB table using a conditional expression like attributenotexists. If the write succeeds, the event is new and can be processed. If it fails because the identifier already exists, the function can safely skip processing, thus preventing duplication with minimal code and infrastructure overhead.
B. This is overly complex. Creating an ECS task and orchestrating it with Step Functions introduces significant architectural overhead and violates the "LEAST implementation effort" requirement for a simple idempotency check.
C. Retries are for handling failed invocations, not for preventing duplicate processing of distinct successful invocations. This mechanism does not address the root cause of processing an event that has already been successfully completed.
D. This is a reactive, not a preventative, solution. Using Athena to find duplicates after they have already been processed adds complexity and requires building compensation logic, rather than preventing the issue upfront.
1. AWS Well-Architected Framework, Serverless Applications Lens (REL 12): "To make your workload idempotent, you can use a unique request identifier. When a request is made, you can store this identifier in a persistent store, such as Amazon DynamoDB. Before you process a request, you check if the identifier exists in the store." (AWS Whitepaper, Serverless Applications Lens, Page 43).
2. AWS Lambda Powertools for Python Documentation (Idempotency Utility): "The idempotency utility provides a simple solution to convert your Lambda functions into idempotent operations... It requires a persistence layer to store the state of your function executions. The persistence layer is used to store a token for each request and prevent the execution of the same request multiple times. The utility currently supports Amazon DynamoDB as a persistence layer." (AWS Labs, AWS Lambda Powertools for Python, Idempotency section).
3. Amazon DynamoDB Developer Guide (Conditional Writes): "Amazon DynamoDB supports conditional writes for write operations (PutItem, UpdateItem, DeleteItem)... A conditional write succeeds only if the item attributes meet one or more expected conditions. Otherwise, it returns an error." This is the underlying mechanism used to atomically check for and record the unique identifier. (Amazon DynamoDB Developer Guide, Working with Items and Attributes, Conditional Writes).
Keep practicing
Take the free DVA-C02 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DVA-C02 practice questions
- Question 1A company has a multi-node Windows legacy application that runs on premises. The applicat…
- Question 2A developer migrated a legacy application to an AWS Lambda function. The function uses a …
- Question 3A development learn has an Amazon API Gateway REST API that is backed by an AWS Lambda fu…
- Question 4A company is expanding the compatibility of its photo-snaring mobile app to hundreds of a…
- Question 5A company has an ecommerce application. To track product reviews, the company's developme…
- Question 6A social media company is designing a platform that allows users to upload data, which is…
