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

Question #1247

A company's application receives real-time telemetry data from a network of sensors, which is stored in an Amazon RDS PostgreSQL database. The data ingestion rate varies, causing the database to struggle with write operations during peak periods, leading to application errors. A solutions architect needs to reduce the number of database connections and ensure no data loss during traffic spikes.

Which solution meets these requirements?

A

Upgrade the RDS instance to a larger instance class with higher memory and CPU.

B

Convert the RDS database to a Multi-AZ deployment and configure the application to write to both primary and standby instances.

C

Modify the application to send data to an Amazon SQS queue. Use an AWS Lambda function triggered by the queue to write data to the database.

D

Modify the application to publish data to an Amazon SNS topic. Use an AWS Lambda function subscribed to the topic to write data to the database.

Explanation

The correct answer is C. Here's why:

- Option C: Using Amazon SQS decouples the application from the database. Sensors send data to SQS, which acts as a buffer during traffic spikes. AWS Lambda processes messages from SQS at a controlled rate, reducing concurrent database connections and preventing overload. SQS ensures durability, so no data is lost even if Lambda throttles.

- Option A: Upgrading the RDS instance temporarily increases capacity but does not address connection limits or data loss risks during spikes. It is not scalable or cost-effective.
- Option B: Multi-AZ improves availability but does not distribute write load. Writing to both instances increases complexity and does not reduce connections.
- Option D: SNS does not buffer messages. If Lambda cannot process messages quickly, data may be lost, violating the no-data-loss requirement.

Key Points: Use SQS to decouple components and handle spikes. Lambda enables serverless, scalable processing. SQS ensures message durability, while SNS lacks buffering.

Answer

The correct answer is: C