DVA-C02 Development with AWS Services Practice Question
A developer is designing a serverless application using AWS Lambda. The function needs to process messages from an Amazon SQS queue. The developer wants to configure the Lambda function to be triggered by the SQS queue. Which TWO actions are required? (Choose TWO.)
⚠ Common exam trap
Candidates often confuse the integration pattern of SQS with push-based services like S3 or SNS. For S3 or SNS, you must configure a resource-based policy on the Lambda function to allow the service to invoke it. For SQS, Lambda uses an Event Source Mapping (polling model) where the Lambda service polls SQS using the Lambda function's execution role, meaning no resource-based policies are needed on either side.
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
✓
Attach an IAM execution role to Lambda with permission to receive messages from SQS.
Option A is correct because the Lambda function's IAM execution role must grant permissions such as sqs:ReceiveMessage, sqs:DeleteMessage, and sqs:GetQueueAttributes so the service can poll and consume messages from the SQS queue on the function's behalf. Option C is correct because SQS is a pull-based source, so you must create an event source mapping that tells the Lambda service to poll the queue, batch records, and invoke the function with those messages. Option B is not required because SQS integration uses the execution role for polling rather than a resource-based policy invoking Lambda directly, as would be the case for push-based sources like S3 or SNS. Option D is not required, though a dead-letter queue or Lambda destinations can optionally handle failed messages. Option E is not required because Lambda can reach SQS over the AWS network without being placed in a VPC.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Attach an IAM execution role to Lambda with permission to receive messages from SQS.
Why this is correct
The Lambda function's IAM execution role must include permissions such as sqs:ReceiveMessage, sqs:DeleteMessage, and sqs:GetQueueAttributes. These permissions are essential for the Lambda service, acting on behalf of the function, to successfully poll the SQS queue, retrieve messages, and then delete them after successful processing. Without these explicit permissions, the Lambda function would be unable to interact with the SQS queue as an event source, preventing message consumption.
- ✗
Configure a resource-based policy on the SQS queue to allow Lambda invocation.
Why it's wrong here
Configuring a resource-based policy on the SQS queue is not the primary mechanism for allowing Lambda to process messages. The Lambda service, specifically the event source mapping component, polls the SQS queue using the permissions granted to the Lambda function's execution role. SQS does not 'invoke' Lambda; rather, Lambda actively pulls messages, making a resource policy on SQS for 'invocation' irrelevant in this context.
- ✓
Create an event source mapping in Lambda to poll the SQS queue.
Why this is correct
An event source mapping is the essential configuration that connects an SQS queue to a Lambda function, enabling the Lambda service to automatically poll the queue for messages. This mapping specifies the queue to monitor, batching parameters, and concurrency settings, effectively acting as the trigger mechanism. It ensures that messages arriving in the SQS queue are delivered to the Lambda function for processing without requiring custom polling logic within the function itself.
- ✗
Set up a dead-letter queue for failed messages.
Why it's wrong here
While setting up a dead-letter queue (DLQ) is a crucial best practice for handling message processing failures and preventing data loss, it is not a mandatory step for the initial design or functionality of a serverless application. A Lambda function can successfully process messages from an SQS queue without a DLQ configured. Its absence only impacts error handling robustness, not the fundamental ability to receive and process messages.
- ✗
Place the Lambda function in a VPC to access the SQS queue.
Why it's wrong here
Placing a Lambda function within a Virtual Private Cloud (VPC) is unnecessary for accessing SQS, as Amazon SQS is a fully managed public AWS service accessible over the internet via its public endpoints. Lambda functions are typically deployed in AWS's default VPC or a managed environment and can access public AWS services directly. VPC configuration for Lambda is only required when the function needs to access private resources within a specific VPC, such as databases or internal services.
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
Courseiva writes every DVA-C02 question from scratch — 1,135 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.