AWS Certified Developer – Associate / Question #654 of 557

Question #654

A developer has built an application that ingests sensor data into Amazon S3 buckets as JSON files. An AWS Lambda function processes the data and writes it directly to an Amazon DynamoDB table. During peak traffic periods, the DynamoDB table experiences throttling due to excessive write requests, causing delays in data ingestion.

The developer needs to redesign the architecture to mitigate throttling and ensure consistent data ingestion into DynamoDB.

Which solution will address these requirements?

A

Split the Lambda function into two separate functions. Use the first function to process the data and publish messages to an Amazon Simple Queue Service (SQS) queue. Configure the second function to consume messages from the queue and write the data to DynamoDB.

B

Enable DynamoDB auto scaling with target utilization metrics in Amazon CloudWatch to dynamically adjust the table's write capacity units based on demand.

C

Modify the Lambda function to use reserved concurrency and configure an alias with provisioned concurrency to handle traffic spikes more efficiently.

D

Create two Lambda functions. Configure the first function to write raw data to DynamoDB and the second function to process the data afterward. Use DynamoDB streams to trigger the second function upon new item insertion.

Explanation

The correct answer is A. Splitting the Lambda function and using SQS decouples the processing and writing steps. The first Lambda processes data and sends messages to SQS, which acts as a buffer. The second Lambda consumes messages at a rate DynamoDB can handle, preventing throttling.

Why other options are incorrect:
- B: DynamoDB auto scaling may not react quickly enough during sudden spikes, leading to throttling.
- C: Adjusting Lambda concurrency does not address DynamoDB's write capacity limitations.
- D: Writing raw data directly to DynamoDB first does not resolve the throttling issue.

Key Points: Use SQS to buffer writes and control the rate of DynamoDB operations during traffic spikes. Decoupling components helps manage throughput and avoid throttling.

Answer

The correct answer is: A