Lambda Memory Optimizer
What this skill does
Moved verbatim to references/advanced-patterns.md — load on demand.
Quick navigation
| Section |
What it covers |
When to jump here |
| Quick start |
Four headline rules and the cost formula |
First read |
| Mindset |
Why the U-curve 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, Power Tuning, Insights |
Before any recommendation |
| Step 0 non-obvious behaviours |
CPU coupling, ARM64 ratio, SnapStart, EFS |
Edge cases |
| Step 1 Memory size (U-curve) |
Power Tuning, cost-vs-latency tradeoff |
The headline savings dimension |
| Step 2 Provisioned concurrency memory |
PC idle bill scales with memory |
Latency-sensitive APIs |
| Step 3 Init-phase memory |
Cold start, SnapStart, lazy init |
Slow init functions |
| Step 4 EFS / container / Layers overhead |
Resident memory add-ons |
Heavy dependency functions |
| Step 5 /tmp storage allocation |
Decouple /tmp from memory budget |
Functions with local scratch |
| Step 6 ARM64 memory-to-CPU ratio |
Graviton2 re-tuning after migration |
Architecture changes |
| Step 7 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
Moved verbatim to references/advanced-patterns.md — load on demand.
Mindset
Moved verbatim to references/advanced-patterns.md — load on demand.
Quick reference — verdict thresholds
| Observation (14-30 day window) |
Verdict |
Recommendation |
Power Tuning cheapest differs from current MemorySize by ≥ 1 step AND projected compute saving > 0 |
FURTHER_OPTIMIZATION_AVAILABLE (memory) |
Step 1 — set MemorySize to Power Tuning optimum |
Power Tuning cheapest == current BUT fastest is materially faster AND operator prioritises latency |
FURTHER_OPTIMIZATION_AVAILABLE (memory — latency) |
Step 1 — set MemorySize to fastest; surface cost-neutral or cost-increasing delta |
Provisioned concurrency configured AND MemorySize > Power Tuning cheapest (oversized memory inflating PC idle bill) |
FURTHER_OPTIMIZATION_AVAILABLE (PC memory) |
Step 2 — right-size memory first, then re-evaluate PC |
| InitDuration > 1 s on cold starts AND no SnapStart AND runtime is Java |
FURTHER_OPTIMIZATION_AVAILABLE (init) |
Step 3 — enable SnapStart, lazy init, connection reuse |
| EFS mounted AND resident memory > 64 MB baseline AND MemorySize at minimum |
FURTHER_OPTIMIZATION_AVAILABLE (EFS) |
Step 4 — increase MemorySize to accommodate EFS baseline OR remove EFS |
| Container image deployment AND MemorySize < 256 MB |
FURTHER_OPTIMIZATION_AVAILABLE (container) |
Step 4 — increase to 256 MB minimum |
| /tmp allocation > 512 MB AND MemorySize at minimum (function using memory as /tmp overflow) |
FURTHER_OPTIMIZATION_AVAILABLE (/tmp) |
Step 5 — decouple /tmp via --ephemeral-storage |
| Architecture = x86_64 AND runtime is ARM-compatible |
FURTHER_OPTIMIZATION_AVAILABLE (architecture) |
Step 6 — migrate to arm64 AND re-run Power Tuning |
Compute Optimizer finding Optimized + Power Tuning confirms current memory + arm64 + no init waste |
OPTIMIZED |
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)
Moved verbatim to references/advanced-patterns.md — load on demand.
Moved verbatim to references/diagnostic-commands.md — load on demand.
Moved verbatim to references/advanced-patterns.md — load on demand.
Process — Memory optimization logic (apply in order)
Step 0: Non-obvious behaviours that change the recommendation
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 1: Memory size (the U-curve)
Memory size is the primary lever because of the U-curve: as memory
increases, CPU increases proportionally, and CPU-bound workloads see
disproportionate duration reduction.
Moved verbatim to references/advanced-patterns.md — load on demand.
Decision gate after Power Tuning:
| Power Tuning result vs current MemorySize |
Verdict |
Action |
cheapest < current AND projected saving > 0 |
FURTHER_OPTIMIZATION_AVAILABLE (downsize) |
Set MemorySize to cheapest. Verify duration stays within SLO. |
cheapest > current AND projected saving > 0 |
FURTHER_OPTIMIZATION_AVAILABLE (upsize) |
Set MemorySize to cheapest. Function was CPU-bound. |
cheapest == current BUT fastest is materially faster |
FURTHER_OPTIMIZATION_AVAILABLE (latency) |
Surface the latency improvement; let operator choose. May be cost-increasing. |
cheapest == current AND fastest == current |
No memory finding |
Proceed to other dimensions. |
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 2: Provisioned concurrency memory footprint
Moved verbatim to references/advanced-patterns.md — load on demand.
Decision tree:
Is provisioned concurrency configured?
├── NO → PC memory check passes.
└── YES → Is MemorySize > Power Tuning `cheapest`?
├── NO → Memory already right-sized; PC idle is justified.
└── YES → **FURTHER_OPTIMIZATION_AVAILABLE** (PC memory)
Right-size memory FIRST, then re-evaluate PC count.
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 3: Init-phase memory (cold start)
Init-phase memory is the memory consumed during the function's
initialization (before the handler runs). High init memory causes slow
cold starts and, in extreme cases, OOM during init.
Init-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. |
| InitDuration spikes after Layers added |
Audit Layers — each is a separate zip extraction. Reduce layer count. |
| InitDuration spikes after dependency update |
Trim unused deps. Use pip install --no-deps. |
| OOM during init (rare) |
Increase MemorySize to accommodate peak init allocation. |
Moved verbatim to references/diagnostic-commands.md — load on demand.
Step 4: EFS, container image, and Layers memory overhead
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 5: /tmp storage allocation
Since 2022, /tmp storage is configured independently of MemorySize
via --ephemeral-storage (up to 10 GB). Bills separately at
$0.0000000625/MB-second.
Decision tree:
Is the function using memory as /tmp overflow (high MemorySize, low
runtime memory_used)?
├── NO → /tmp check passes.
└── YES → **FURTHER_OPTIMIZATION_AVAILABLE** (/tmp)
Decouple: reduce MemorySize to runtime needs, allocate /tmp
via --ephemeral-storage.
Moved verbatim to references/diagnostic-commands.md — load on demand.
Step 6: ARM64 (Graviton2) memory-to-CPU ratio
ARM64 has a different memory-to-vCPU ratio than x86_64. After migrating
architecture, the U-curve minimum shifts.
Moved verbatim to references/advanced-patterns.md — load on demand.
Moved verbatim to references/diagnostic-commands.md — load on demand.
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 7: Impact estimation
Compute the monthly savings for each recommendation:
Moved verbatim to references/advanced-patterns.md — load on demand.
Step 8: Final verdict
- Any dimension recommends a change → FURTHER_OPTIMIZATION_AVAILABLE.
- All dimensions pass AND function is on arm64 AND no init waste AND no
/tmp-memory coupling → OPTIMIZED.
- Change applied and verified this session → OPTIMIZED (post-state).
- Data insufficient (Duration absent, window < 14 days) →
NEED_MORE_INFO.
Never emit FURTHER_OPTIMIZATION_AVAILABLE without first discharging
every NEED_MORE_INFO/BLOCKED gate.
Output format
Moved verbatim to references/lambda-memory-worked-examples.md — load on demand.
Moved verbatim to references/lambda-memory-worked-examples.md — load on demand.
Full worked examples (memory upsize, memory downsize, PC memory
cascading, ARM64 re-tuning, already-optimized, end-to-end walkthrough)
are in references/lambda-memory-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 | FURTHER_OPTIMIZATION_AVAILABLE
REASON: <1-2 sentences naming the recommendation and supporting data>
POWER_TUNING_RESULTS:
| Memory | Avg Duration | p99 Duration | $/Invocation | Tag |
|----------|-------------|-------------|-------------|----------------|
| <MB> | <ms> | <ms> | $<amount> | current |
| <MB> | <ms> | <ms> | $<amount> | cost-optimal |
| <MB> | <ms> | <ms> | $<amount> | latency-optimal|
COST_COMPARISON:
Current: <MB> at <ms> avg → $<amount>/invocation × <N>/month = $<amount>/month
Proposed: <MB> at <ms> avg → $<amount>/invocation × <N>/month = $<amount>/month
Saving: $<amount>/month (<pct>%)
Latency: p99 drops from <ms> to <ms> (<pct>% reduction)
RECOMMENDATION:
Current: <memory> MB at <avg duration> ms, <architecture>, <concurrency>, <init>
Proposed: <memory> MB at <projected duration> ms, <architecture>, <concurrency>, <init>
Dimensions changed: <memory | pc_memory | init | efs_container_layers | tmp | architecture>
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 + PC subtotals
Projected monthly: $<amount>
Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals
Annual saving: $<amount> ← MUST equal Monthly × 12
Latency delta: <p99 duration change> ms (<percentage>%)
MIGRATION_STEPS:
1. <specific action with CLI command>
2. <verification step>
CONFIRM: <confirmation prompt text>
FORBIDDEN output patterns
NEVER emit VERDICT: FURTHER_OPTIMIZATION_AVAILABLE with
Monthly saving: $0.00 AND no latency improvement. If every
dimension nets zero cost delta AND zero latency delta, the verdict
MUST be OPTIMIZED. A cost-neutral latency improvement is surfaced
in 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 U-curve is workload-specific;
guessing from "128 MB is cheapest" produces false positives on
CPU-bound workloads.
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-increasing memory upsize as "cost savings."
Surface the latency improvement explicitly. If the upsize increases
cost, set Monthly saving: $0.00 (or negative) and surface the
latency delta. Verdict is FURTHER_OPTIMIZATION_AVAILABLE ONLY if
the operator explicitly prioritises latency over cost.
NEVER round intermediate formula steps differently from the final
figure. Compute at full precision, round only the displayed result.
NEVER omit the POWER_TUNING_RESULTS table from a
FURTHER_OPTIMIZATION_AVAILABLE verdict. The table must show at least
the current memory, the cost-optimal memory, and the latency-optimal
memory with concrete $/invocation and p99 latency values.
Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math
Every field below is internally consistent. Copy this shape exactly.
Additional full worked examples are in
references/lambda-memory-worked-examples.md.
TARGET: order-enrichment-api (arn:aws:lambda:us-east-1:123456789012:function:order-enrichment-api)
VERDICT: FURTHER_OPTIMIZATION_AVAILABLE
REASON: Python function at 128 MB averaging 5000 ms is CPU-bound
(cpu_total_time / Duration = 0.96). Power Tuning U-curve shows
cost-optimal at 256 MB where duration drops to 1100 ms — the per-
invocation cost drops 54.7% because the duration reduction more than
offsets the higher per-GB-second rate. Invocations are 47M/month so
the saving compounds. Latency-optimal at 3008 MB (220 ms p99) is
surfaced separately for operator choice.
POWER_TUNING_RESULTS:
| Memory | Avg Duration | p99 Duration | $/Invocation | Tag |
|----------|-------------|-------------|-------------|----------------|
| 128 MB | 5000 ms | 6200 ms | $0.0000106 | current |
| 256 MB | 1100 ms | 1400 ms | $0.0000048 | cost-optimal |
| 512 MB | 650 ms | 800 ms | $0.0000056 | |
| 1024 MB | 400 ms | 500 ms | $0.0000069 | |
| 2048 MB | 280 ms | 350 ms | $0.0000095 | |
| 3008 MB | 220 ms | 280 ms | $0.0000112 | latency-optimal|
COST_COMPARISON:
Current: 128 MB at 5000 ms → $0.0000106/inv × 47M/month = $499.14/month
Proposed: 256 MB at 1100 ms → $0.0000048/inv × 47M/month = $224.66/month
Saving: $274.48/month (54.9%) — cost-optimal at 256 MB
Latency: p99 drops from 6200 ms to 1400 ms (77% reduction)
RECOMMENDATION:
Current: 128 MB at 5000 ms avg, x86_64, on-demand, InitDuration 1800 ms
Proposed: 256 MB at 1100 ms avg, x86_64, on-demand, InitDuration 1800 ms
Dimensions changed: memory (Step 1)
Dimensions checked: memory → (upsize to cost-optimal) pc_memory ✓ (no PC)
init ✓ (no SnapStart for Python) efs_container_layers ✓ (zip, no EFS)
tmp ✓ (no /tmp overflow) architecture ✓ (x86_64, ARM eval deferred)
Confidence: HIGH — Power Tuning measured the U-curve empirically across
6 memory values; cpu_total_time / Duration = 0.96 confirms CPU-bound.
ESTIMATED_SAVINGS:
Current monthly: $499.14
compute: 47M × 5.0 × 0.125 × $0.0000166667 = $489.74
requests: 47M × $0.0000002 = $9.40
PC: $0 (on-demand)
Projected monthly: $224.66
compute: 47M × 1.1 × 0.25 × $0.0000166667 = $215.26
requests: 47M × $0.0000002 = $9.40
PC: $0 (on-demand)
Monthly saving: $274.48 ($499.14 − $224.66 = $274.48 ✓)
Annual saving: $3,293.76
Latency delta: p99 drops from 6200 ms to 1400 ms (77% reduction)
MIGRATION_STEPS:
1. Run Power Tuning to confirm the U-curve:
aws stepfunctions start-execution \
--state-machine-arn arn:aws:states:us-east-1:123456789012:stateMachine:powerTuning \
--input '{"lambda":{"resource":"arn:aws:lambda:us-east-1:123456789012:function:order-enrichment-api","num":5},"power":{"values":[128,256,512,1024,2048,3008]}}'
2. Update memory to 256 MB (cost-optimal):
aws lambda update-function-configuration \
--function-name order-enrichment-api --memory-size 256 --region us-east-1
3. Publish a version and test via staging alias:
aws lambda publish-version --function-name order-enrichment-api
aws lambda update-alias --function-name order-enrichment-api \
--name staging --function-version 2
4. Monitor Duration and Errors for 7 days post-change:
aws cloudwatch get-metric-statistics --namespace AWS/Lambda \
--metric-name Duration --dimensions Name=FunctionName,Value=order-enrichment-api \
--start-time $(date -u -v-7d +%Y-%m-%dT%H:%M:%S) \
--end-time $(date -u +%Y-%m-%dT%H:%M:%S) --period 86400 --statistics Average
CONFIRM: About to update-function-configuration on order-enrichment-api
(128 MB → 256 MB). Monthly saving $274.48 (54.9%); p99 latency
improvement 77%. Proceed? (yes/no)
Self-check before emit:
Verdict semantics
| Verdict |
When to emit |
FURTHER_OPTIMIZATION_AVAILABLE |
At least one dimension has a concrete, savings-bearing OR latency-improving recommendation. |
OPTIMIZED |
Either (a) all dimensions pass (memory at Power Tuning optimum, on arm64, no init waste, no /tmp-memory coupling), OR (b) a change was applied and verified this session. |
NEED_MORE_INFO |
Data gate failed: metrics absent, window < 14 days, 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 AND Latency delta is
zero for every dimension, verdict MUST be OPTIMIZED, never
FURTHER_OPTIMIZATION_AVAILABLE. Exception: a latency improvement
without cost change is surfaced in Latency delta, 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 recommend a memory upsize as "cost savings" without
verifying that the duration reduction offsets the higher per-GB-
second rate. A memory upsize that increases total cost is a
latency improvement, not a cost saving. Surface both numbers.
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. Re-run Power Tuning after
migration — the U-curve shifts.
NEVER increase MemorySize to accommodate /tmp overflow without
considering ephemeral storage. Decoupling /tmp via
--ephemeral-storage is usually cheaper than increasing MemorySize.
NEVER enable SnapStart without publishing a version and pointing
an alias at it. SnapStart applies to published versions only;
$LATEST does not benefit from SnapStart.
Extended anti-patterns in references/lambda-memory-worked-examples.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. Re-run Power Tuning after migration.
- SnapStart requires versioned aliases. Ensure alias points at a
version before enabling. Java-only.
- Memory reduction increases OOM risk. Verify
memory_used peak
(Lambda Insights) is below 80% of the proposed MemorySize.
- PC memory reduction is immediate. Function must handle the new
memory without OOM or timeout.
- EFS removal may break the function. Verify no code paths reference
the mount point before removing.
- 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)
Moved verbatim to references/advanced-patterns.md — load on demand.
References
references/lambda-memory-and-power-tuning.md — pricing tables,
memory-to-CPU mapping, Power Tuning deployment guide, ARM64 vs x86_64
memory-to-CPU ratio comparison, EFS/container/Layers overhead baselines,
ephemeral storage pricing, SnapStart runtime support matrix, regional
pricing multipliers.
references/lambda-memory-worked-examples.md — full worked examples
(memory upsize for CPU-bound, memory downsize for I/O-bound, PC memory
cascading, ARM64 re-tuning, /tmp decoupling, already-optimized, NEED_
MORE_INFO, end-to-end walkthrough, extended NEVER list, edge cases).
References (load on demand)
- references/advanced-patterns.md — Step-0 gotchas, data-quality short-circuits, U-curve and PC pricing math, overhead baselines, recent AWS features
- references/diagnostic-commands.md — data-gate CLI sources, SnapStart enablement, /tmp decoupling, arm64 re-tuning commands
- references/lambda-memory-worked-examples.md — full worked examples plus the canonical output template and output-order decision tree
- references/lambda-memory-and-power-tuning.md — pricing tables, Power Tuning deployment guide, memory-to-CPU mapping
Domain
AWS CloudOps / Lambda Serverless Memory Optimization & FinOps.
AWS documentation
1---2name: lambda-memory-optimizer3description: 'Optimises AWS Lambda memory configuration across six dimensions: memory-to-CPU proportional allocation (Lambda couples vCPU to memory at 1769 MB = 1 vCPU; cost DECREASES with more memory IF CPU-bound because faster execution offsets higher per-100ms rate), AWS Lambda Power Tuning methodology (open-source Step Functions state machine that empirically finds the Pareto frontier of cost-vs-latency across memory values), cost-optimal vs latency-optimal memory setting selection (the cheapest memory may not be the fastest; surface both numbers and let the operator choose), provisioned concurrency memory reservation (PC bills per GB-second of provisioned capacity regardless of invocations — memory size scales the idle bill linearly), ARM64 Graviton2 memory-to-CPU ratio differences (ARM64 has a different memory-to-vCPU curve than x86_64; re-run Power Tuning after architecture migration), EFS memory overhead (EFS mounts add ~64 MB resident memory; factor into the headroom calculation), init phase memory / cold star...'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 Power Tuning results. Live-account optimization uses aws lambda get-function-configuration, aws cloudwatch get-metric-statistics (Duration, Invocations, memory_used via LambdaInsights, InitDuration, ConcurrentExecutions), aws lambda list-provisioned-concurrency-configs, aws lambda get-event-source-mapping, aws compute-optimizer...6metadata:7 source: https://skillmd.com/skills/jhkchan/lambda-memory-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 | FURTHER_OPTIMIZATION_AVAILABLE19 when_to_use: Optimising Lambda memory configuration, planning a Power Tuning sweep, selecting cost-optimal vs latency-optimal memory, sizing provisioned concurrency memory reservation, evaluating ARM64 Graviton2 memory-to-CPU ratio, accounting for EFS/container-image/Layers memory overhead, tuning SnapStart init memory, sizing /tmp storage, or running a Lambda memory FinOps review.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), Lambda invocation/duration/cold-start troubleshooting (use lambda-invocation-troubleshooter or lambda-cold-start-optimizer), or full Lambda cost optimization across non-memory dimensions (use lambda-cost-optimizer). This skill focuses on the memory-allocation decision specifically.21 activation_triggers: optimise Lambda memory, Lambda memory tuning, Lambda Power Tuning, Lambda cost-optimal memory, Lambda latency-optimal memory, Lambda U-curve, Lambda memory CPU-bound, Lambda memory I/O-bound, Lambda memory Pareto frontier, Lambda memory Compute Optimizer, Lambda provisioned concurrency memory, Lambda ARM64 Graviton2 memory, Lambda SnapStart init memory, Lambda EFS memory overhead, Lambda container image memory, Lambda Layers memory, Lambda /tmp storage allocation, Lambda memory FinOps, Lambda memory-to-CPU ratio22 invocation_schema: 'Input: either (a) a function identifier + live-account context, (b) a Power Tuning result document, OR (c) CloudWatch Lambda Insights metrics (Duration, Invocations, memory_used, InitDuration) 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, FURTHER_OPTIMIZATION_AVAILABLE.'23 invocation_example: "# Minimal valid input (offline finding classification):\nFunctionName: order-enrichment-api\nRuntime: python3.12\nMemorySize: 128 MB\nArchitecture: x86_64\nRegion: us-east-1\nPricing: on-demand (no provisioned concurrency)\nMetrics (last 30 days):\n - Duration avg: 5000 ms, p95: 6200 ms\n - Invocations: 47,000,000/month\n - Errors: 45 (0.000096%)\n - Memory utilization: avg 38 MB (30% of 128 MB)\n - InitDuration: 1800 ms (cold start)\nLambda Insights:\n - memory_used: avg 38 MB, peak 52 MB\n - cpu_total_time: 4800 ms (96% of Duration)\nCompute Optimizer finding: Overprovisioned (memory)\nPower Tuning result:\n - Tested: [128, 256, 512, 1024, 2048, 3008]\n - Cheapest (cost-optimal): 512 MB at 950 ms\n - Fastest: 3008 MB at 410 ms\n - URL: https://lambda-power-tuning.show/#example\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 optimization, memory configuration, Power Tuning, Pareto frontier, cost-optimal memory, latency-optimal memory, CPU-bound, I/O-bound, U-curve, provisioned concurrency, ARM64, Graviton2, memory-to-CPU ratio, SnapStart, cold start, init phase, EFS, container image, Lambda Layers, /tmp storage, CloudWatch Duration, Lambda Insights, FinOps, Compute Optimizer27 tags: lambda, compute, serverless, cost-optimization, finops, memory-tuning, power-tuning28---2930# Lambda Memory Optimizer3132## What this skill does333435Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.363738## Quick navigation3940| Section | What it covers | When to jump here |41|---|---|---|42| Quick start | Four headline rules and the cost formula | First read |43| Mindset | Why the U-curve is the #1 lever | Understanding the approach |44| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a function |45| Pre-flight data gate | CloudWatch metrics, Power Tuning, Insights | Before any recommendation |46| Step 0 non-obvious behaviours | CPU coupling, ARM64 ratio, SnapStart, EFS | Edge cases |47| Step 1 Memory size (U-curve) | Power Tuning, cost-vs-latency tradeoff | The headline savings dimension |48| Step 2 Provisioned concurrency memory | PC idle bill scales with memory | Latency-sensitive APIs |49| Step 3 Init-phase memory | Cold start, SnapStart, lazy init | Slow init functions |50| Step 4 EFS / container / Layers overhead | Resident memory add-ons | Heavy dependency functions |51| Step 5 /tmp storage allocation | Decouple /tmp from memory budget | Functions with local scratch |52| Step 6 ARM64 memory-to-CPU ratio | Graviton2 re-tuning after migration | Architecture changes |53| Step 7 Impact estimation | The cost formula and worked math | Every recommendation |54| Output format | VERDICT block + worked examples | Emitting the result |55| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |56| Pre-flight safety checks | CONFIRM gate, version publish, alias | Before any apply CLI |5758## Quick start5960Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.616263## Mindset646566Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.676869## Quick reference — verdict thresholds7071| Observation (14-30 day window) | Verdict | Recommendation |72|---|---|---|73| Power Tuning `cheapest` differs from current MemorySize by ≥ 1 step AND projected compute saving > 0 | **FURTHER_OPTIMIZATION_AVAILABLE** (memory) | Step 1 — set MemorySize to Power Tuning optimum |74| Power Tuning `cheapest` == current BUT `fastest` is materially faster AND operator prioritises latency | **FURTHER_OPTIMIZATION_AVAILABLE** (memory — latency) | Step 1 — set MemorySize to `fastest`; surface cost-neutral or cost-increasing delta |75| Provisioned concurrency configured AND MemorySize > Power Tuning `cheapest` (oversized memory inflating PC idle bill) | **FURTHER_OPTIMIZATION_AVAILABLE** (PC memory) | Step 2 — right-size memory first, then re-evaluate PC |76| InitDuration > 1 s on cold starts AND no SnapStart AND runtime is Java | **FURTHER_OPTIMIZATION_AVAILABLE** (init) | Step 3 — enable SnapStart, lazy init, connection reuse |77| EFS mounted AND resident memory > 64 MB baseline AND MemorySize at minimum | **FURTHER_OPTIMIZATION_AVAILABLE** (EFS) | Step 4 — increase MemorySize to accommodate EFS baseline OR remove EFS |78| Container image deployment AND MemorySize < 256 MB | **FURTHER_OPTIMIZATION_AVAILABLE** (container) | Step 4 — increase to 256 MB minimum |79| /tmp allocation > 512 MB AND MemorySize at minimum (function using memory as /tmp overflow) | **FURTHER_OPTIMIZATION_AVAILABLE** (/tmp) | Step 5 — decouple /tmp via `--ephemeral-storage` |80| Architecture = x86_64 AND runtime is ARM-compatible | **FURTHER_OPTIMIZATION_AVAILABLE** (architecture) | Step 6 — migrate to arm64 AND re-run Power Tuning |81| Compute Optimizer finding `Optimized` + Power Tuning confirms current memory + arm64 + no init waste | **OPTIMIZED** | None — continue monitoring |82| Duration/Invocations metrics absent or window < 14 days | **NEED_MORE_INFO** | Pull 14-30 day CloudWatch data, re-evaluate |83| All dimensions verified AND a change was applied and confirmed this session | **OPTIMIZED** | Emit post-state verification |8485## Pre-flight: data gate (run before any optimization decision)8687Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.888990Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.91929394Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.959697## Process — Memory optimization logic (apply in order)9899### Step 0: Non-obvious behaviours that change the recommendation100101Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.102103104### Step 1: Memory size (the U-curve)105106Memory size is the primary lever because of the U-curve: as memory107increases, CPU increases proportionally, and CPU-bound workloads see108disproportionate duration reduction.109110111Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.112113114**Decision gate after Power Tuning:**115116| Power Tuning result vs current MemorySize | Verdict | Action |117|---|---|---|118| `cheapest` < current AND projected saving > 0 | **FURTHER_OPTIMIZATION_AVAILABLE** (downsize) | Set MemorySize to `cheapest`. Verify duration stays within SLO. |119| `cheapest` > current AND projected saving > 0 | **FURTHER_OPTIMIZATION_AVAILABLE** (upsize) | Set MemorySize to `cheapest`. Function was CPU-bound. |120| `cheapest` == current BUT `fastest` is materially faster | **FURTHER_OPTIMIZATION_AVAILABLE** (latency) | Surface the latency improvement; let operator choose. May be cost-increasing. |121| `cheapest` == current AND `fastest` == current | No memory finding | Proceed to other dimensions. |122123124Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.125126127### Step 2: Provisioned concurrency memory footprint128129130Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.131132133**Decision tree:**134```135Is provisioned concurrency configured?136├── NO → PC memory check passes.137└── YES → Is MemorySize > Power Tuning `cheapest`?138 ├── NO → Memory already right-sized; PC idle is justified.139 └── YES → **FURTHER_OPTIMIZATION_AVAILABLE** (PC memory)140 Right-size memory FIRST, then re-evaluate PC count.141```142143144Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.145146147### Step 3: Init-phase memory (cold start)148149Init-phase memory is the memory consumed during the function's150initialization (before the handler runs). High init memory causes slow151cold starts and, in extreme cases, OOM during init.152153**Init-waste checklist:**154155| Symptom | Fix |156|---|---|157| InitDuration > 1 s (cold start) | Move init OUTSIDE the handler. Reuse HTTP clients, DB connections. |158| InitDuration > 3 s on Java | Enable SnapStart, publish a version. |159| InitDuration spikes after Layers added | Audit Layers — each is a separate zip extraction. Reduce layer count. |160| InitDuration spikes after dependency update | Trim unused deps. Use `pip install --no-deps`. |161| OOM during init (rare) | Increase MemorySize to accommodate peak init allocation. |162163164Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.165166167### Step 4: EFS, container image, and Layers memory overhead168169Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.170171172### Step 5: /tmp storage allocation173174Since 2022, `/tmp` storage is configured independently of MemorySize175via `--ephemeral-storage` (up to 10 GB). Bills separately at176$0.0000000625/MB-second.177178**Decision tree:**179```180Is the function using memory as /tmp overflow (high MemorySize, low181runtime memory_used)?182├── NO → /tmp check passes.183└── YES → **FURTHER_OPTIMIZATION_AVAILABLE** (/tmp)184 Decouple: reduce MemorySize to runtime needs, allocate /tmp185 via --ephemeral-storage.186```187188189Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.190191192### Step 6: ARM64 (Graviton2) memory-to-CPU ratio193194ARM64 has a different memory-to-vCPU ratio than x86_64. After migrating195architecture, the U-curve minimum shifts.196197198Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.199200201202Moved verbatim to [references/diagnostic-commands.md](references/diagnostic-commands.md) — load on demand.203204205206Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.207208209### Step 7: Impact estimation210211Compute the monthly savings for each recommendation:212213214Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.215216217### Step 8: Final verdict218219- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.220- All dimensions pass AND function is on arm64 AND no init waste AND no221 /tmp-memory coupling → **OPTIMIZED**.222- Change applied and verified this session → **OPTIMIZED** (post-state).223- Data insufficient (Duration absent, window < 14 days) →224 **NEED_MORE_INFO**.225226Never emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging227every `NEED_MORE_INFO`/`BLOCKED` gate.228229## Output format230231Moved verbatim to [references/lambda-memory-worked-examples.md](references/lambda-memory-worked-examples.md) — load on demand.232233234235Moved verbatim to [references/lambda-memory-worked-examples.md](references/lambda-memory-worked-examples.md) — load on demand.236237238Full worked examples (memory upsize, memory downsize, PC memory239cascading, ARM64 re-tuning, already-optimized, end-to-end walkthrough)240are in `references/lambda-memory-worked-examples.md`.241242## STRICT output contract243244The rules below are hard constraints. Violating any one produces a245misclassification or an arithmetic contradiction that breaks downstream246FinOps automation. Self-check EVERY emitted block against these rules247before returning the response.248249### Required output structure250251Every response MUST be a single block using these literal labels, in252this order. Do NOT substitute markdown headings, camelCase, or bold253variants.254255```text256TARGET: <function-name>257VERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE258REASON: <1-2 sentences naming the recommendation and supporting data>259POWER_TUNING_RESULTS:260 | Memory | Avg Duration | p99 Duration | $/Invocation | Tag |261 |----------|-------------|-------------|-------------|----------------|262 | <MB> | <ms> | <ms> | $<amount> | current |263 | <MB> | <ms> | <ms> | $<amount> | cost-optimal |264 | <MB> | <ms> | <ms> | $<amount> | latency-optimal|265COST_COMPARISON:266 Current: <MB> at <ms> avg → $<amount>/invocation × <N>/month = $<amount>/month267 Proposed: <MB> at <ms> avg → $<amount>/invocation × <N>/month = $<amount>/month268 Saving: $<amount>/month (<pct>%)269 Latency: p99 drops from <ms> to <ms> (<pct>% reduction)270RECOMMENDATION:271 Current: <memory> MB at <avg duration> ms, <architecture>, <concurrency>, <init>272 Proposed: <memory> MB at <projected duration> ms, <architecture>, <concurrency>, <init>273 Dimensions changed: <memory | pc_memory | init | efs_container_layers | tmp | architecture>274 Dimensions checked: <list ALL six, each ✓ (no finding) or → (finding)>275 Confidence: <HIGH/MEDIUM/LOW> — <one-line rationale>276ESTIMATED_SAVINGS:277 Current monthly: $<amount> ← MUST show compute + requests + PC subtotals278 Projected monthly: $<amount>279 Monthly saving: $<amount> ← MUST equal Current − Projected, 2 decimals280 Annual saving: $<amount> ← MUST equal Monthly × 12281 Latency delta: <p99 duration change> ms (<percentage>%)282MIGRATION_STEPS:283 1. <specific action with CLI command>284 2. <verification step>285CONFIRM: <confirmation prompt text>286```287288### FORBIDDEN output patterns2892901. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with291 `Monthly saving: $0.00` AND no latency improvement.** If every292 dimension nets zero cost delta AND zero latency delta, the verdict293 MUST be `OPTIMIZED`. A cost-neutral latency improvement is surfaced294 in `Latency delta`, NOT as a dollar saving.2952962. **NEVER show savings math that does not balance.**297 `Current monthly − Projected monthly` MUST equal `Monthly saving`,298 rounded to 2 decimal places.2993003. **NEVER emit scratch lines** ("WAIT — recompute", "Hmm, let me redo",301 "corrected:") in the output. Finalize the math before emitting.3023034. **NEVER recommend a memory change without citing Power Tuning or304 Compute Optimizer evidence.** The U-curve is workload-specific;305 guessing from "128 MB is cheapest" produces false positives on306 CPU-bound workloads.3073085. **NEVER omit a dimension from the RECOMMENDATION block.** The309 `Dimensions checked` line MUST list all six dimensions, each marked310 ✓ (no finding) or → (finding).3113126. **NEVER present a cost-increasing memory upsize as "cost savings."**313 Surface the latency improvement explicitly. If the upsize increases314 cost, set `Monthly saving: $0.00` (or negative) and surface the315 latency delta. Verdict is `FURTHER_OPTIMIZATION_AVAILABLE` ONLY if316 the operator explicitly prioritises latency over cost.3173187. **NEVER round intermediate formula steps differently from the final319 figure.** Compute at full precision, round only the displayed result.3203218. **NEVER omit the POWER_TUNING_RESULTS table from a322 FURTHER_OPTIMIZATION_AVAILABLE verdict.** The table must show at least323 the current memory, the cost-optimal memory, and the latency-optimal324 memory with concrete $/invocation and p99 latency values.325326### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math327328Every field below is internally consistent. Copy this shape exactly.329Additional full worked examples are in330`references/lambda-memory-worked-examples.md`.331332```text333TARGET: order-enrichment-api (arn:aws:lambda:us-east-1:123456789012:function:order-enrichment-api)334VERDICT: FURTHER_OPTIMIZATION_AVAILABLE335REASON: Python function at 128 MB averaging 5000 ms is CPU-bound336 (cpu_total_time / Duration = 0.96). Power Tuning U-curve shows337 cost-optimal at 256 MB where duration drops to 1100 ms — the per-338 invocation cost drops 54.7% because the duration reduction more than339 offsets the higher per-GB-second rate. Invocations are 47M/month so340 the saving compounds. Latency-optimal at 3008 MB (220 ms p99) is341 surfaced separately for operator choice.342POWER_TUNING_RESULTS:343 | Memory | Avg Duration | p99 Duration | $/Invocation | Tag |344 |----------|-------------|-------------|-------------|----------------|345 | 128 MB | 5000 ms | 6200 ms | $0.0000106 | current |346 | 256 MB | 1100 ms | 1400 ms | $0.0000048 | cost-optimal |347 | 512 MB | 650 ms | 800 ms | $0.0000056 | |348 | 1024 MB | 400 ms | 500 ms | $0.0000069 | |349 | 2048 MB | 280 ms | 350 ms | $0.0000095 | |350 | 3008 MB | 220 ms | 280 ms | $0.0000112 | latency-optimal|351COST_COMPARISON:352 Current: 128 MB at 5000 ms → $0.0000106/inv × 47M/month = $499.14/month353 Proposed: 256 MB at 1100 ms → $0.0000048/inv × 47M/month = $224.66/month354 Saving: $274.48/month (54.9%) — cost-optimal at 256 MB355 Latency: p99 drops from 6200 ms to 1400 ms (77% reduction)356RECOMMENDATION:357 Current: 128 MB at 5000 ms avg, x86_64, on-demand, InitDuration 1800 ms358 Proposed: 256 MB at 1100 ms avg, x86_64, on-demand, InitDuration 1800 ms359 Dimensions changed: memory (Step 1)360 Dimensions checked: memory → (upsize to cost-optimal) pc_memory ✓ (no PC)361 init ✓ (no SnapStart for Python) efs_container_layers ✓ (zip, no EFS)362 tmp ✓ (no /tmp overflow) architecture ✓ (x86_64, ARM eval deferred)363 Confidence: HIGH — Power Tuning measured the U-curve empirically across364 6 memory values; cpu_total_time / Duration = 0.96 confirms CPU-bound.365ESTIMATED_SAVINGS:366 Current monthly: $499.14367 compute: 47M × 5.0 × 0.125 × $0.0000166667 = $489.74368 requests: 47M × $0.0000002 = $9.40369 PC: $0 (on-demand)370 Projected monthly: $224.66371 compute: 47M × 1.1 × 0.25 × $0.0000166667 = $215.26372 requests: 47M × $0.0000002 = $9.40373 PC: $0 (on-demand)374 Monthly saving: $274.48 ($499.14 − $224.66 = $274.48 ✓)375 Annual saving: $3,293.76376 Latency delta: p99 drops from 6200 ms to 1400 ms (77% reduction)377MIGRATION_STEPS:378 1. Run Power Tuning to confirm the U-curve:379 aws stepfunctions start-execution \380 --state-machine-arn arn:aws:states:us-east-1:123456789012:stateMachine:powerTuning \381 --input '{"lambda":{"resource":"arn:aws:lambda:us-east-1:123456789012:function:order-enrichment-api","num":5},"power":{"values":[128,256,512,1024,2048,3008]}}'382 2. Update memory to 256 MB (cost-optimal):383 aws lambda update-function-configuration \384 --function-name order-enrichment-api --memory-size 256 --region us-east-1385 3. Publish a version and test via staging alias:386 aws lambda publish-version --function-name order-enrichment-api387 aws lambda update-alias --function-name order-enrichment-api \388 --name staging --function-version 2389 4. Monitor Duration and Errors for 7 days post-change:390 aws cloudwatch get-metric-statistics --namespace AWS/Lambda \391 --metric-name Duration --dimensions Name=FunctionName,Value=order-enrichment-api \392 --start-time $(date -u -v-7d +%Y-%m-%dT%H:%M:%S) \393 --end-time $(date -u +%Y-%m-%dT%H:%M:%S) --period 86400 --statistics Average394CONFIRM: About to update-function-configuration on order-enrichment-api395 (128 MB → 256 MB). Monthly saving $274.48 (54.9%); p99 latency396 improvement 77%. Proceed? (yes/no)397```398399**Self-check before emit:**400- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?401- [ ] `Monthly saving × 12 == Annual saving`?402- [ ] All six dimensions listed in `Dimensions checked`?403- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?404- [ ] No scratch/recompute text in the block?405- [ ] If `Monthly saving == $0.00`, is there a non-zero `Latency delta`?406407## Verdict semantics408409| Verdict | When to emit |410|---|---|411| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing OR latency-improving recommendation. |412| `OPTIMIZED` | Either (a) all dimensions pass (memory at Power Tuning optimum, on arm64, no init waste, no /tmp-memory coupling), OR (b) a change was applied and verified this session. |413| `NEED_MORE_INFO` | Data gate failed: metrics absent, window < 14 days, Compute Optimizer stale with no CloudWatch fallback. |414| `BLOCKED` | Hard precondition prevents evaluation: function State != Active, IAM denies lambda:GetFunction. |415416**Zero-savings rule:** If MONTHLY_SAVING == $0.00 AND Latency delta is417zero for every dimension, verdict MUST be `OPTIMIZED`, never418`FURTHER_OPTIMIZATION_AVAILABLE`. Exception: a latency improvement419without cost change is surfaced in `Latency delta`, not as dollar420savings.421422## Anti-Patterns — NEVER (top 5)4234241. **NEVER recommend a memory change without Power Tuning or Compute425 Optimizer evidence.** The U-curve is workload-specific; guessing426 from "128 MB is cheapest" produces false positives on CPU-bound427 workloads.4284292. **NEVER recommend a memory upsize as "cost savings" without430 verifying that the duration reduction offsets the higher per-GB-431 second rate.** A memory upsize that increases total cost is a432 latency improvement, not a cost saving. Surface both numbers.4334343. **NEVER recommend ARM64 migration without verifying the runtime and435 dependencies are ARM-compatible.** An ARM migration that breaks at436 runtime is worse than no migration. Re-run Power Tuning after437 migration — the U-curve shifts.4384394. **NEVER increase MemorySize to accommodate /tmp overflow without440 considering ephemeral storage.** Decoupling /tmp via441 `--ephemeral-storage` is usually cheaper than increasing MemorySize.4424435. **NEVER enable SnapStart without publishing a version and pointing444 an alias at it.** SnapStart applies to published versions only;445 `$LATEST` does not benefit from SnapStart.446447Extended anti-patterns in `references/lambda-memory-worked-examples.md`.448449## Pre-flight safety checks (run before any remediation CLI)450451- **MANDATORY CONFIRMATION GATE.** Before any state-changing operation,452 emit and await operator approval. Do NOT execute until confirmed.453- **Publish a version before changing the alias.** Never point454 production at `$LATEST`.455- **Test the new memory setting before cutover.** Validate via staging456 alias or weighted routing.457- **Verify ARM64 compatibility before architecture migration.** Native458 dependencies may fail at runtime. Re-run Power Tuning after migration.459- **SnapStart requires versioned aliases.** Ensure alias points at a460 version before enabling. Java-only.461- **Memory reduction increases OOM risk.** Verify `memory_used` peak462 (Lambda Insights) is below 80% of the proposed MemorySize.463- **PC memory reduction is immediate.** Function must handle the new464 memory without OOM or timeout.465- **EFS removal may break the function.** Verify no code paths reference466 the mount point before removing.467- **Power Tuning invokes the function repeatedly.** Ensure function is468 idempotent and downstream tolerates test load.469- **Bulk-operation limit:** Process at most 5 functions per batch. Sort470 by estimated savings, verify each batch before proceeding. Abort if471 any function shows increased errors or duration post-change.472473## Recent AWS features (2024-2026)474475Moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md) — load on demand.476477478## References479480- `references/lambda-memory-and-power-tuning.md` — pricing tables,481 memory-to-CPU mapping, Power Tuning deployment guide, ARM64 vs x86_64482 memory-to-CPU ratio comparison, EFS/container/Layers overhead baselines,483 ephemeral storage pricing, SnapStart runtime support matrix, regional484 pricing multipliers.485- `references/lambda-memory-worked-examples.md` — full worked examples486 (memory upsize for CPU-bound, memory downsize for I/O-bound, PC memory487 cascading, ARM64 re-tuning, /tmp decoupling, already-optimized, NEED_488 MORE_INFO, end-to-end walkthrough, extended NEVER list, edge cases).489490491## References (load on demand)492493- [references/advanced-patterns.md](references/advanced-patterns.md) — Step-0 gotchas, data-quality short-circuits, U-curve and PC pricing math, overhead baselines, recent AWS features494- [references/diagnostic-commands.md](references/diagnostic-commands.md) — data-gate CLI sources, SnapStart enablement, /tmp decoupling, arm64 re-tuning commands495- [references/lambda-memory-worked-examples.md](references/lambda-memory-worked-examples.md) — full worked examples plus the canonical output template and output-order decision tree496- [references/lambda-memory-and-power-tuning.md](references/lambda-memory-and-power-tuning.md) — pricing tables, Power Tuning deployment guide, memory-to-CPU mapping497498## Domain499500AWS CloudOps / Lambda Serverless Memory Optimization & FinOps.501502## AWS documentation503504- **AWS Lambda Developer Guide** — https://docs.aws.amazon.com/lambda/latest/dg/welcome.html505- **AWS Lambda pricing** — https://aws.amazon.com/lambda/pricing/506- **AWS Lambda memory and CPU** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html507- **Lambda SnapStart** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-snapstart.html508- **Lambda provisioned concurrency** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-concurrency.html509- **Lambda ephemeral storage** — https://docs.aws.amazon.com/lambda/latest/dg/configuration-ephemeral-storage.html510- **Lambda Layers** — https://docs.aws.amazon.com/lambda/latest/dg/chapter-layers.html511- **AWS Lambda Power Tuning (open source)** — https://github.com/alexcasalboni/aws-lambda-power-tuning512- **AWS Compute Optimizer — Lambda** — https://docs.aws.amazon.com/compute-optimizer/latest/ug/lambda.html513- **CloudWatch Lambda Insights** — https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html514- **AWS Well-Architected Framework — Cost Optimization** — https://docs.aws.amazon.com/wellarchitected/latest/cost-optimization-pillar/welcome.html