A logistics company is modernizing its package tracking update microservice by refactoring it to a serverless architecture. The new design uses Amazon API Gateway and AWS Lambda to write tracking updates to a shared Amazon Aurora PostgreSQL database that serves multiple other critical company applications. During load testing, the backend database experiences connection exhaustion, and the API Gateway begins returning 429 Too Many Requests errors because the tracking function consumes the entire regional Lambda execution limit, impacting other serverless applications. Which of the following architectural modifications best resolves both the database connection exhaustion and the regional Lambda execution throttling?
- Implement Amazon RDS Proxy between the Lambda function and the Aurora PostgreSQL database, and configure a reserved concurrency limit on the tracking Lambda function.Answer
- BEnable Provisioned Concurrency on the tracking Lambda function to handle the sudden burst of incoming requests, and directly scale the Aurora PostgreSQL database instance size.
- CImplement Amazon RDS Proxy between the Lambda function and the Aurora PostgreSQL database, and route all outbound Lambda traffic to the VPC through a single NAT Gateway.
- DDeploy Amazon RDS Proxy, store the database credentials in AWS Secrets Manager, and encrypt them with the AWS-managed KMS key (aws/secretsmanager) to delegate access to the Lambda function in a separate AWS account.
Answer
Implement Amazon RDS Proxy between the AWS Lambda function and the Amazon Aurora PostgreSQL database to manage the connection pool, and configure a reserved concurrency limit on the high-volume Lambda function to prevent it from exhausting both database connections and the regional account execution pool.
The correct architecture uses Amazon RDS Proxy to pool database connections, which addresses the connection exhaustion issue on Amazon Aurora PostgreSQL. Additionally, configuring reserved concurrency on the tracking Lambda function sets a hard limit on its concurrent executions. This ensures it does not scale out to consume the entire regional concurrency pool, resolving the throttling issue for other serverless applications in the account.
Step-by-Step Solution
Key Concept
Using Amazon RDS Proxy for connection pooling and AWS Lambda reserved concurrency to limit scaling limits in serverless architectures.
Estimated Time:1m 30s