DVA-C02 exam dumps

DVA-C02 practice question 386 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 386

Single answer

You are developing a serverless application on AWS and need to process messages from an SQS queue. Each message contains a JSON payload that triggers a computation-intensive function. You want to ensure that the function processes messages in parallel while maintaining cost efficiency and avoiding message duplication. Which solution would best meet these requirements?

  1. A

    Use an EC2 instance to poll the SQS queue and process messages sequentially within the instance.

  2. B

    Configure an Amazon Lambda function to trigger directly from the SQS queue and process messages in parallel.

  3. C

    Use an Amazon ECS cluster to poll the SQS queue and scale out based on the number of messages in the queue.

  4. D

    Configure an Amazon Lambda function to trigger directly from the SQS queue and use FIFO queues to ensure parallel processing without duplication.

Show answer and explanation

Correct answer: B

Explanation

Amazon Lambda integrates natively with SQS and can scale automatically to process messages in parallel, making it the most cost-efficient and simple solution for this scenario. Using Lambda avoids the need to manage infrastructure like EC2 or ECS and ensures that messages are not processed more than once through its built-in at-least-once delivery mechanism. While FIFO queues ensure order, they limit concurrency and are unnecessary unless strict ordering is required, which is not mentioned in this scenario.

  • A. Incorrect.

    Using an EC2 instance to poll the SQS queue and process messages sequentially is not cost-efficient, as the EC2 instance would be running continuously, and it does not allow for parallel processing.

  • B. Correct.

    Configuring an Amazon Lambda function to trigger directly from the SQS queue is the optimal solution. Lambda provides automatic scaling, processes messages concurrently, and integrates natively with SQS to avoid message duplication.

  • C. Incorrect.

    Using an Amazon ECS cluster can process messages in parallel, but it involves more complexity in managing and scaling ECS tasks, which is not as efficient as using Lambda for serverless processing.

  • D. Incorrect.

    Configuring an Amazon Lambda function with a FIFO queue ensures message order but does not inherently prevent duplication. FIFO queues also limit concurrency, which can restrict parallel processing.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam