AWS Certified Solutions Architect - Professional / Question #577 of 529

Question #577

A solutions architect has developed a web application that uses an Amazon API Gateway Regional endpoint and an AWS Lambda function. The consumers of the web application are all located near the AWS Region where the application is deployed. The Lambda function exclusively reads from an Amazon Aurora PostgreSQL database configured with three read replicas. During performance testing, the application experiences degraded performance due to a surge in database connections under high load. The solutions architect must optimize the application's efficiency.

Which two actions should the solutions architect take to address this issue? (Choose two.)

A

Use the writer endpoint of the Aurora database.

B

Use RDS Proxy to manage a connection pool for the reader endpoint.

C

Change the API Gateway endpoint to an edge-optimized endpoint.

D

Move the database connection initialization code outside the Lambda event handler.

E

Enable Lambda Provisioned Concurrency.

Explanation

Answer B (RDS Proxy) and D (connection initialization outside handler) are correct because:
- B: RDS Proxy manages a connection pool, reducing the number of open database connections by reusing them across Lambda invocations. This directly addresses connection surges under high load.
- D: Initializing the database connection outside the Lambda handler allows the connection to persist across invocations (via execution context reuse), reducing the need to establish new connections repeatedly.

Other options:
- A: Using the writer endpoint is irrelevant since the Lambda only reads from read replicas.
- C: Edge-optimized API Gateway endpoints reduce latency for global users but do not resolve database connection issues.
- E: Provisioned Concurrency reduces cold starts but does not directly manage database connections.

Key Points:
1. RDS Proxy manages connection pooling, crucial for scaling read-heavy workloads.
2. Lambda execution context reuse optimizes resource utilization, including database connections.
3. Avoid unnecessary database connections by reusing them where possible.

Answer

The correct answer is: BD