Q98 — AWS SAA-C03 Ch.16
Question 98 of 100 | ← Chapter 16
Q1298. A company runs a serverless application on AWS. The application consists of multiple AWS Lambda functions, Amazon API Gateway REST APIs, and other resources. The application experiences varying levels of traffic throughout each day. Peak usage occurs during business hours. The company wants to optimize costs for the application while maintaining high performance.Which solution will meet these requirements?
- A. Use AWS Compute Optimizer recommendations to optimize memory settings. Use AWS Cost Explorer to monitor and optimize costs.
- B. Use AWS Auto Scaling for the Lambda functions. Deploy the application on AWS Fargate. Use AWS Budgets to monitor costs.
- C. Use provisioned concurrency for the Lambda functions. Use AWS Compute Optimizer recommendations to optimize memory settings. Use AWS Cost Explorer to monitor costs. ✓
- D. Use AWS X-Ray to identify performance bottlenecks. Troubleshoot requests that result in an error.Deploy the application on AWS Fargate. Use AWS Cost Explorer to monitor costs.
Correct Answer: C. Use provisioned concurrency for the Lambda functions. Use AWS Compute Optimizer recommendations to optimize memory settings. Use AWS Cost Explorer to monitor costs.
Explanation
For a serverless application on AWS with fluctuating traffic (peaking during business hours), the goal is to optimize costs while maintaining high performance. The best solution is Option C: Use provisioned concurrency for Lambda functions, leverage AWS Compute Optimizer for memory tuning, and monitor costs with AWS Cost Explorer. Here's why:Why Option C is OptimalProvisioned Concurrency for LambdaEliminates cold starts: By pre-initializing Lambda instances during peak hours (e.g., 9 AM? PM), it ensures sub-100ms latency even under sudden traffic spikes.Cost-effective for predictable peaks: Unlike always-on solutions (e.g., Fargate), you pay only for the pre- warmed instances, avoiding over-provisioning.Example: A retail app using provisioned concurrency reduced P99 latency by 90% during sales events without increasing costs.AWS Compute Optimizer for Memory TuningRight-sizes Lambda memory: Analyzes historical performance to recommend optimal memory (e.g., 1,792MB instead of 128MB), which linearly scales CPU allocation. Balances cost/performance: A 3x memory increase might reduce execution time by 5x, lowering total cost (e.g.,0.00001667per100msvs.0.00000417 for a faster function).Automated recommendations: Reduces manual trial-and-error tuning.AWS Cost Explorer for MonitoringTracks Lambda spend by function: Identifies top cost drivers (e.g., a poorly optimized API handler consuming 40% of the budget).Sets budget alerts: Notifies you when spending exceeds thresholds (e.g., 0.04048 per vCPU/ hour vs. Lambda's pay-per-use model).Option D:AWS X-Ray is reactive, not proactive--it identifies bottlenecks after they occur but doesn't prevent cold starts.Fargate is overkill for a serverless app, requiring container management and higher operational overhead.Implementation StepsSet up provisioned concurrency:Use AWS Lambda Console or CLI to configure concurrency levels (e.g., 500 instances for a high-traffic API during business hours).Schedule activation/deactivation via CloudWatch Events (e.g., turn on at 8 AM, off at 8 PM).Apply Compute Optimizer recommendations:Navigate to Compute Optimizer > Lambda recommendations and adjust memory settings for top-cost functions.Validate with load testing (e.g., using AWS Lambda Power Tuning tool).Monitor with Cost Explorer:Create a Cost & Usage Report filtered by Lambda service and function name. Set up a budget alert for 80% of your daily peak spend threshold.Expected OutcomesPerformance: Sub-200ms P99 latency during peaks (vs. 2?s without provisioned concurrency). Cost: 20?0% lower Lambda spend due to optimized memory and reduced wasted invocations (from throttling).Scalability: Handles 10x traffic surges without manual intervention. This approach directly addresses the core challenge of balancing cost and performance in serverless architectures with variable workloads.