AWS Certified Solutions Architect - Associate / Question #1106 of 1019

Question #1106

A company uses AWS Lambda functions triggered by Amazon API Gateway to process orders and store them in an Amazon Aurora PostgreSQL database. During scheduled database maintenance periods, the Lambda functions experience connection timeouts, resulting in lost order data. A solutions architect needs to ensure that all orders are processed even when the database is undergoing maintenance.

Which solution meets these requirements?

A

Provision an Amazon RDS proxy to manage database connections. Configure the Lambda functions to connect to the RDS proxy.

B

Increase the Lambda functions' timeout setting to the maximum. Implement exponential backoff retry logic in the code to retry database writes.

C

Store the order data temporarily in Lambda ephemeral storage. Use a secondary Lambda function to process the stored data once the database is available.

D

Write the order data to an Amazon Simple Queue Service (Amazon SQS) standard queue. Deploy a separate Lambda function to consume messages from the queue and persist the data to the database.

Explanation

Answer D is correct because:
- Durability: Amazon SQS stores messages reliably, preventing data loss even if the database is unavailable.
- Decoupling: Orders are queued during maintenance, and a separate Lambda function processes them once the database is back online.
- Resilience: Avoids dependency on database uptime, unlike RDS Proxy (A) or retries (B), which fail if the database is unreachable.
- Ephemeral Storage Limitation: Option C uses Lambda's temporary storage, which is not persistent across invocations or during failures.

Key Points:
- Use queuing (SQS) for asynchronous, fault-tolerant processing.
- Decouple components to handle temporary outages.
- Avoid relying on direct database availability for critical writes.

Answer

The correct answer is: D