Q42 — AWS DVA-C02 Ch.3
Question 42 of 100 | ← Chapter 3
A developer is creating an application deployed on internet-connected devices. The application sends data to a RESTful API hosted as an AWS Lambda function. The application assigns a unique identifier to each API request. The volume of API requests from the application may spike randomly at any time during the day. During rate limiting, the application may need to retry requests. The API must handle duplicate requests without causing inconsistency or data loss.
- A. Create an Amazon RDS for MySQL database instance. Store each request’s unique identifier in a database table. Modify the Lambda function to check the table for the identifier before processing the request.
- B. Create an Amazon DynamoDB table. Store each request’s unique identifier in the table. Modify the Lambda function to check the table for the identifier before processing the request. ✓
- C. Create an Amazon DynamoDB table. Store each request’s unique identifier in the table. Modify the Lambda function to return a client error response when it receives a duplicate request.
- D. Create an Amazon ElastiCache for Memcached cluster. Store each request’s unique identifier in the cache. Modify the Lambda function to check the cache for the identifier before processing the request.
Correct Answer: B. Create an Amazon DynamoDB table. Store each request’s unique identifier in the table. Modify the Lambda function to check the table for the identifier before processing the request.
Explanation
Option B is the best choice. Amazon DynamoDB is a highly scalable and reliable NoSQL database service ideal for rapidly storing and checking high-volume, unique request identifiers from IoT devices. It supports atomic operations, ensuring consistency under high concurrency when multiple Lambda instances simultaneously check and update the table. Modifying the Lambda function to check the DynamoDB table before processing ensures idempotent handling of duplicate requests. Option A (Amazon RDS for MySQL) lacks the serverless scalability and automatic scaling advantages of DynamoDB and requires more operational overhead. Option C’s client-error response on duplicates may trigger unnecessary retries and increase system load. Option D (ElastiCache for Memcached) lacks durability and persistence guarantees needed for reliable deduplication across failures or cache evictions.