AWS Certified Solutions Architect - Professional / Question #909 of 529

Question #909

A company uses an Amazon API Gateway HTTP API to collect sensor data from IoT devices. The API is integrated with an AWS Lambda function that processes the data by sending it to a legacy on-premises system via a VPN connection. The legacy system frequently becomes unavailable, causing the Lambda function to fail and data to be lost.

A solutions architect needs to redesign the solution to ensure no data is lost and that processing can resume once the legacy system is available again. The solution must minimize changes to the existing architecture.

What should the solutions architect do to meet these requirements?

A

Create an Amazon Simple Queue Service (Amazon SQS) queue. Configure the queue as a dead-letter queue for the Lambda function.

B

Create two Amazon Simple Queue Service (Amazon SQS) queues: a main queue and a dead-letter queue. Update the API integration to send data directly to the main queue. Configure the Lambda function to consume messages from the main queue with retries, and route failed messages to the dead-letter queue.

C

Create an Amazon EventBridge event bus with a rule to archive all events. Update the API to send data to the event bus. Configure the Lambda function to process events from the archive when the legacy system recovers.

D

Create an Amazon Kinesis Data Firehose delivery stream. Update the API integration to send data to Kinesis Firehose. Configure Firehose to retry failed deliveries to the Lambda function indefinitely.

Explanation

Option B is correct because:
- Decoupling: SQS queues separate API Gateway from Lambda, ensuring data persistence even if the legacy system fails.
- Retries & DLQ: Lambda processes messages from the main queue with retries. Failed messages move to the DLQ after retries, ensuring no data loss.
- Minimal Changes: Only requires updating the API integration to SQS and configuring Lambda to poll the queue.

Other options:
- A: DLQ alone doesn't capture initial API requests; Lambda failures before queuing lose data.
- C: EventBridge archiving requires manual intervention to replay events, adding complexity.
- D: Kinesis Firehose focuses on delivery to storage, not queuing for processing retries.

Key Points: Use SQS for decoupling and persistence. Configure retries and DLQ for fault tolerance. Minimize changes by leveraging existing services.

Answer

The correct answer is: B