
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
A company has an API that receives real-time data from a fleet of monitoring devices. The API stores this data in an Amazon RDS DB instance for later analysis. The amount of data that the monitoring devices send to the API fluctuates. During periods of heavy traffic, the API often returns timeout errors.
After an inspection of the logs, the company determines that the database is not capable of processing the volume of write traffic that comes from the API. A solutions architect must minimize the number of connections to the database and must ensure that data is not lost during periods of heavy traffic.
Which solution will meet these requirements?
A
Increase the size of the DB instance to an instance type that has more available memory.
B
Modify the DB instance to be a Multi-AZ DB instance. Configure the application to write to all active RDS DB instances.
C
Modify the API to write incoming data to an Amazon Simple Queue Service (Amazon SQS) queue. Use an AWS Lambda function that Amazon SQS invokes to write data from the queue to the database.
D
Modify the API to write incoming data to an Amazon Simple Notification Service (Amazon SNS) topic. Use an AWS Lambda function that Amazon SNS invokes to write data from the topic to the database.
Explanation:
Option C is the correct solution because it addresses both requirements:
Minimizes connections to the database: Instead of having multiple API instances directly connecting to the RDS database, the API writes to an SQS queue. The Lambda function (which can scale automatically) reads from the queue and writes to the database, effectively decoupling the API from the database and reducing direct database connections.
Ensures data is not lost during heavy traffic: SQS provides durable message storage with high availability. During peak traffic, messages are queued in SQS and processed asynchronously by Lambda, preventing data loss even when the database cannot keep up with the write volume.
Why other options are incorrect:
Option A: Simply increasing instance size doesn't minimize database connections and may not solve the fundamental problem of connection management during traffic spikes.
Option B: Multi-AZ provides high availability but doesn't address the connection minimization requirement. Writing to all active instances would actually increase connections and doesn't solve the write traffic volume issue.
Option D: While SNS can decouple components, it's a pub/sub service that doesn't provide the same buffering and durability guarantees as SQS. Messages could be lost if Lambda functions can't keep up, whereas SQS queues messages until they're processed.
Key AWS services used:
This architecture pattern is a classic example of using a message queue as a buffer between producers (API) and consumers (database writers) to handle traffic spikes and decouple system components.