DVA-C02 Development with AWS Services Practice Question
A developer is using AWS Lambda to process files uploaded to an S3 bucket. The Lambda function is triggered by S3 events. The developer notices that the function sometimes processes the same file multiple times. Which TWO steps should the developer take to make the processing idempotent? (Choose TWO.)
⚠ Common exam trap
Many candidates confuse reducing batch size or increasing timeout with solving duplicate processing, when in fact idempotency requires a stateful check (like DynamoDB) to track what has already been processed.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Check if the file has already been processed by storing a marker in DynamoDB.
Storing a marker in DynamoDB (e.g., a record with the S3 object key as the partition key) allows the Lambda function to check if a file has already been processed before performing the work. This ensures that even if the same S3 event is delivered multiple times (due to retries or duplicate notifications), the function will skip reprocessing, making the operation idempotent.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Check if the file has already been processed by storing a marker in DynamoDB.
Why this is correct
This strategy involves using a unique identifier for each file, such as its S3 object key or ETag, as a primary key in a DynamoDB table. Before processing a file, the Lambda function attempts to write this identifier to DynamoDB. If the write succeeds (e.g., using a conditional write `attribute_not_exists`), the file is processed; otherwise, if the item already exists, it indicates prior processing, and the function can safely exit, ensuring idempotent execution.
- ✓
Use conditional writes in DynamoDB to ensure that updates are idempotent.
Why this is correct
Conditional writes in DynamoDB provide an atomic way to ensure that an item is only written or updated if a specified condition is met. For idempotent processing, a `ConditionExpression` like `attribute_not_exists(primary_key)` can be used when attempting to record a file's processing status. This prevents duplicate entries or overwrites if the record already exists, effectively making the operation idempotent at the database level without requiring a separate read operation.
- ✗
Reduce the S3 event batch size in the Lambda trigger.
Why it's wrong here
S3 event notifications invoke Lambda functions on a per-object basis, meaning each file upload or modification typically triggers a distinct Lambda invocation. The concept of "batch size" is not applicable to S3 event sources, as it is primarily used for stream-based sources like Kinesis or queue-based sources like SQS. Therefore, attempting to reduce a non-existent batch size would have no impact on preventing duplicate processing.
- ✗
Increase the Lambda function's timeout.
Why it's wrong here
Increasing the Lambda function's timeout only extends the maximum duration the function is allowed to run before being terminated. While this can prevent legitimate processing from being cut short, it does not address or mitigate the issue of duplicate invocations. A longer timeout does not prevent an upstream service from sending the same event multiple times or the Lambda service from retrying an invocation, which are common causes of duplicate processing.
- ✗
Enable S3 versioning on the bucket.
Why it's wrong here
S3 versioning is a feature designed to preserve multiple versions of an object in the same bucket, protecting against accidental deletions or overwrites. It allows for easy recovery of previous object states. However, S3 versioning does not inherently prevent or detect duplicate event notifications for the same logical object upload, nor does it provide a mechanism for a Lambda function to determine if a specific object version has already been processed.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
This DVA-C02 question is part of Courseiva's 1,135-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.