Lambda Cost Optimizer
What this skill does
Translates a Lambda function's runtime posture into a concrete cost-
optimization recommendation with a dollar-denominated savings estimate.
The verdict is the highest-leverage action across six dimensions — memory,
provisioned concurrency, duration, invocation frequency, architecture, and
workload placement — applied in priority order. Always pairs the
recommendation with exact CLI commands (or Power Tuning invocation).
Quick navigation
| Section |
What it covers |
When to jump here |
| Quick start |
Four headline rules and the cost formula |
First read |
| Mindset |
Why memory tuning is the #1 lever |
Understanding the approach |
| Quick reference — verdict thresholds |
Decision matrix at a glance |
Classifying a function |
| Pre-flight data gate |
CloudWatch metrics, Compute Optimizer |
Before any recommendation |
| Step 0 non-obvious behaviours |
CPU-memory coupling, SnapStart, ESM, ARM64 |
Edge cases |
| Step 1 Memory configuration |
Power Tuning, optimal-memory math |
The headline savings dimension |
| Step 2 Provisioned concurrency |
On-demand vs provisioned break-even |
Latency-sensitive APIs |
| Step 3 Duration optimization |
Cold start, init, connection reuse |
Slow functions |
| Step 4 Invocation frequency |
Batch size, batch window, long polling |
High-volume consumers |
| Step 5 Architecture / placement |
ARM64, Layers, Fargate, Step Functions |
Cross-cutting savings |
| Step 6 Impact estimation |
The cost formula and worked math |
Every recommendation |
| Output format |
VERDICT block + worked examples |
Emitting the result |
| Anti-Patterns — NEVER |
Common misclassifications |
Self-check before emit |
| Pre-flight safety checks |
CONFIRM gate, version publish, alias |
Before any apply CLI |
Quick start
- Memory is the #1 lever. Lambda couples vCPU to memory (1769 MB =
1 vCPU). More memory can REDUCE total cost when faster execution
offsets the higher per-GB-second rate. Classic example: 128 MB at 5 s
costs $0.000000835/invocation; 512 MB at 1 s costs $0.000000667 — 33%
CHEAPER at the higher memory. Always run Power Tuning before assuming
128 MB is cheapest.
- Cost formula (memorise this):
cost = (invocations × duration_s × memory_GB × $0.0000166667) + (invocations × $0.0000002)
- Provisioned concurrency pays for idle. Use it ONLY for steady-
traffic, latency-sensitive APIs where cold starts hurt. For batch,
event-driven, or sporadic workloads, on-demand is cheaper.
- Architecture is a free 20%. ARM64 (Graviton2) is ~20% cheaper than
x86_64 for supported runtimes. Check the runtime support matrix and
migrate when possible.
Mindset
Lambda cost optimization is a price-performance decision, not a pure
utilization exercise. The goal is the memory/concurrency/architecture
configuration that minimizes dollar cost while preserving latency and
error-rate SLOs — not the absolute minimum memory that runs the code.
Four-principle deep dive moved to references/advanced-patterns.md —
see "Mindset — four principles".
Quick reference — verdict thresholds
| Observation (14-30 day window) |
Verdict |
Recommendation |
| Memory tuning U-curve minimum differs from current MemorySize by ≥ 1 step AND projected compute saving > 0 |
OPPORTUNITY_FOUND (memory) |
Step 1 — set MemorySize to Power Tuning optimum |
| Provisioned concurrency configured AND ConcurrentExecutions sustained < 30% of provisioned |
OPPORTUNITY_FOUND (concurrency) |
Step 2 — reduce or remove provisioned concurrency |
| No provisioned concurrency AND latency-sensitive API AND cold-start p95 > 1 s AND steady traffic |
OPPORTUNITY_FOUND (concurrency — add) |
Step 2 — add provisioned concurrency sized to baseline |
| Duration p95 > 2× the runtime's healthy baseline OR cold-start duration > 3 s on Java without SnapStart |
OPPORTUNITY_FOUND (duration) |
Step 3 — SnapStart, lazy init, connection reuse, package trim |
| Event source mapping batch size = 1 on SQS/Kinesis/DynamoDB Streams with high message arrival rate |
OPPORTUNITY_FOUND (invocation frequency) |
Step 4 — tune batch size + batch window |
| Architecture = x86_64 AND runtime is ARM-compatible (Node/Python/Java/.NET/Go/Ruby) |
OPPORTUNITY_FOUND (architecture) |
Step 5 — migrate to arm64 |
| Function duration p95 > 10 min sustained OR timeout set to 15 min and frequently hit |
OPPORTUNITY_FOUND (placement) |
Step 5 — migrate workload to Fargate |
Compute Optimizer finding Optimized + Power Tuning confirms current memory + ARM64 already + no duration waste |
ALREADY_OPTIMAL |
None — continue monitoring |
| Duration/Invocations metrics absent or window < 14 days |
NEED_MORE_INFO |
Pull 14-30 day CloudWatch data, re-evaluate |
| All dimensions verified AND a change was applied and confirmed this session |
OPTIMIZED |
Emit post-state verification |
Pre-flight: data gate (run before any optimization decision)
Required data-source CLI listing moved to references/diagnostic-commands.md.
Full sequences: references/lambda-pricing-and-power-tuning.md.
Data-quality short-circuits
| Condition |
Effect on optimization |
Duration metric absent (function never invoked) |
NEED_MORE_INFO. Verify trigger wiring; skip until invocations exist. |
Invocations Sum = 0 over 14 days |
Emit ALREADY_OPTIMAL with note "dormant function." |
| Observation window < 14 days |
NEED_MORE_INFO. Minimum 14 days; 30 days preferred. |
memory_used (Lambda Insights) absent |
Fall back to Power Tuning only; mark Memory recommendation MEDIUM confidence. |
Compute Optimizer enrollment Inactive |
Proceed with CloudWatch + Power Tuning directly. |
Compute Optimizer lastRefreshTimestamp > 30 days old |
Stale finding. Re-run get-lambda-function-recommendations. |
Function State != Active |
Skip optimization; surface as BLOCKED. |
When CloudWatch and Compute Optimizer disagree, Power Tuning is the
tiebreaker — it measures the actual U-curve.
Process — Optimization logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
Full gotcha catalog (CPU-memory coupling, U-curve, SnapStart memory cost,
layer extraction cost, Power Tuning cost rules) moved to references/advanced-patterns.md.
Step 1: Memory configuration (the #1 lever)
Memory is the primary cost lever because of the U-curve: as memory
increases, CPU increases proportionally, and CPU-bound workloads see
disproportionate duration reduction.
U-curve math block moved to references/lambda-pricing-and-power-tuning.md;
the formula also appears in Quick start above.
Finding the U-curve minimum: AWS Lambda Power Tuning. Open-source
Step Functions tool that empirically measures the cost-duration curve.
Deploy via SAR; run an execution; read the cheapest field. Full
deployment and execution CLI is in references/lambda-pricing-and-power-tuning.md.
Decision gate after Power Tuning:
Power Tuning cheapest vs current MemorySize |
Verdict |
Action |
cheapest < current AND projected saving > 0 |
OPPORTUNITY_FOUND (downsize) |
Set MemorySize to cheapest. Verify duration stays within SLO. |
cheapest > current AND projected saving > 0 |
OPPORTUNITY_FOUND (upsize) |
Set MemorySize to cheapest. Function was CPU-bound. |
cheapest == current |
No memory finding |
Proceed to other dimensions. |
Step 2: Provisioned concurrency vs on-demand
Provisioned concurrency pre-initializes execution environments to
eliminate cold starts, but charges for idle time.
Decision tree:
Is the function latency-sensitive (API, real-time)?
├── NO → Use on-demand. Provisioned is wasted spend.
└── YES → Is cold-start duration > SLO threshold (e.g., p95 > 1 s)?
├── NO → Use on-demand.
└── YES → Is traffic consistent (CV < 0.5)?
├── NO → Consider provisioned concurrency autoscaling.
└── YES → Provisioned concurrency ≈ p50 of observed ConcurrentExecutions.
Right-sizing check: If provisioned > 2x p99 ConcurrentExecutions,
reduce to ~p90. If provisioned < p50 consistently, increase to ~p75-p90.
Step 3: Duration optimization
Duration is the second multiplier in the cost formula. Reducing duration
reduces cost linearly.
Duration-waste checklist:
| Symptom |
Fix |
| InitDuration > 1 s (cold start) |
Move init OUTSIDE the handler. Reuse HTTP clients, DB connections. |
| InitDuration > 3 s on Java |
Enable SnapStart, publish a version. |
| Duration >> expected |
Profile with X-Ray; identify slowest segment. |
| Duration increased after deploy |
Trim unused dependencies. Use Layers for shared code. |
| Duration spikes correlate with concurrency spikes |
Downstream bottleneck; use reserved concurrency to cap. |
| Duration = Timeout frequently |
Increase timeout OR migrate to Fargate (if > 15 min). |
Code-level optimization detail moved to references/advanced-patterns.md —
see "Step 3 deep dive".
Step 4: Invocation frequency analysis
Invocation frequency is the multiplier on every cost term. Reducing
invocation count reduces cost linearly.
ESM tuning: For SQS/Kinesis/DynamoDB Streams, default batch size is
10. Increase to 100-10000 for high-throughput sources. Pair with
MaximumBatchingWindowInSeconds=1-5.
aws lambda update-event-source-mapping \
--uuid <uuid> --batch-size 100 --maximum-batching-window-in-seconds 5
Invocation-count saving from batch tuning:
old_invocations = messages_per_hour / old_batch_size
new_invocations = messages_per_hour / new_batch_size
monthly_saving = (old_invocations - new_invocations) × 730 × $0.0000002
Batch-tuning example, caveat, and SQS long polling moved to
references/advanced-patterns.md (Step 4 deep dive).
Step 5: Architecture and workload placement
ARM64 migration CLI moved to references/advanced-patterns.md; Step
Functions pricing note moved there too (Step 5 deep dive).
See references/lambda-pricing-and-power-tuning.md for the full runtime
ARM64 compatibility matrix.
Fargate migration for long-running workloads:
| Signal |
Recommendation |
| Duration p95 > 10 min AND timeout = 15 min |
Migrate to Fargate |
| Duration p95 > 5 min AND batch workload |
Consider Fargate for cost predictability |
| Function orchestrates 5+ other functions |
Migrate orchestration to Step Functions |
Step 6: Impact estimation
Compute the monthly savings for each recommendation:
current_monthly_cost =
(monthly_invocations × avg_duration_s × current_memory_GB × $0.0000166667)
+ (monthly_invocations × $0.0000002)
projected_monthly_cost =
(monthly_invocations × projected_duration_s × projected_memory_GB × $0.0000166667)
+ (monthly_invocations × $0.0000002)
monthly_saving = current_monthly_cost - projected_monthly_cost
Always state assumptions: monthly invocation count, average duration at
current and projected memory (from Power Tuning), memory in GB, pricing
region, provisioned concurrency status.
Step 7: Final verdict
- Any dimension recommends a change → OPPORTUNITY_FOUND.
- All dimensions pass AND function is on ARM64 AND no waste → ALREADY_OPTIMAL.
- Change applied and verified this session → OPTIMIZED.
- Data insufficient (Duration absent, window < 14 days) → NEED_MORE_INFO.
Never emit OPPORTUNITY_FOUND without first discharging every
NEED_MORE_INFO/BLOCKED gate.
Output format
TARGET: <function-name>
VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <memory> MB at <avg duration> ms duration, <architecture>, <concurrency>
Proposed: <memory> MB at <projected duration> ms duration, <architecture>, <concurrency>
Dimensions changed: <memory | concurrency | duration | frequency | architecture | placement>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Monthly: $<amount>
Annual: $<amount>
Assumptions: <list (invocation count, pricing region, etc.)>
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: Before executing any state-changing CLI, emit and await operator
approval: "CONFIRM: About to <action> on <function-name> in <region>.
Proceed? (yes/no)"
Full worked examples (memory upsize, ARM64 migration, provisioned
concurrency removal, already-optimal, NEED_MORE_INFO, and end-to-end
walkthrough) are in references/worked-examples.md.
STRICT output contract
The rules below are hard constraints. Violating any one produces a
misclassification or an arithmetic contradiction that breaks downstream
FinOps automation. Self-check EVERY emitted block against these rules
before returning the response.
Required output structure
Every response MUST be a single block using these literal labels, in this
order. Do NOT substitute markdown headings, camelCase, or bold variants.
TARGET: <function-name>
VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL
REASON: <1-2 sentences naming the recommendation and the supporting data>
RECOMMENDATION:
Current: <memory> MB at <avg duration> ms, <architecture>, <concurrency>
Proposed: <memory> MB at <projected duration> ms, <architecture>, <concurrency>
Dimensions changed: <memory | concurrency | duration | frequency | architecture | placement>
Dimensions checked: <list ALL six, each ✓ (no finding) or → (finding)>
Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>
ESTIMATED_SAVINGS:
Current monthly: $<amount> ← MUST show compute + requests subtotals
Projected monthly: $<amount>
Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals
Annual saving: $<amount> ← MUST equal Monthly × 12
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: <confirmation prompt text>
FORBIDDEN output patterns
NEVER emit VERDICT: OPPORTUNITY_FOUND with Monthly saving: $0.00.
If every dimension nets zero cost delta, the verdict MUST be
ALREADY_OPTIMAL. A cost-neutral latency improvement is surfaced in
REASON as a latency delta, NOT as a dollar saving.
NEVER show savings math that does not balance.
Current monthly − Projected monthly MUST equal Monthly saving,
rounded to 2 decimal places.
NEVER emit scratch lines ("WAIT — recompute", "Hmm, let me redo",
"corrected:") in the output. Finalize the math before emitting.
NEVER recommend a memory change without citing Power Tuning or
Compute Optimizer evidence. The REASON MUST name the evidence source.
NEVER omit a dimension from the RECOMMENDATION block. The
Dimensions checked line MUST list all six dimensions, each marked
✓ (no finding) or → (finding).
NEVER present a cost-neutral or cost-increasing memory upsize as
"cost savings." Surface the latency improvement explicitly and set
Monthly saving: $0.00 with verdict ALREADY_OPTIMAL (or
OPPORTUNITY_FOUND ONLY if a different dimension has positive saving).
NEVER round intermediate formula steps differently from the final
figure. Compute at full precision, round only the displayed result.
Perfect example output — OPPORTUNITY_FOUND with verified math
Every field below is internally consistent. Copy this shape exactly.
TARGET: order-enrichment-api
VERDICT: OPPORTUNITY_FOUND
REASON: Python function at 128 MB averaging 5000 ms is CPU-bound (Power
Tuning U-curve minimum at 512 MB where duration drops to 950 ms).
Combined with ARM64 migration (20% compute discount), monthly compute
drops 38.5%. Invocations are 47M/month so the per-invocation saving
compounds.
RECOMMENDATION:
Current: 128 MB at 5000 ms avg, x86_64, on-demand
Proposed: 512 MB at 950 ms avg, arm64, on-demand
Dimensions changed: memory (Step 1) + architecture (Step 5)
Dimensions checked: memory → (upsize) concurrency ✓ (no provisioned)
duration ✓ (Power Tuning covers) frequency ✓ (API Gateway, no ESM)
architecture → (x86 to arm64) placement ✓ (950 ms well under 15 min)
Confidence: HIGH — Power Tuning measured the U-curve empirically;
Python 3.12 fully supports arm64; all deps have arm64 wheels.
ESTIMATED_SAVINGS:
Current monthly: $498.98
compute: 47,000,000 × 5.0 × 0.125 × $0.0000166667 = $489.58
requests: 47,000,000 × $0.0000002 = $9.40
Projected monthly: $307.07
compute: 47,000,000 × 0.95 × 0.5 × $0.0000166667 × 0.80 = $297.67
requests: 47,000,000 × $0.0000002 = $9.40
Monthly saving: $191.91
($498.98 − $307.07 = $191.91 ✓)
Annual saving: $2,302.92
MIGRATION_STEPS:
1. Run Power Tuning to confirm the U-curve:
aws stepfunctions start-execution --state-machine-arn <arn> --input '{...}'
2. Update memory and architecture together:
aws lambda update-function-configuration --function-name order-enrichment-api --memory-size 512 --architectures arm64
3. Publish a version and test via staging alias:
aws lambda publish-version --function-name order-enrichment-api
4. Monitor Duration and Errors for 7 days post-change.
CONFIRM: About to update-function-configuration on order-enrichment-api
(128 MB x86 → 512 MB arm64). Monthly saving $191.91 (38.5%); p95 latency
improvement ~82%. Proceed? (yes/no)
Self-check before emit:
Verdict semantics
| Verdict |
When to emit |
OPPORTUNITY_FOUND |
At least one dimension has a concrete, savings-bearing or latency-improving recommendation. |
OPTIMIZED |
A change was applied and verified this session; metrics confirm the new config lands within SLO. |
ALREADY_OPTIMAL |
All dimensions pass (memory at Power Tuning optimum, on ARM64, concurrency right-sized, duration within SLO). |
NEED_MORE_INFO |
Data gate failed: metrics absent, window < 14 days, or Compute Optimizer stale with no CloudWatch fallback. |
BLOCKED |
Hard precondition prevents evaluation: function State != Active, IAM denies lambda:GetFunction. |
Zero-savings rule: If MONTHLY_SAVING == $0.00 for every dimension,
verdict MUST be ALREADY_OPTIMAL, never OPPORTUNITY_FOUND. Exception:
latency improvement without cost change is surfaced in REASON, not as
dollar savings.
Anti-Patterns — NEVER (top 5)
NEVER recommend a memory change without Power Tuning or Compute
Optimizer evidence. The U-curve is workload-specific; guessing from
"128 MB is cheapest" produces false positives on CPU-bound workloads.
NEVER enable provisioned concurrency without verifying that cold-start
latency is a customer-visible problem AND traffic is consistent enough
to justify idle spend. Provisioned concurrency for sporadic traffic
is the #1 Lambda cost waste.
NEVER recommend ARM64 migration without verifying the runtime and
dependencies are ARM-compatible. An ARM migration that breaks at
runtime is worse than no migration.
NEVER increase batch size on an Event Source Mapping without verifying
the function handles partial batch failures correctly. Ensure
FunctionResponseTypes: ["ReportBatchItemFailures"] is set for SQS.
NEVER remove provisioned concurrency from a latency-sensitive API
without warning the operator that cold starts will return. Removing
saves money but degrades p99 latency.
Extended anti-patterns in references/error-handling-and-edge-cases.md.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation,
emit and await operator approval. Do NOT execute until confirmed.
- Publish a version before changing the alias. Never point production
at
$LATEST.
- Test the new memory setting before cutover. Validate via staging
alias or weighted routing.
- Verify ARM64 compatibility before architecture migration. Native
dependencies may fail at runtime.
- SnapStart requires versioned aliases. Ensure alias points at a
version before enabling.
- ESM changes are immediate. Function must handle the new batch size
without OOM or timeout.
- Provisioned concurrency removal causes cold starts. Verify the
latency SLO tolerates this.
- Power Tuning invokes the function repeatedly. Ensure function is
idempotent and downstream tolerates test load.
- Bulk-operation limit: Process at most 5 functions per batch. Sort
by estimated savings, verify each batch before proceeding. Abort if any
function shows increased errors or duration post-change.
Recent AWS features (2024-2026)
Feature list moved to references/advanced-patterns.md —
see "Recent AWS features (2024-2026)".
References
references/lambda-pricing-and-power-tuning.md — pricing tables,
memory-to-CPU mapping, Power Tuning deployment guide, ARM64 compatibility
matrix, ESM limits, duration baselines, regional pricing multipliers,
cost calculation worked examples.
references/worked-examples.md — full worked examples (memory upsize,
ARM64 migration, provisioned concurrency removal, already-optimal,
NEED_MORE_INFO, end-to-end walkthrough).
references/error-handling-and-edge-cases.md — CLI/data-source failure
handling, operational edge cases, container-image functions, extended
NEVER list, memory decision tree, remediation guidance, production
edge cases (provisioned concurrency waste, ARM64 incompatibility, ESM
batch sizing).
References (load on demand)
- advanced-patterns.md — mindset
principles, Step 0 gotchas, per-step deep dives (duration, batch
tuning, ARM64, Step Functions), recent AWS features.
- diagnostic-commands.md —
pre-flight data-gate CLI listing.
Domain
AWS CloudOps / Lambda Serverless Cost Optimization & FinOps.
AWS documentation
1---2name: lambda-cost-optimizer3description: 'Optimises AWS Lambda function cost across six dimensions: memory tuning (CPU scales with memory at 1769 MB = 1 vCPU; more memory can REDUCE total cost when faster execution offsets the higher per-GB-second rate), provisioned concurrency right-sizing (on-demand vs provisioned break-even math), duration reduction (SnapStart for Java, lazy init, connection reuse, package trim), invocation-frequency analysis (SQS/Kinesis/DynamoDB Streams batch size and batch window tuning), architecture migration (ARM64 Graviton2 is 20% cheaper; Fargate for >15-min workloads; Step Functions for orchestration chains), and Lambda Layers. Uses AWS Lambda Power Tuning (open-source Step Functions) to empirically find the cost-optimal memory, reads Compute Optimizer Lambda findings, and projects monthly savings. Emits OPPORTUNITY_FOUND with specific recommendation and estimated savings, OPTIMIZED, or ALREADY_OPTIMAL. Use when reviewing Lambda spend, planning a memory tuning sweep, sizing provisioned concurrency, or a FinOps review.'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted CloudWatch metrics and Compute Optimizer findings. Live-account optimization uses aws lambda list-functions, aws lambda get-function-configuration, aws cloudwatch get-metric-statistics (Duration, Invocations, Errors, Throttles, ConcurrentExecutions), aws lambda get-event-source-mapping, aws lambda list-provisioned-concurrency-configs, aws compute-optimizer...6metadata:7 source: https://skillmd.com/skills/jhkchan/lambda-cost-optimizer8 domain: aws-cloudops9 complexity: medium10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Compute15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL19 when_to_use: Optimising Lambda function cost, triaging Compute Optimizer Lambda findings, planning a memory tuning sweep (Power Tuning), sizing provisioned concurrency vs on-demand, reducing function duration, tuning SQS/DynamoDB/Kinesis event source mapping batch size, evaluating ARM64 (Graviton2) migration, or migrating long-running Lambda workloads to Fargate or Step Functions.20 when_not_to_use: EC2 instance rightsizing (use ec2-rightsizing-optimizer), EBS volume cost (use ebs-volume-optimizer), S3 storage cost (use s3-lifecycle-optimizer), or Lambda troubleshooting (invocation errors, timeouts, configuration bugs — use the Lambda troubleshooter). This skill focuses on cost-driven optimization decisions, not functional debugging of broken functions.21 activation_triggers: optimise Lambda cost, Lambda memory tuning, Lambda Power Tuning, Lambda Compute Optimizer recommendations, Lambda provisioned concurrency, Lambda duration optimization, Lambda cold start, Lambda SnapStart Java, Lambda batch size SQS, Lambda ARM64 Graviton2, Lambda Layers shared code, Lambda invocation frequency, Lambda FinOps savings, Lambda to Fargate migration, Lambda monthly savings estimate, reduce Lambda bill, serverless cost review22 invocation_schema: 'Input: either (a) a function identifier + live-account context, (b) a Compute Optimizer Lambda finding document, OR (c) CloudWatch Lambda Insights metrics (Duration, Invocations, Memory utilization, ConcurrentExecutions, Errors) with at least 14 days of observation. Output: a deterministic TARGET/VERDICT/REASON/RECOMMENDATION/ ESTIMATED_SAVINGS/MIGRATION_STEPS block per function, where VERDICT is one of OPTIMIZED, OPPORTUNITY_FOUND, ALREADY_OPTIMAL.'23 invocation_example: "# Minimal valid input (offline finding classification):\nFunctionName: order-processor-prod\nRuntime: nodejs20.x\nMemorySize: 128 MB\nArchitecture: x86_64\nRegion: us-east-1\nPricing: on-demand (no provisioned concurrency)\nMetrics (last 30 days):\n - Duration avg: 5200 ms, p95: 6100 ms\n - Invocations: 50,000,000/month\n - Errors: 12,000 (0.024%)\n - Memory utilization: avg 38 MB (30% of 128 MB)\nCompute Optimizer finding: Overprovisioned (memory)\nEmit the standard optimization block (TARGET, VERDICT, REASON,\nRECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS)."24 version: 0.1.025 author: Jacky Chan — AWS Community Builder26 keywords: Lambda, memory configuration, cost optimization, Power Tuning, provisioned concurrency, on-demand, duration, cold start, SnapStart, invocation frequency, batch size, batch window, event source mapping, SQS, DynamoDB Streams, Kinesis, Lambda Layers, ARM64, Graviton2, Fargate migration, Step Functions, FinOps, Compute Optimizer, serverless27 tags: lambda, compute, serverless, cost-optimization, finops, memory-tuning, power-tuning, graviton28---2930# Lambda Cost Optimizer3132## What this skill does3334Translates a Lambda function's runtime posture into a concrete cost-35optimization recommendation with a dollar-denominated savings estimate.36The verdict is the highest-leverage action across six dimensions — memory,37provisioned concurrency, duration, invocation frequency, architecture, and38workload placement — applied in priority order. Always pairs the39recommendation with exact CLI commands (or Power Tuning invocation).4041## Quick navigation4243| Section | What it covers | When to jump here |44|---|---|---|45| Quick start | Four headline rules and the cost formula | First read |46| Mindset | Why memory tuning is the #1 lever | Understanding the approach |47| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a function |48| Pre-flight data gate | CloudWatch metrics, Compute Optimizer | Before any recommendation |49| Step 0 non-obvious behaviours | CPU-memory coupling, SnapStart, ESM, ARM64 | Edge cases |50| Step 1 Memory configuration | Power Tuning, optimal-memory math | The headline savings dimension |51| Step 2 Provisioned concurrency | On-demand vs provisioned break-even | Latency-sensitive APIs |52| Step 3 Duration optimization | Cold start, init, connection reuse | Slow functions |53| Step 4 Invocation frequency | Batch size, batch window, long polling | High-volume consumers |54| Step 5 Architecture / placement | ARM64, Layers, Fargate, Step Functions | Cross-cutting savings |55| Step 6 Impact estimation | The cost formula and worked math | Every recommendation |56| Output format | VERDICT block + worked examples | Emitting the result |57| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |58| Pre-flight safety checks | CONFIRM gate, version publish, alias | Before any apply CLI |5960## Quick start6162- **Memory is the #1 lever.** Lambda couples vCPU to memory (1769 MB =63 1 vCPU). More memory can REDUCE total cost when faster execution64 offsets the higher per-GB-second rate. Classic example: 128 MB at 5 s65 costs $0.000000835/invocation; 512 MB at 1 s costs $0.000000667 — 33%66 CHEAPER at the higher memory. Always run Power Tuning before assuming67 128 MB is cheapest.68- **Cost formula (memorise this):**69 `cost = (invocations × duration_s × memory_GB × $0.0000166667)70 + (invocations × $0.0000002)`71- **Provisioned concurrency pays for idle.** Use it ONLY for steady-72 traffic, latency-sensitive APIs where cold starts hurt. For batch,73 event-driven, or sporadic workloads, on-demand is cheaper.74- **Architecture is a free 20%.** ARM64 (Graviton2) is ~20% cheaper than75 x86_64 for supported runtimes. Check the runtime support matrix and76 migrate when possible.7778## Mindset7980Lambda cost optimization is a price-performance decision, not a pure81utilization exercise. The goal is the memory/concurrency/architecture82configuration that minimizes dollar cost while preserving latency and83error-rate SLOs — not the absolute minimum memory that runs the code.8485Four-principle deep dive moved to `references/advanced-patterns.md` —86see "Mindset — four principles".8788## Quick reference — verdict thresholds8990| Observation (14-30 day window) | Verdict | Recommendation |91|---|---|---|92| Memory tuning U-curve minimum differs from current MemorySize by ≥ 1 step AND projected compute saving > 0 | **OPPORTUNITY_FOUND** (memory) | Step 1 — set MemorySize to Power Tuning optimum |93| Provisioned concurrency configured AND ConcurrentExecutions sustained < 30% of provisioned | **OPPORTUNITY_FOUND** (concurrency) | Step 2 — reduce or remove provisioned concurrency |94| No provisioned concurrency AND latency-sensitive API AND cold-start p95 > 1 s AND steady traffic | **OPPORTUNITY_FOUND** (concurrency — add) | Step 2 — add provisioned concurrency sized to baseline |95| Duration p95 > 2× the runtime's healthy baseline OR cold-start duration > 3 s on Java without SnapStart | **OPPORTUNITY_FOUND** (duration) | Step 3 — SnapStart, lazy init, connection reuse, package trim |96| Event source mapping batch size = 1 on SQS/Kinesis/DynamoDB Streams with high message arrival rate | **OPPORTUNITY_FOUND** (invocation frequency) | Step 4 — tune batch size + batch window |97| Architecture = x86_64 AND runtime is ARM-compatible (Node/Python/Java/.NET/Go/Ruby) | **OPPORTUNITY_FOUND** (architecture) | Step 5 — migrate to arm64 |98| Function duration p95 > 10 min sustained OR timeout set to 15 min and frequently hit | **OPPORTUNITY_FOUND** (placement) | Step 5 — migrate workload to Fargate |99| Compute Optimizer finding `Optimized` + Power Tuning confirms current memory + ARM64 already + no duration waste | **ALREADY_OPTIMAL** | None — continue monitoring |100| Duration/Invocations metrics absent or window < 14 days | **NEED_MORE_INFO** | Pull 14-30 day CloudWatch data, re-evaluate |101| All dimensions verified AND a change was applied and confirmed this session | **OPTIMIZED** | Emit post-state verification |102103## Pre-flight: data gate (run before any optimization decision)104105Required data-source CLI listing moved to `references/diagnostic-commands.md`.106Full sequences: `references/lambda-pricing-and-power-tuning.md`.107108### Data-quality short-circuits109110| Condition | Effect on optimization |111|---|---|112| `Duration` metric absent (function never invoked) | **NEED_MORE_INFO**. Verify trigger wiring; skip until invocations exist. |113| `Invocations` Sum = 0 over 14 days | Emit **ALREADY_OPTIMAL** with note "dormant function." |114| Observation window < 14 days | **NEED_MORE_INFO**. Minimum 14 days; 30 days preferred. |115| `memory_used` (Lambda Insights) absent | Fall back to Power Tuning only; mark Memory recommendation MEDIUM confidence. |116| Compute Optimizer enrollment `Inactive` | Proceed with CloudWatch + Power Tuning directly. |117| Compute Optimizer `lastRefreshTimestamp` > 30 days old | Stale finding. Re-run `get-lambda-function-recommendations`. |118| Function `State != Active` | Skip optimization; surface as BLOCKED. |119120When CloudWatch and Compute Optimizer disagree, Power Tuning is the121tiebreaker — it measures the actual U-curve.122123## Process — Optimization logic (apply in order)124125### Step 0: Non-obvious behaviours that change the recommendation126127Full gotcha catalog (CPU-memory coupling, U-curve, SnapStart memory cost,128layer extraction cost, Power Tuning cost rules) moved to `references/advanced-patterns.md`.129130131### Step 1: Memory configuration (the #1 lever)132133Memory is the primary cost lever because of the U-curve: as memory134increases, CPU increases proportionally, and CPU-bound workloads see135disproportionate duration reduction.136137U-curve math block moved to `references/lambda-pricing-and-power-tuning.md`;138the formula also appears in Quick start above.139140**Finding the U-curve minimum: AWS Lambda Power Tuning.** Open-source141Step Functions tool that empirically measures the cost-duration curve.142Deploy via SAR; run an execution; read the `cheapest` field. Full143deployment and execution CLI is in `references/lambda-pricing-and-power-tuning.md`.144145**Decision gate after Power Tuning:**146147| Power Tuning `cheapest` vs current MemorySize | Verdict | Action |148|---|---|---|149| `cheapest` < current AND projected saving > 0 | **OPPORTUNITY_FOUND** (downsize) | Set MemorySize to `cheapest`. Verify duration stays within SLO. |150| `cheapest` > current AND projected saving > 0 | **OPPORTUNITY_FOUND** (upsize) | Set MemorySize to `cheapest`. Function was CPU-bound. |151| `cheapest` == current | No memory finding | Proceed to other dimensions. |152153### Step 2: Provisioned concurrency vs on-demand154155Provisioned concurrency pre-initializes execution environments to156eliminate cold starts, but charges for idle time.157158**Decision tree:**159```160Is the function latency-sensitive (API, real-time)?161├── NO → Use on-demand. Provisioned is wasted spend.162└── YES → Is cold-start duration > SLO threshold (e.g., p95 > 1 s)?163 ├── NO → Use on-demand.164 └── YES → Is traffic consistent (CV < 0.5)?165 ├── NO → Consider provisioned concurrency autoscaling.166 └── YES → Provisioned concurrency ≈ p50 of observed ConcurrentExecutions.167```168169**Right-sizing check:** If provisioned > 2x p99 ConcurrentExecutions,170reduce to ~p90. If provisioned < p50 consistently, increase to ~p75-p90.171172### Step 3: Duration optimization173174Duration is the second multiplier in the cost formula. Reducing duration175reduces cost linearly.176177**Duration-waste checklist:**178179| Symptom | Fix |180|---|---|181| InitDuration > 1 s (cold start) | Move init OUTSIDE the handler. Reuse HTTP clients, DB connections. |182| InitDuration > 3 s on Java | Enable SnapStart, publish a version. |183| Duration >> expected | Profile with X-Ray; identify slowest segment. |184| Duration increased after deploy | Trim unused dependencies. Use Layers for shared code. |185| Duration spikes correlate with concurrency spikes | Downstream bottleneck; use reserved concurrency to cap. |186| Duration = Timeout frequently | Increase timeout OR migrate to Fargate (if > 15 min). |187188Code-level optimization detail moved to `references/advanced-patterns.md` —189see "Step 3 deep dive".190191### Step 4: Invocation frequency analysis192193Invocation frequency is the multiplier on every cost term. Reducing194invocation count reduces cost linearly.195196**ESM tuning:** For SQS/Kinesis/DynamoDB Streams, default batch size is19710. Increase to 100-10000 for high-throughput sources. Pair with198`MaximumBatchingWindowInSeconds=1-5`.199200```bash201aws lambda update-event-source-mapping \202 --uuid <uuid> --batch-size 100 --maximum-batching-window-in-seconds 5203```204205**Invocation-count saving from batch tuning:**206```207old_invocations = messages_per_hour / old_batch_size208new_invocations = messages_per_hour / new_batch_size209monthly_saving = (old_invocations - new_invocations) × 730 × $0.0000002210```211212Batch-tuning example, caveat, and SQS long polling moved to213`references/advanced-patterns.md` (Step 4 deep dive).214215### Step 5: Architecture and workload placement216217ARM64 migration CLI moved to `references/advanced-patterns.md`; Step218Functions pricing note moved there too (Step 5 deep dive).219220See `references/lambda-pricing-and-power-tuning.md` for the full runtime221ARM64 compatibility matrix.222223**Fargate migration for long-running workloads:**224225| Signal | Recommendation |226|---|---|227| Duration p95 > 10 min AND timeout = 15 min | Migrate to Fargate |228| Duration p95 > 5 min AND batch workload | Consider Fargate for cost predictability |229| Function orchestrates 5+ other functions | Migrate orchestration to Step Functions |230231### Step 6: Impact estimation232233Compute the monthly savings for each recommendation:234235```236current_monthly_cost =237 (monthly_invocations × avg_duration_s × current_memory_GB × $0.0000166667)238 + (monthly_invocations × $0.0000002)239240projected_monthly_cost =241 (monthly_invocations × projected_duration_s × projected_memory_GB × $0.0000166667)242 + (monthly_invocations × $0.0000002)243244monthly_saving = current_monthly_cost - projected_monthly_cost245```246247Always state assumptions: monthly invocation count, average duration at248current and projected memory (from Power Tuning), memory in GB, pricing249region, provisioned concurrency status.250251### Step 7: Final verdict252253- Any dimension recommends a change → **OPPORTUNITY_FOUND**.254- All dimensions pass AND function is on ARM64 AND no waste → **ALREADY_OPTIMAL**.255- Change applied and verified this session → **OPTIMIZED**.256- Data insufficient (Duration absent, window < 14 days) → **NEED_MORE_INFO**.257258Never emit `OPPORTUNITY_FOUND` without first discharging every259`NEED_MORE_INFO`/`BLOCKED` gate.260261## Output format262263```text264TARGET: <function-name>265VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL266REASON: <1-2 sentences naming the recommendation and the supporting data>267RECOMMENDATION:268 Current: <memory> MB at <avg duration> ms duration, <architecture>, <concurrency>269 Proposed: <memory> MB at <projected duration> ms duration, <architecture>, <concurrency>270 Dimensions changed: <memory | concurrency | duration | frequency | architecture | placement>271 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>272ESTIMATED_SAVINGS:273 Monthly: $<amount>274 Annual: $<amount>275 Assumptions: <list (invocation count, pricing region, etc.)>276MIGRATION_STEPS:277 1. <specific action with CLI command>278 2. <verification step>279CONFIRM: Before executing any state-changing CLI, emit and await operator280 approval: "CONFIRM: About to <action> on <function-name> in <region>.281 Proceed? (yes/no)"282```283284Full worked examples (memory upsize, ARM64 migration, provisioned285concurrency removal, already-optimal, NEED_MORE_INFO, and end-to-end286walkthrough) are in `references/worked-examples.md`.287288## STRICT output contract289290The rules below are hard constraints. Violating any one produces a291misclassification or an arithmetic contradiction that breaks downstream292FinOps automation. Self-check EVERY emitted block against these rules293before returning the response.294295### Required output structure296297Every response MUST be a single block using these literal labels, in this298order. Do NOT substitute markdown headings, camelCase, or bold variants.299300```text301TARGET: <function-name>302VERDICT: OPTIMIZED | OPPORTUNITY_FOUND | ALREADY_OPTIMAL303REASON: <1-2 sentences naming the recommendation and the supporting data>304RECOMMENDATION:305 Current: <memory> MB at <avg duration> ms, <architecture>, <concurrency>306 Proposed: <memory> MB at <projected duration> ms, <architecture>, <concurrency>307 Dimensions changed: <memory | concurrency | duration | frequency | architecture | placement>308 Dimensions checked: <list ALL six, each ✓ (no finding) or → (finding)>309 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>310ESTIMATED_SAVINGS:311 Current monthly: $<amount> ← MUST show compute + requests subtotals312 Projected monthly: $<amount>313 Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals314 Annual saving: $<amount> ← MUST equal Monthly × 12315MIGRATION_STEPS:316 1. <specific action with CLI command>317 2. <verification step>318CONFIRM: <confirmation prompt text>319```320321### FORBIDDEN output patterns3223231. **NEVER emit `VERDICT: OPPORTUNITY_FOUND` with `Monthly saving: $0.00`.**324 If every dimension nets zero cost delta, the verdict MUST be325 `ALREADY_OPTIMAL`. A cost-neutral latency improvement is surfaced in326 REASON as a latency delta, NOT as a dollar saving.3273282. **NEVER show savings math that does not balance.**329 `Current monthly − Projected monthly` MUST equal `Monthly saving`,330 rounded to 2 decimal places.3313323. **NEVER emit scratch lines** ("WAIT — recompute", "Hmm, let me redo",333 "corrected:") in the output. Finalize the math before emitting.3343354. **NEVER recommend a memory change without citing Power Tuning or336 Compute Optimizer evidence.** The REASON MUST name the evidence source.3373385. **NEVER omit a dimension from the RECOMMENDATION block.** The339 `Dimensions checked` line MUST list all six dimensions, each marked340 ✓ (no finding) or → (finding).3413426. **NEVER present a cost-neutral or cost-increasing memory upsize as343 "cost savings."** Surface the latency improvement explicitly and set344 `Monthly saving: $0.00` with verdict `ALREADY_OPTIMAL` (or345 `OPPORTUNITY_FOUND` ONLY if a different dimension has positive saving).3463477. **NEVER round intermediate formula steps differently from the final348 figure.** Compute at full precision, round only the displayed result.349350### Perfect example output — OPPORTUNITY_FOUND with verified math351352Every field below is internally consistent. Copy this shape exactly.353354```text355TARGET: order-enrichment-api356VERDICT: OPPORTUNITY_FOUND357REASON: Python function at 128 MB averaging 5000 ms is CPU-bound (Power358 Tuning U-curve minimum at 512 MB where duration drops to 950 ms).359 Combined with ARM64 migration (20% compute discount), monthly compute360 drops 38.5%. Invocations are 47M/month so the per-invocation saving361 compounds.362RECOMMENDATION:363 Current: 128 MB at 5000 ms avg, x86_64, on-demand364 Proposed: 512 MB at 950 ms avg, arm64, on-demand365 Dimensions changed: memory (Step 1) + architecture (Step 5)366 Dimensions checked: memory → (upsize) concurrency ✓ (no provisioned)367 duration ✓ (Power Tuning covers) frequency ✓ (API Gateway, no ESM)368 architecture → (x86 to arm64) placement ✓ (950 ms well under 15 min)369 Confidence: HIGH — Power Tuning measured the U-curve empirically;370 Python 3.12 fully supports arm64; all deps have arm64 wheels.371ESTIMATED_SAVINGS:372 Current monthly: $498.98373 compute: 47,000,000 × 5.0 × 0.125 × $0.0000166667 = $489.58374 requests: 47,000,000 × $0.0000002 = $9.40375 Projected monthly: $307.07376 compute: 47,000,000 × 0.95 × 0.5 × $0.0000166667 × 0.80 = $297.67377 requests: 47,000,000 × $0.0000002 = $9.40378 Monthly saving: $191.91379 ($498.98 − $307.07 = $191.91 ✓)380 Annual saving: $2,302.92381MIGRATION_STEPS:382 1. Run Power Tuning to confirm the U-curve:383 aws stepfunctions start-execution --state-machine-arn <arn> --input '{...}'384 2. Update memory and architecture together:385 aws lambda update-function-configuration --function-name order-enrichment-api --memory-size 512 --architectures arm64386 3. Publish a version and test via staging alias:387 aws lambda publish-version --function-name order-enrichment-api388 4. Monitor Duration and Errors for 7 days post-change.389CONFIRM: About to update-function-configuration on order-enrichment-api390 (128 MB x86 → 512 MB arm64). Monthly saving $191.91 (38.5%); p95 latency391 improvement ~82%. Proceed? (yes/no)392```393394**Self-check before emit:**395- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?396- [ ] `Monthly saving × 12 == Annual saving`?397- [ ] All six dimensions listed in `Dimensions checked`?398- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?399- [ ] No scratch/recompute text in the block?400401## Verdict semantics402403| Verdict | When to emit |404|---|---|405| `OPPORTUNITY_FOUND` | At least one dimension has a concrete, savings-bearing or latency-improving recommendation. |406| `OPTIMIZED` | A change was applied and verified this session; metrics confirm the new config lands within SLO. |407| `ALREADY_OPTIMAL` | All dimensions pass (memory at Power Tuning optimum, on ARM64, concurrency right-sized, duration within SLO). |408| `NEED_MORE_INFO` | Data gate failed: metrics absent, window < 14 days, or Compute Optimizer stale with no CloudWatch fallback. |409| `BLOCKED` | Hard precondition prevents evaluation: function State != Active, IAM denies lambda:GetFunction. |410411**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,412verdict MUST be `ALREADY_OPTIMAL`, never `OPPORTUNITY_FOUND`. Exception:413latency improvement without cost change is surfaced in REASON, not as414dollar savings.415416## Anti-Patterns — NEVER (top 5)4174181. **NEVER recommend a memory change without Power Tuning or Compute419 Optimizer evidence.** The U-curve is workload-specific; guessing from420 "128 MB is cheapest" produces false positives on CPU-bound workloads.4214222. **NEVER enable provisioned concurrency without verifying that cold-start423 latency is a customer-visible problem AND traffic is consistent enough424 to justify idle spend.** Provisioned concurrency for sporadic traffic425 is the #1 Lambda cost waste.4264273. **NEVER recommend ARM64 migration without verifying the runtime and428 dependencies are ARM-compatible.** An ARM migration that breaks at429 runtime is worse than no migration.4304314. **NEVER increase batch size on an Event Source Mapping without verifying432 the function handles partial batch failures correctly.** Ensure433 `FunctionResponseTypes: ["ReportBatchItemFailures"]` is set for SQS.4344355. **NEVER remove provisioned concurrency from a latency-sensitive API436 without warning the operator that cold starts will return.** Removing437 saves money but degrades p99 latency.438439Extended anti-patterns in `references/error-handling-and-edge-cases.md`.440441## Pre-flight safety checks (run before any remediation CLI)442443- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,444 emit and await operator approval. Do NOT execute until confirmed.445- **Publish a version before changing the alias.** Never point production446 at `$LATEST`.447- **Test the new memory setting before cutover.** Validate via staging448 alias or weighted routing.449- **Verify ARM64 compatibility before architecture migration.** Native450 dependencies may fail at runtime.451- **SnapStart requires versioned aliases.** Ensure alias points at a452 version before enabling.453- **ESM changes are immediate.** Function must handle the new batch size454 without OOM or timeout.455- **Provisioned concurrency removal causes cold starts.** Verify the456 latency SLO tolerates this.457- **Power Tuning invokes the function repeatedly.** Ensure function is458 idempotent and downstream tolerates test load.459- **Bulk-operation limit:** Process at most 5 functions per batch. Sort460 by estimated savings, verify each batch before proceeding. Abort if any461 function shows increased errors or duration post-change.462463## Recent AWS features (2024-2026)464465Feature list moved to `references/advanced-patterns.md` —466see "Recent AWS features (2024-2026)".467468## References469470- `references/lambda-pricing-and-power-tuning.md` — pricing tables,471 memory-to-CPU mapping, Power Tuning deployment guide, ARM64 compatibility472 matrix, ESM limits, duration baselines, regional pricing multipliers,473 cost calculation worked examples.474- `references/worked-examples.md` — full worked examples (memory upsize,475 ARM64 migration, provisioned concurrency removal, already-optimal,476 NEED_MORE_INFO, end-to-end walkthrough).477- `references/error-handling-and-edge-cases.md` — CLI/data-source failure478 handling, operational edge cases, container-image functions, extended479 NEVER list, memory decision tree, remediation guidance, production480 edge cases (provisioned concurrency waste, ARM64 incompatibility, ESM481 batch sizing).482483## References (load on demand)484485- [advanced-patterns.md](references/advanced-patterns.md) — mindset486 principles, Step 0 gotchas, per-step deep dives (duration, batch487 tuning, ARM64, Step Functions), recent AWS features.488- [diagnostic-commands.md](references/diagnostic-commands.md) —489 pre-flight data-gate CLI listing.490491## Domain492493AWS CloudOps / Lambda Serverless Cost Optimization & FinOps.494495## AWS documentation496497- **AWS Lambda Developer Guide** — https://docs.aws.amazon.com/lambda/latest/dg/welcome.html498- **AWS Lambda pricing** — https://aws.amazon.com/lambda/pricing/499- **AWS Lambda memory and CPU** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html500- **Lambda SnapStart** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-snapstart.html501- **Lambda provisioned concurrency** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html502- **Lambda event source mappings** — https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html503- **AWS Lambda Power Tuning (open source)** — https://github.com/alexcasalboni/aws-lambda-power-tuning504- **AWS Compute Optimizer — Lambda** — https://docs.aws.amazon.com/compute-optimizer/latest/ug/lambda.html505- **CloudWatch Lambda Insights** — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html506- **AWS CLI Lambda reference** — https://docs.aws.amazon.com/cli/latest/reference/lambda/507- **AWS Well-Architected Framework — Cost Optimization** — https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html