DVA-C02 Development with AWS Services Practice Question
A developer is writing an AWS Lambda function that processes messages from an Amazon SQS queue. The function should process each message at least once, but duplicates are acceptable. The function is triggered by a Lambda event source mapping. If the function returns an error, what happens to the message?
⚠ Common exam trap
Test-takers frequently assume Lambda automatically deletes failed messages or immediately sends them to a DLQ, but the actual behavior is that the message remains in the queue and becomes visible again after the visibility timeout expires, allowing for retries.
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
✓
The message remains in the queue and becomes visible after the visibility timeout expires.
When a Lambda function invoked by an SQS event source mapping returns an error, the message is not deleted from the queue. Instead, it remains in the queue and becomes visible again after the visibility timeout expires. This allows the function to retry processing the message, ensuring at-least-once processing. The default behavior is to retry based on the queue's redrive policy, not to immediately send the message to a DLQ or delete it.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The message is sent to a dead-letter queue (DLQ).
Why it's wrong here
A Dead-Letter Queue (DLQ) is an optional component for SQS queues or Lambda event source mappings, designed to capture messages that fail to be processed successfully after a specified number of retries. Without explicit configuration of a DLQ on the SQS queue's Redrive Policy or the Lambda event source mapping's OnFailure destination, messages will not automatically be routed to a DLQ upon a function's failure. Instead, they will remain in the source queue, subject to the visibility timeout and retry attempts.
- ✗
The message is deleted from the queue to prevent duplicate processing.
Why it's wrong here
Messages are only deleted from an SQS queue by the AWS Lambda service *after* the Lambda function successfully processes them and returns a successful response. When a Lambda function fails to process a message, Lambda does not issue a `DeleteMessage` API call to SQS. Consequently, the message persists in the queue, ensuring it remains available for subsequent processing attempts rather than being prematurely removed.
- ✗
Lambda automatically retries the function with a 1-minute delay.
Why it's wrong here
Lambda does not introduce an arbitrary or fixed 1-minute delay for retrying SQS messages. Instead, the retry mechanism for SQS-triggered Lambda functions is governed by the SQS queue's visibility timeout setting. When a message is consumed by Lambda, it becomes invisible, and if processing fails, it only becomes visible again for reprocessing by any consumer, including Lambda, once that visibility timeout period expires.
- ✓
The message remains in the queue and becomes visible after the visibility timeout expires.
Why this is correct
When an AWS Lambda function fails to process a message from an SQS queue, the Lambda service does not delete the message. Instead, the message remains in the SQS queue, but it stays hidden from other consumers due to the in-flight visibility timeout that was initiated when Lambda received it. Upon the expiration of this visibility timeout, the message automatically becomes visible again in the queue, making it available for another Lambda invocation attempt or consumption by another service.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
Go deeper
Related to this question
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 →
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.