Courseiva
Development with AWS ServiceshardMultiple SelectObjective-mapped

DVA-C02 Development with AWS Services Practice Question

A Lambda function processes messages from an SQS standard queue and writes results to DynamoDB. Duplicate writes occasionally occur after retries. Which two changes best make the processing idempotent?

⚠ Common exam trap

It's easy for candidates to confuse idempotency with simply increasing timeouts or disabling visibility timeouts, not realizing that idempotency requires a deterministic key and a conditional check at the storage layer.

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

Use a deterministic idempotency key stored with a conditional write in DynamoDB

Using a deterministic idempotency key (e.g., a business transaction ID) combined with a conditional write in DynamoDB ensures that if the same message is processed more than once, the second write attempt will fail because the item already exists. This prevents duplicate records even when Lambda retries after a failure or timeout, making the processing idempotent at the database level.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Use a deterministic idempotency key stored with a conditional write in DynamoDB

    Why this is correct

    SQS Standard queues provide at-least-once delivery, meaning messages can be delivered multiple times. Implementing idempotency is crucial to prevent duplicate processing side effects. By generating a deterministic key (e.g., from the SQS message ID or a business transaction ID) and storing it in DynamoDB with a conditional write (e.g., using `attribute_not_exists`), the Lambda function ensures that the operation only proceeds if the key hasn't been recorded before, making the operation safe for retries and preventing unintended state changes.

  • Increase the Lambda timeout to 15 minutes

    Why it's wrong here

    Increasing the Lambda function's timeout to its maximum of 15 minutes primarily addresses long-running tasks or potential execution failures due to exceeding the default timeout. While it allows more time for a single processing attempt, it does not inherently prevent duplicate processing of messages from an SQS Standard queue. If a message is delivered multiple times due to SQS's at-least-once delivery guarantee, a longer timeout will not stop the function from processing the same message again if it's invoked for it.

  • Treat the SQS message ID or business transaction ID as a processed-record key

    Why this is correct

    To achieve idempotency when processing SQS Standard messages, it's essential to identify each unique processing attempt. Using the SQS message ID provides a unique identifier for each message delivery, while a business transaction ID offers a stable identifier for the underlying business operation. Either can serve as a processed-record key in a persistent store (like DynamoDB) to check if a specific message or transaction has already been successfully processed, thus preventing redundant execution of the core business logic.

  • Disable SQS visibility timeout

    Why it's wrong here

    Disabling the SQS visibility timeout would immediately make a message visible to other consumers after it's received, even if the current consumer hasn't finished processing it. This would drastically *increase* the likelihood of duplicate processing by multiple consumers concurrently, or by the same consumer if it fails and retries, rather than preventing it. The visibility timeout is specifically designed to *reduce* duplicate processing by hiding a message during its processing window.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

This DVA-C02 question is part of Courseiva's 724-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 →

How Courseiva writes practice questions · Editorial policy

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.