AWS Certified Developer – Associate — Question 383
A company has point-of-sale devices across thousands of retail shops that synchronize sales transactions with a centralized system. The system includes an
Amazon API Gateway API that exposes an AWS Lambda function. The Lambda function processes the transactions and stores the transactions in Amazon RDS for MySQL. The number of transactions increases rapidly during the day and is near zero at night.
How can a developer increase the elasticity of the system MOST cost-effectively?
Answer options
- A. Migrate from Amazon RDS to Amazon Aurora MySQL. Use an Aurora Auto Scaling policy to scale road replicas based on CPU consumption.
- B. Migrate from Amazon RDS to Amazon Aurora MySQL. Use an Aurora Auto Scaling policy to scale read replicas based on the number of database connections.
- C. Create an Amazon Simple Queue Service (Amazon SQS) queue. Publish transactions to the queue. Set the queue to invoke the Lambda function. Turn on enhanced fanout for the Lambda function.
- D. Create an Amazon Simple Queue Service (Amazon SQS) queue. Publish transactions to the queue. Set the queue to invoke the Lambda function. Set the reserved concurrency of the Lambda function to be less than the number of database connections.
Correct answer: D
Explanation
Using an Amazon SQS queue decouples transaction ingestion from processing, which smooths out traffic spikes and protects the database from being overwhelmed. Setting the Lambda function's reserved concurrency below the database's connection limit prevents the Lambda instances from exhausting all available Amazon RDS for MySQL connections. This queuing and throttling approach is much more cost-effective than migrating to Amazon Aurora MySQL or scaling read replicas, which do not resolve write connection exhaustion.