While preparing for the AWS SAP-C02, many candidates get confused by Lambda cost optimization tooling. In the real world, this is fundamentally a decision about Build vs. Buy with Time-to-Value constraints. Let’s drill into a simulated scenario.
The Scenario #
HealthMetrics Analytics operates a serverless patient dashboard delivered via CloudFront and S3. The application backend consists of 47 Lambda functions triggered through API Gateway REST APIs, handling everything from patient vitals aggregation to insurance claim validation.
After three months in production, the VP of Engineering mandates a bi-weekly FinOps discipline: generate CSV reports showing each Lambda function’s recommended memory configuration, projected cost savings, and delta between current vs. optimized settings. These reports must be automatically stored in an S3 bucket for downstream consumption by the finance team’s Tableau dashboards.
The constraint? The infrastructure team has only 8 engineering hours allocated for this initiative before pivoting to HIPAA compliance work.
Key Requirements #
Implement an automated solution that:
- Generates CSV reports every 14 days
- Includes recommended memory, cost projections, and savings delta per Lambda function
- Stores output in S3
- Minimizes custom code development
The Options #
-
A) Build a custom Lambda function to query CloudWatch Logs, extract the past two weeks of metrics for each API-backing Lambda function, transform the data into tabular format, and write CSV files to S3. Schedule execution via EventBridge rule (bi-weekly cron).
-
B) Enable AWS Compute Optimizer. Create a Lambda function that invokes the
ExportLambdaFunctionRecommendationsAPI operation to export CSV files directly to S3. Schedule this orchestrator function via EventBridge rule (bi-weekly cron). -
C) Enable AWS Compute Optimizer with Enhanced Infrastructure Metrics. Use the Compute Optimizer console to schedule a recurring export job that writes Lambda recommendations as CSV to S3 every two weeks.
-
D) Purchase AWS Business Support plan for the production account. Enable AWS Compute Optimizer integration for Trusted Advisor checks. Use the Trusted Advisor console to schedule bi-weekly exports of cost optimization check results as CSV files to S3.
Correct Answer #
Option B.
Quick Insight: The FinOps Imperative #
This scenario tests your understanding of AWS-native cost optimization tooling maturity. While CloudWatch contains raw invocation data, AWS Compute Optimizer already performs ML-driven analysis of Lambda utilization patterns and generates rightsizing recommendations. The Professional-level insight is recognizing when NOT to reinvent analytics wheels—API-driven consumption of managed intelligence services delivers faster ROI than custom metric aggregation pipelines. –>
💎 The Architect’s Deep Dive: Why Options Fail #
Correct Answer #
Option B — Enable AWS Compute Optimizer and invoke ExportLambdaFunctionRecommendations API via scheduled Lambda function.
Step-by-Step Winning Logic #
This solution delivers maximum leverage with minimum custom engineering:
-
AWS Compute Optimizer is a managed service that continuously analyzes Lambda function invocation patterns, memory utilization, and duration metrics across up to 14 days of historical data.
-
Zero Analytics Engineering Required: The service already generates the exact outputs specified—recommended memory, cost projections, and savings calculations. You’re consuming pre-built ML models rather than building metric aggregation logic.
-
API-Driven Automation: The
ExportLambdaFunctionRecommendationsoperation is purpose-built for programmatic export, returning CSV files directly to S3. The orchestrator Lambda function is ~30 lines of code. -
EventBridge Native Scheduling: A simple cron expression (
cron(0 8 1,15 * ? *)) handles bi-weekly execution without additional scheduling infrastructure. -
Development Time Reality Check: Option B consumes ~2 hours (enable service, write Lambda, configure EventBridge). This leaves 6 hours for testing and documentation—well within the 8-hour constraint.
The Traps (Distractor Analysis) #
-
Why not Option A?
- Reinventing the wheel at 10x cost: Building custom CloudWatch Logs parsing, metric aggregation, cost calculation algorithms, and CSV generation would consume 40+ engineering hours, not 8.
- Data Accuracy Risk: CloudWatch Logs contain invocation records but lack the ML-driven rightsizing intelligence that Compute Optimizer provides based on memory utilization patterns.
- Ongoing Maintenance Burden: Lambda pricing changes quarterly; your custom cost calculator becomes a liability requiring updates.
-
Why not Option C?
- Console-Based Scheduling Doesn’t Exist: As of 2025, AWS Compute Optimizer’s console allows on-demand manual exports but does not support automated recurring schedules. This option describes non-existent functionality—a classic SAP-C02 distractor testing whether you’ve actually used the service.
- Enhanced Infrastructure Metrics (3-month lookback) is overkill for a 14-day requirement and adds unnecessary cost.
-
Why not Option D?
- Over-Engineering with Financial Impact: AWS Business Support costs ≥$100/month (3% of monthly AWS spend, $100 minimum). For an isolated reporting requirement, this is a $1,200/year recurring cost versus Option B’s negligible API call fees.
- Trusted Advisor Integration Confusion: While Trusted Advisor does offer cost optimization checks, it does not provide per-Lambda granular recommendations with memory/cost deltas—it surfaces high-level patterns. The integration mentioned doesn’t produce the CSV format specified.
- Wrong Tool for the Job: Trusted Advisor is designed for broad account hygiene, not granular Lambda FinOps analytics.
The Architect Blueprint #
graph TD
EB[EventBridge Rule
cron: 0 8 1,15 * ? *] -->|Triggers bi-weekly| LF[Orchestrator Lambda]
LF -->|Invokes API| CO[AWS Compute Optimizer
ExportLambdaFunctionRecommendations]
CO -->|Analyzes| L1[Lambda Fn 1
Patient Vitals API]
CO -->|Analyzes| L2[Lambda Fn 2
Claims Validation]
CO -->|Analyzes| L3[Lambda Fn 3-47...]
CO -->|Writes CSV| S3[S3 Bucket
finops-reports/lambda/]
S3 -->|Consumed by| TB[Tableau Dashboard
Finance Team]
style CO fill:#FF9900,stroke:#232F3E,color:#fff
style LF fill:#FF9900,stroke:#232F3E,color:#fff
style S3 fill:#569A31,stroke:#232F3E,color:#fff
Diagram Note: EventBridge triggers the orchestrator Lambda on the 1st and 15th of each month; the orchestrator invokes Compute Optimizer’s export API, which analyzes all 47 Lambda functions and writes structured CSV recommendations directly to S3 for downstream consumption.
The Decision Matrix #
| Option | Est. Complexity | Est. Monthly Cost | Pros | Cons |
|---|---|---|---|---|
| A - Custom CloudWatch Parser | Very High (40+ dev hours) |
Low ($15) - Lambda: $5 - CloudWatch Logs Insights queries: $10 |
- Full customization control - No new service dependencies |
- Massive development time (5x over budget) - Ongoing maintenance burden - Lacks ML-driven recommendations - Cost calculation logic requires quarterly updates |
| B - Compute Optimizer API ✅ | Very Low (2 dev hours) |
Negligible ($2) - Compute Optimizer: Free tier - Lambda orchestrator: $0.20 - API calls: $1.80 |
- 8-hour time constraint met - AWS-managed ML analytics - Purpose-built CSV export - Auto-updated pricing logic |
- Requires opt-in to Compute Optimizer - 14-day minimum analysis window (not configurable) |
| C - Console Scheduling | N/A | N/A | - (Hypothetically simple) | - Feature doesn’t exist - Console exports are manual-only - Enhanced metrics add unnecessary cost ($5/function/month) |
| D - Business Support + Trusted Advisor | Low (4 dev hours) |
High ($100+) - Business Support: $100-$10,000/mo - Lambda: $0.20 |
- Broad account health insights - Access to AWS support engineers |
- $1,200+/year recurring cost - Trusted Advisor lacks per-Lambda granularity - Wrong tool for granular FinOps - Doesn’t generate specified CSV format |
FinOps Quantification: Option B delivers 98% development time savings (2 hrs vs. 40 hrs) and 87% lower TCO over 12 months ($24 vs. $1,200+) compared to alternatives.
Real-World Practitioner Insight #
Exam Rule #
For SAP-C02: When you see “recommendations,” “cost optimization,” and “Lambda” together, AWS Compute Optimizer is the first tool to evaluate. If the question mentions “minimal development” or “shortest implementation time,” prefer managed service APIs over custom CloudWatch/Logs solutions.
Real World #
In production environments, we’d extend Option B with:
- SNS Notifications: Trigger alerts when savings opportunities exceed $500/month to prioritize engineering remediation.
- Automated Remediation Pipeline: For non-production environments, auto-apply Compute Optimizer recommendations using Step Functions + Lambda update-function-configuration API calls.
- Multi-Account Aggregation: Use AWS Organizations integration to generate consolidated reports across dev/staging/prod accounts.
- Cost Anomaly Detection: Combine Compute Optimizer exports with AWS Cost Anomaly Detection to correlate rightsizing opportunities with unexpected spend spikes.
- Governance Guardrails: Implement Service Control Policies (SCPs) preventing developers from deploying Lambda functions with >3GB memory without architecture review—preempting over-provisioning.
The Hidden Constraint Not in Exams: Compute Optimizer recommendations assume consistent workload patterns. For highly variable workloads (e.g., month-end batch processing), you’d supplement with custom CloudWatch analysis of p99 memory utilization during peak periods before applying recommendations.