ELB Cost Optimizer
Activation
Activate this skill when the user reports Elastic Load Balancer cost
concerns. Trigger phrases: "optimise ELB cost", "ALB LCU analysis",
"load balancer cost", "idle load balancer", "CLB to ALB migration
cost", "target group consolidation", "multi-path routing", "reduce
ALB count", "cross-zone load balancing cost", "LCU dimensions", "ELB
FinOps", "reduce load balancer bill".
Mindset
One-line takeaway: ELB cost is driven by the highest of four LCU
dimensions, not the sum. ALB charges per LCU-hour where 1 LCU is the
max of: 25 new connections/sec, 3000 active connections, 1 GB/hour
processed bytes, or 1000 rule evaluations/sec. You pay for the peak
dimension. The optimal ALB minimizes the peak dimension's value while
consolidating ALB instances via multi-path routing. Start with idle
detection, then LCU optimization, then consolidation.
Three facts make ELB cost optimization different from generic
infrastructure tuning:
- LCU is a max-function, not a sum. If your ALB does 2000 new
connections/sec (80 LCUs) but only 0.1 GB/hour processed (0.1 LCU),
you pay for 80 LCUs. The other three dimensions are free but wasted.
Optimization means reducing the peak dimension — not the average.
- CLBs are billed per-hour plus per-GB, with no LCU concept. A CLB
at $0.025/hour ($18.25/month) seems cheaper than an ALB at
$0.0225/hour ($16.43/month) — but CLBs lack path-based routing,
have lower performance, and cannot be consolidated. Migrating CLBs
to ALBs enables multi-path routing, which can consolidate 5 CLBs
into 1 ALB, saving 80% of the per-hour cost.
- Cross-zone load balancing on NLBs incurs data transfer charges.
NLBs charge $0.01/GB for cross-zone traffic. ALBs include
cross-zone traffic in the LCU price. For high-traffic workloads,
this difference alone can make ALB cheaper than NLB.
Quick reference — load balancer pricing (us-east-1, 2026)
| Type |
Hourly rate |
LCU/GB rate |
Monthly base (730h) |
Best for |
| ALB |
$0.0225/h |
$0.008/LCU-h |
$16.43 |
HTTP/HTTPS, path routing |
| NLB |
$0.0225/h |
$0.006/GB processed |
$16.43 |
TCP/UDP, extreme perf |
| CLB |
$0.025/h |
$0.008/GB processed |
$18.25 |
Legacy only — migrate |
| Gateway LB |
$0.0125/h |
$0.0035/GB |
$9.13 |
Third-party security appliances |
Quick navigation
| Section |
Purpose |
| Step 0 |
Capture the ELB inventory and LCU metrics |
| Step 1 |
Classify the optimization category (A-G) |
| Step 2 |
IDLE_LB: detect and eliminate idle load balancers |
| Step 3 |
LCU_DIM: LCU dimension analysis and peak reduction |
| Step 4 |
CONSOLIDATION: multi-path routing to reduce ALB count |
| Step 5 |
CLB_MIGRATION: CLB-to-ALB/NLB cost savings |
| Step 6 |
DATA_TRANSFER: cross-zone and PrivateLink optimization |
| Step 7 |
Root-cause catalog (top patterns + canonical fixes) |
| Step 8 |
Verify the recommendation |
| Step 9 |
Decide VERDICT (OPTIMIZED / FURTHER_OPTIMIZATION_AVAILABLE) |
STRICT output contract
TARGET: <load balancer ARN or name> — <type, region>
VERDICT: FURTHER_OPTIMIZATION_AVAILABLE | OPTIMIZED
REASON: <summary of LCU analysis, idle detection, consolidation opportunities>
RECOMMENDATION:
1. <IDLE_LB recommendation: delete or consolidate idle LB>
2. <LCU_DIM recommendation: reduce peak LCU dimension>
3. <CONSOLIDATION recommendation: merge target groups via multi-path>
4. <CLB_MIGRATION recommendation: migrate CLB to ALB/NLB>
5. <DATA_TRANSFER recommendation: cross-zone or PrivateLink savings>
ESTIMATED_SAVINGS: $<monthly savings> ($<annual savings>)
ACTION_STEPS:
1. <specific step with AWS CLI or console action>
2. <verification step>
3. <rollback step>
NEVER
NEVER delete a load balancer without verifying it has zero
active traffic for at least 7 days. An "idle" ALB might serve a
rarely-used internal API, a disaster-recovery endpoint, or a
blue/green standby. Check Route 53 records, target group health
checks, and CloudWatch request count before deletion. Always tag
the LB for 7-day observation before deleting.
NEVER consolidate ALBs without verifying the TLS certificate
coverage. Multi-path routing requires a single TLS certificate that
covers all hostnames (via SAN or wildcard). If each ALB has a
separate certificate for a different domain, consolidation requires
a multi-domain certificate first. Forgetting this causes TLS
handshake failures after consolidation.
NEVER assume NLB is cheaper than ALB without calculating
cross-zone data transfer. NLB charges $0.01/GB for cross-zone
traffic. For a workload processing 5 TB/month cross-zone, that is
$51/month in data transfer alone — potentially making ALB cheaper
despite the higher per-GB rate. Always calculate the total cost
including data transfer.
NEVER migrate a CLB to an NLB when the workload uses HTTP
features. NLB operates at Layer 4 (TCP/UDP) and does not support
path-based routing, host-based routing, SSL termination with SNI,
or X-Forwarded-For headers. A CLB serving HTTP traffic should
migrate to ALB, not NLB. Migrating to NLB breaks HTTP features.
NEVER disable cross-zone load balancing on an ALB to save cost.
ALBs include cross-zone traffic in the LCU price — there is no
additional charge. Disabling cross-zone on an ALB has no cost
benefit and degrades availability. (On NLBs, disabling cross-zone
avoids the $0.01/GB charge but may cause uneven distribution.)
NEVER ignore access log costs for high-traffic ALBs. ALB access
logs are stored in S3 at $0.023/GB/month. A high-traffic ALB can
generate 100+ GB/month of access logs ($2.30/month + PUT request
costs). While not the primary cost driver, it compounds with
multiple ALBs. Consider sampling, lifecycle rules, or disabling
for non-production ALBs.
Process — ELB cost optimization decision tree (apply in order)
Step 0: Capture the ELB inventory and LCU metrics
Gather these inputs. Each step below branches on which are available.
| Signal |
Source |
Why required |
| Load balancer inventory |
aws elbv2 describe-load-balancers |
ALB/NLB configs, type, scheme, VPC |
| CLB inventory |
aws elb describe-load-balancers |
Legacy CLBs, migration candidates |
| Listeners and rules |
aws elbv2 describe-listeners, describe-rules |
Path-based routing, rule count |
| Target groups |
aws elbv2 describe-target-groups |
Consolidation opportunities |
| LCU metrics |
CloudWatch ConsumedLCUs, NewConnectionCount, ActiveConnectionCount, ProcessedBytes, RuleEvaluations |
LCU dimension analysis |
| Cost data |
aws ce get-cost-and-usage filtered by ELB |
Baseline spend |
If the user has not provided LB data or metrics, output:
Full NEED_MORE_INFO output block moved verbatim to references/worked-examples.md.
Load on demand when LB inventory or LCU metrics are missing.
Inventory / LCU capture CLI (describe-load-balancers, describe-load-balancers for CLB, 14-day ConsumedLCUs) moved verbatim to references/elb-optimization-commands.md.
Load on demand when gathering ELB inventory and LCU metrics.
Step 1: Identify the optimization category
| Category |
Signal |
Diagnostic step |
| A. IDLE_LB |
RequestCount < 100/day or zero healthy targets for 7+ days |
Step 2 |
| B. LCU_DIM |
ConsumedLCUs > 10 (indicating a high peak dimension) |
Step 3 |
| C. CONSOLIDATION |
Multiple ALBs in the same VPC serving related paths |
Step 4 |
| D. CLB_MIGRATION |
Any active CLB in the account |
Step 5 |
| E. DATA_TRANSFER |
NLB with cross-zone enabled + high GB processed |
Step 6 |
| F. ALREADY_OPTIMAL |
Right-sized, consolidated, no CLBs, LCU-efficient |
Verdict: OPTIMIZED |
| G. ACCESS_LOGS |
ALB access logs to S3 with no lifecycle policy |
Step 6 |
Apply A before B before C. Eliminating idle LBs is the easiest
win (delete = 100% savings). Then reduce LCU consumption. Then
consolidate remaining LBs. CLB migration is a larger project —
schedule it separately.
Step 2: IDLE_LB — detect and eliminate idle load balancers
An idle load balancer costs $16.43/month (ALB/NLB) or $18.25/month
(CLB) just for existing — plus LCU/GB charges for any minimal traffic.
Idle LBs are the #1 ELB cost waste.
Idle detection criteria:
| Metric |
Threshold |
Action |
| RequestCount (ALB) |
< 100/day for 7 days |
Candidate for deletion |
| ProcessedBytes (NLB) |
< 1 MB/day for 7 days |
Candidate for deletion |
| HealthyHostCount |
0 for 7 days |
Delete — no targets registered |
| NewConnectionCount |
< 50/day for 7 days |
Investigate; likely deletable |
Diagnostic commands:
Idle-detection CLI (RequestCount, HealthyHostCount, Route 53 record check) moved verbatim to references/elb-optimization-commands.md.
Load on demand when confirming a load balancer is idle before deletion.
Savings: deleting one idle ALB = $16.43/month + LCU charges.
Deleting 5 idle ALBs = $82+/month.
Step 3: LCU_DIM — LCU dimension analysis and peak reduction
ALB charges per LCU-hour. The LCU rate is $0.008/hour. The number of
LCUs is determined by the MAX of four dimensions:
LCU dimension definitions:
| Dimension |
1 LCU = |
Metric name |
| New connections |
25 new connections/sec |
NewConnectionCount |
| Active connections |
3000 active connections |
ActiveConnectionCount |
| Processed bytes |
1 GB/hour (2.78 Mbps) |
ProcessedBytes |
| Rule evaluations |
1000 rule evaluations/sec |
RuleEvaluations |
LCU calculation example:
| Dimension |
Observed value |
LCUs consumed |
| New connections |
500/sec |
500/25 = 20.0 LCU |
| Active connections |
15,000 |
15000/3000 = 5.0 LCU |
| Processed bytes |
2 GB/hour |
2/1 = 2.0 LCU |
| Rule evaluations |
3000/sec |
3000/1000 = 3.0 LCU |
| Peak (billed) |
|
20.0 LCU |
You pay for 20 LCU/hour = $0.16/hour = $116.80/month.
The peak dimension is "new connections" at 20 LCU. Reducing the
other three dimensions to zero saves nothing. The only way to reduce
the bill is to reduce new connections/sec.
Peak dimension reduction strategies:
| Peak dimension |
Reduction strategy |
Expected savings |
| New connections |
Connection reuse (HTTP keep-alive), merge endpoints |
30-60% |
| Active connections |
Reduce idle timeout (default 60s), connection draining |
10-30% |
| Processed bytes |
Response compression (gzip/brotli), reduce payload |
20-50% |
| Rule evaluations |
Reduce listener rules, simplify conditions |
10-40% |
Diagnostic commands for per-dimension analysis:
Per-dimension LCU metric CLI (NewConnectionCount, ActiveConnectionCount, ProcessedBytes, RuleEvaluations) moved verbatim to references/elb-optimization-commands.md.
Load on demand when identifying the peak LCU billing dimension.
Step 4: CONSOLIDATION — multi-path routing to reduce ALB count
Multiple ALBs in the same VPC serving related services can often be
consolidated into a single ALB using path-based and host-based
routing. Each consolidated ALB saves $16.43/month + its LCU charges.
Consolidation decision table:
| Scenario |
Consolidate? |
Method |
| 3 ALBs, each serving one microservice, same domain |
YES |
Host-based routing (one ALB, 3 listener rules on host header) |
| 5 ALBs, each serving one path of the same domain |
YES |
Path-based routing (one ALB, 5 listener rules on path pattern) |
| 2 ALBs in different VPCs (prod and staging) |
NO |
Different VPCs — keep separate |
| 1 ALB internal + 1 ALB internet-facing for the same service |
MAYBE |
Can use one ALB with both schemes? No — ALB scheme is immutable. Keep separate. |
| 4 ALBs with different TLS certificates for different domains |
YES (with SAN cert) |
Obtain a multi-domain certificate; consolidate with SNI |
Example: 3 ALBs -> 1 ALB consolidation
Before: 3 ALBs at $16.43/month each = $49.29/month + LCU charges.
After: 1 ALB at $16.43/month + LCU charges (merged).
Savings: $32.86/month minimum (just from per-hour charges).
Consolidation CLI (create-rule path-pattern rules for merged ALB) moved verbatim to references/elb-optimization-commands.md.
Load on demand when consolidating ALBs via multi-path routing.
Step 5: CLB_MIGRATION — CLB to ALB/NLB cost and feature savings
Classic Load Balancers (CLBs) are a legacy product with no new feature
development. They cost $0.025/hour ($18.25/month) plus $0.008/GB
processed. Migrating to ALB or NLB saves on per-hour cost AND enables
modern features (path routing, SNI, LCU-based pricing).
CLB migration decision:
| CLB workload |
Migrate to |
Rationale |
| HTTP/HTTPS traffic |
ALB |
Path routing, LCU pricing, SNI, better metrics |
| TCP/UDP traffic |
NLB |
Higher performance, static IPs, lower latency |
| Mixed HTTP + TCP |
ALB for HTTP, NLB for TCP |
Split services across two LB types |
CLB vs ALB cost comparison (1 TB/month processed):
| Type |
Hourly |
GB rate |
Monthly total |
Features |
| CLB |
$0.025/h |
$0.008/GB |
$18.25 + $8.00 = $26.25 |
Legacy, no path routing |
| ALB |
$0.0225/h |
LCU-based |
$16.43 + LCU charges |
Path routing, SNI, metrics |
| NLB |
$0.0225/h |
$0.006/GB |
$16.43 + $6.00 = $22.43 |
TCP/UDP, static IPs |
CLB migration CLI (describe CLB listeners, create target group, create replacement ALB) moved verbatim to references/elb-optimization-commands.md.
Load on demand when planning a CLB migration.
Step 6: DATA_TRANSFER — cross-zone and PrivateLink optimization
Cross-zone load balancing:
| LB type |
Cross-zone default |
Cost impact |
| ALB |
Always on (cannot disable) |
Included in LCU price — no extra charge |
| NLB |
Off by default (can enable) |
$0.01/GB for cross-AZ traffic when enabled |
For NLBs with cross-zone enabled, the cross-AZ data transfer can
exceed the NLB hourly cost. A 5 TB/month NLB with cross-zone enabled
incurs $51/month in data transfer alone.
PrivateLink cost reduction:
When ALBs serve traffic from clients in different VPCs, the traffic
crosses VPC peering or Transit Gateway, incurring data transfer
charges. PrivateLink (interface VPC endpoints) can reduce this cost
by keeping traffic within the AWS network.
Decision: NLB cross-zone on vs off:
| Scenario |
Recommendation |
Rationale |
| Targets evenly distributed across AZs |
OFF |
Each AZ handles its own traffic; no cross-AZ charge |
| Targets concentrated in one AZ |
ON |
Without cross-zone, one AZ is overloaded |
| Clients concentrated in one AZ |
OFF |
Route to local AZ targets; avoid cross-AZ |
| Unpredictable traffic distribution |
ON |
Better availability; accept cross-AZ charge |
Access log optimization:
ALB access logs are stored in S3 at $0.023/GB/month. For high-traffic
ALBs:
| ALB traffic |
Log volume/month |
S3 cost/month |
| 1M req/day |
~30 GB |
$0.69 |
| 10M req/day |
~300 GB |
$6.90 |
| 100M req/day |
~3000 GB |
$69.00 |
Recommendation: Apply S3 lifecycle rules to transition access logs
to Standard-IA after 30 days, Glacier after 90 days, and expire after
1 year. This reduces the effective S3 cost by 70-90%.
Step 7: Map to root-cause catalog
| # |
Pattern |
Category |
Fix |
Est. savings |
| 1 |
ALB with < 100 requests/day for 7+ days |
IDLE_LB |
Delete the ALB |
$16.43+/month per ALB |
| 2 |
ALB with 0 healthy targets for 7+ days |
IDLE_LB |
Delete; no traffic possible |
$16.43+/month |
| 3 |
Peak LCU dimension = new connections (keep-alive disabled) |
LCU_DIM |
Enable HTTP keep-alive on targets |
30-60% LCU reduction |
| 4 |
Peak LCU dimension = active connections (idle timeout 60s) |
LCU_DIM |
Reduce idle timeout to 30s |
10-30% LCU reduction |
| 5 |
Peak LCU dimension = processed bytes (no compression) |
LCU_DIM |
Enable gzip/brotli compression |
20-50% LCU reduction |
| 6 |
Peak LCU dimension = rule evaluations (too many rules) |
LCU_DIM |
Simplify rule conditions, reduce rules |
10-40% LCU reduction |
| 7 |
3+ ALBs in same VPC serving related paths |
CONSOLIDATION |
Multi-path routing into single ALB |
$32.86+/month per merged ALB |
| 8 |
Active CLB serving HTTP traffic |
CLB_MIGRATION |
Migrate to ALB |
$1.82+/month + feature gains |
| 9 |
NLB with cross-zone enabled + 5 TB/month |
DATA_TRANSFER |
Disable cross-zone if targets evenly distributed |
$51/month |
| 10 |
ALB access logs with no S3 lifecycle |
ACCESS_LOGS |
Add lifecycle: IA@30d, Glacier@90d, expire@365d |
70-90% of log S3 cost |
Step 8: Verify the recommendation
- For IDLE_LB: tag the LB for 7 days before deletion. After 7 days
of zero traffic, delete. Verify Route 53 records are updated.
- For LCU_DIM: after enabling keep-alive or compression, monitor
ConsumedLCUs for 7 days. Verify the peak dimension dropped.
- For CONSOLIDATION: after merging ALBs, verify all paths route
correctly. Test each listener rule. Monitor 5xx error rate for 24
hours. Keep the old ALBs tagged but not deleted for 7 days as
rollback.
- For CLB_MIGRATION: migrate traffic gradually (DNS weighted
routing). Monitor error rates and latency for 7 days before
decommissioning the CLB.
- For DATA_TRANSFER: after disabling NLB cross-zone, verify target
health and traffic distribution remain balanced across AZs.
Step 9: Decide — OPTIMIZED vs FURTHER_OPTIMIZATION_AVAILABLE
- FURTHER_OPTIMIZATION_AVAILABLE. At least one dimension has a
cost optimization opportunity. Output RECOMMENDATION and
ESTIMATED_SAVINGS.
- OPTIMIZED. No idle LBs, LCU peak dimension is well-managed,
ALBs are consolidated where possible, no CLBs, data transfer is
optimized, and access logs have lifecycle rules. No further action.
Expert heuristic — "LCU is max not sum, consolidate to cut the floor, idle is free money"
Expert heuristic deep dive (LCU dimension maximization, multi-path consolidation math, CLB elimination urgency, idle-LB economics) moved verbatim to references/advanced-patterns.md.
Load on demand when explaining or prioritizing ELB savings levers.
Configuration dependency graph
ELB Inventory (describe-load-balancers + describe-load-balancers for CLB)
|
+-- RequestCount / ProcessedBytes (CloudWatch, 14-day)
| |
| +-- [IDLE_LB] -> Tag 7 days -> Delete if confirmed idle
|
+-- ConsumedLCUs (CloudWatch, 14-day)
| |
| +-- Per-dimension metrics (NewConn, ActiveConn, Bytes, RuleEval)
| | |
| | +-- [LCU_DIM] -> Reduce peak dimension (keep-alive, compression, rule simplification)
| |
| +-- Total LCU cost = peak_LCU x $0.008/h x 730h
|
+-- Listeners + Rules (describe-listeners + describe-rules)
| |
| +-- [CONSOLIDATION] -> Merge ALBs via multi-path routing
| |
| +-- TLS Certificate (acm list-certificates) -> SAN cert for multi-domain
|
+-- CLB Inventory (elb describe-load-balancers)
| |
| +-- [CLB_MIGRATION] -> Migrate to ALB (HTTP) or NLB (TCP/UDP)
|
+-- NLB cross-zone setting + ProcessedBytes
| |
| +-- [DATA_TRANSFER] -> Disable cross-zone if targets evenly distributed
|
+-- ALB Access Logs -> S3
|
+-- [ACCESS_LOGS] -> Lifecycle: IA@30d, Glacier@90d, expire@365d
Recent AWS features (2024-2026)
Recent AWS features (ALB Zonal DNS Exclusion, NLB cross-zone visibility, access log partitioning, LCU efficiency, PrivateLink-ALB) moved verbatim to references/advanced-patterns.md.
Load on demand when checking feature-dependent optimizations.
References
See references/elb-pricing-and-lcu-matrix.md for the full pricing
reference (ALB/NLB/CLB rates, LCU dimension calculations, data transfer
rates, regional notes) and references/elb-optimization-commands.md
for the canonical command script for each optimization dimension.
References (load on demand)
- references/elb-optimization-commands.md — canonical command script per optimization dimension; extended with the CLI blocks moved from SKILL.md Steps 0, 2, 3, 4, and 5.
- references/worked-examples.md — the NEED_MORE_INFO output example from Step 0.
- references/advanced-patterns.md — expert heuristic deep dive and recent AWS features.
- references/elb-pricing-and-lcu-matrix.md — full ALB/NLB/CLB pricing and LCU dimension matrix.
Domain
AWS CloudOps / Networking FinOps & Load Balancer Cost Optimization.
AWS documentation
1---2name: elb-cost-optimizer3description: 'Optimizes Elastic Load Balancer cost across seven dimensions: ALB vs NLB vs CLB cost comparison and migration, LCU (Load Balancer Capacity Unit) analysis across the four billing dimensions (new connections, active connections, processed bytes, rule evaluations), target group consolidation via multi-path routing, cross-zone load balancing cost impact, idle load balancer detection, connection draining timeout tuning, CLB-to-ALB/NLB migration savings, data transfer cost reduction via PrivateLink, ALB access log volume reduction, and SSL certificate overhead. Reads CloudWatch LCU metrics, ELB configurations, and Cost Explorer data. Emits FURTHER_OPTIMIZATION_AVAILABLE or OPTIMIZED with estimated savings and consolidation steps. Use when reviewing ELB spend, analyzing LCU costs, consolidating ALBs, migrating CLBs, or a FinOps review of load balancer spend.'4license: Apache-2.05compatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted CloudWatch LCU metrics, ELB configurations, and Cost Explorer data. Live-account optimization uses aws elbv2 describe-load-balancers, describe-target-groups, describe-listeners, describe-rules, aws cloudwatch get-metric-statistics (ConsumedLCUs, NewConnectionCount, ActiveConnectionCount, ProcessedBytes, RuleEvaluations), aws ce get-cost-and-usage, and aws...6metadata:7 source: https://skillmd.com/skills/jhkchan/elb-cost-optimizer8 domain: aws-cloudops9 complexity: high10 requires_llm: 'true'11 phase: '3'12 supports_pipeline: 'true'13 entry_point: 'false'14 family: Networking15 task_type: optimize16 skill_class: capability17 lifecycle_status: active18 verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE19 when_to_use: Optimizing ELB cost, analyzing LCU (Load Balancer Capacity Unit) utilization across the four billing dimensions, consolidating ALBs via multi-path routing and target group merging, evaluating CLB to ALB/NLB migration, detecting idle load balancers, tuning connection draining timeouts, reducing cross-zone data transfer costs, evaluating PrivateLink for inter-AZ traffic reduction, reducing ALB access log volume, or conducting a FinOps review of load balancer spend.20 when_not_to_use: ALB 5xx error troubleshooting (use alb-5xx-troubleshooter), CLB-to-ALB migration execution (use clb-to-alb-migration-operator), Route 53 cost optimization (use route53-cost-optimizer), or VPC data transfer optimization (use data-transfer-optimizer). This skill focuses on cost-driven optimization, not functional debugging or migration execution.21 activation_triggers: optimise ELB cost, ALB LCU analysis, load balancer cost, idle load balancer, CLB to ALB migration cost, target group consolidation, multi-path routing, reduce ALB count, cross-zone load balancing cost, LCU dimensions, ELB FinOps, reduce load balancer bill, NLB vs ALB cost, PrivateLink data transfer, ALB access log cost22 invocation_schema: 'Input: either (a) a load balancer ARN with live-account context, (b) CloudWatch LCU metrics (ConsumedLCUs, NewConnectionCount, ActiveConnectionCount, ProcessedBytes, RuleEvaluations) with at least 14 days of observation, OR (c) an ELB configuration with listener and target group details. Output: a deterministic TARGET / VERDICT / REASON / RECOMMENDATION / ESTIMATED_SAVINGS / ACTION_STEPS block per load balancer or fleet, where VERDICT is one of {OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE}.'23 version: 0.1.024 author: Jacky Chan — AWS Community Builder25 keywords: Elastic Load Balancer, ALB, NLB, CLB, LCU, Load Balancer Capacity Unit, multi-path routing, target group consolidation, cross-zone, idle load balancer, CLB migration, PrivateLink, access logs, SSL certificate, connection draining, FinOps, cost optimization26 tags: elb, alb, nlb, clb, networking, cost-optimization, finops, lcu, load-balancer27---2829# ELB Cost Optimizer3031## Activation3233Activate this skill when the user reports Elastic Load Balancer cost34concerns. Trigger phrases: "optimise ELB cost", "ALB LCU analysis",35"load balancer cost", "idle load balancer", "CLB to ALB migration36cost", "target group consolidation", "multi-path routing", "reduce37ALB count", "cross-zone load balancing cost", "LCU dimensions", "ELB38FinOps", "reduce load balancer bill".3940## Mindset4142**One-line takeaway:** ELB cost is driven by the highest of four LCU43dimensions, not the sum. ALB charges per LCU-hour where 1 LCU is the44max of: 25 new connections/sec, 3000 active connections, 1 GB/hour45processed bytes, or 1000 rule evaluations/sec. You pay for the peak46dimension. The optimal ALB minimizes the peak dimension's value while47consolidating ALB instances via multi-path routing. Start with idle48detection, then LCU optimization, then consolidation.4950Three facts make ELB cost optimization different from generic51infrastructure tuning:5253- **LCU is a max-function, not a sum.** If your ALB does 2000 new54 connections/sec (80 LCUs) but only 0.1 GB/hour processed (0.1 LCU),55 you pay for 80 LCUs. The other three dimensions are free but wasted.56 Optimization means reducing the peak dimension — not the average.57- **CLBs are billed per-hour plus per-GB, with no LCU concept.** A CLB58 at $0.025/hour ($18.25/month) seems cheaper than an ALB at59 $0.0225/hour ($16.43/month) — but CLBs lack path-based routing,60 have lower performance, and cannot be consolidated. Migrating CLBs61 to ALBs enables multi-path routing, which can consolidate 5 CLBs62 into 1 ALB, saving 80% of the per-hour cost.63- **Cross-zone load balancing on NLBs incurs data transfer charges.**64 NLBs charge $0.01/GB for cross-zone traffic. ALBs include65 cross-zone traffic in the LCU price. For high-traffic workloads,66 this difference alone can make ALB cheaper than NLB.6768## Quick reference — load balancer pricing (us-east-1, 2026)6970| Type | Hourly rate | LCU/GB rate | Monthly base (730h) | Best for |71|---|---|---|---|---|72| ALB | $0.0225/h | $0.008/LCU-h | $16.43 | HTTP/HTTPS, path routing |73| NLB | $0.0225/h | $0.006/GB processed | $16.43 | TCP/UDP, extreme perf |74| CLB | $0.025/h | $0.008/GB processed | $18.25 | Legacy only — migrate |75| Gateway LB | $0.0125/h | $0.0035/GB | $9.13 | Third-party security appliances |7677## Quick navigation7879| Section | Purpose |80|---|---|81| **Step 0** | Capture the ELB inventory and LCU metrics |82| **Step 1** | Classify the optimization category (A-G) |83| **Step 2** | IDLE_LB: detect and eliminate idle load balancers |84| **Step 3** | LCU_DIM: LCU dimension analysis and peak reduction |85| **Step 4** | CONSOLIDATION: multi-path routing to reduce ALB count |86| **Step 5** | CLB_MIGRATION: CLB-to-ALB/NLB cost savings |87| **Step 6** | DATA_TRANSFER: cross-zone and PrivateLink optimization |88| **Step 7** | Root-cause catalog (top patterns + canonical fixes) |89| **Step 8** | Verify the recommendation |90| **Step 9** | Decide VERDICT (OPTIMIZED / FURTHER_OPTIMIZATION_AVAILABLE) |9192## STRICT output contract9394```text95TARGET: <load balancer ARN or name> — <type, region>96VERDICT: FURTHER_OPTIMIZATION_AVAILABLE | OPTIMIZED97REASON: <summary of LCU analysis, idle detection, consolidation opportunities>98RECOMMENDATION:99 1. <IDLE_LB recommendation: delete or consolidate idle LB>100 2. <LCU_DIM recommendation: reduce peak LCU dimension>101 3. <CONSOLIDATION recommendation: merge target groups via multi-path>102 4. <CLB_MIGRATION recommendation: migrate CLB to ALB/NLB>103 5. <DATA_TRANSFER recommendation: cross-zone or PrivateLink savings>104ESTIMATED_SAVINGS: $<monthly savings> ($<annual savings>)105ACTION_STEPS:106 1. <specific step with AWS CLI or console action>107 2. <verification step>108 3. <rollback step>109```110111## NEVER112113- **NEVER** delete a load balancer without verifying it has zero114 active traffic for at least 7 days. An "idle" ALB might serve a115 rarely-used internal API, a disaster-recovery endpoint, or a116 blue/green standby. Check Route 53 records, target group health117 checks, and CloudWatch request count before deletion. Always tag118 the LB for 7-day observation before deleting.119120- **NEVER** consolidate ALBs without verifying the TLS certificate121 coverage. Multi-path routing requires a single TLS certificate that122 covers all hostnames (via SAN or wildcard). If each ALB has a123 separate certificate for a different domain, consolidation requires124 a multi-domain certificate first. Forgetting this causes TLS125 handshake failures after consolidation.126127- **NEVER** assume NLB is cheaper than ALB without calculating128 cross-zone data transfer. NLB charges $0.01/GB for cross-zone129 traffic. For a workload processing 5 TB/month cross-zone, that is130 $51/month in data transfer alone — potentially making ALB cheaper131 despite the higher per-GB rate. Always calculate the total cost132 including data transfer.133134- **NEVER** migrate a CLB to an NLB when the workload uses HTTP135 features. NLB operates at Layer 4 (TCP/UDP) and does not support136 path-based routing, host-based routing, SSL termination with SNI,137 or X-Forwarded-For headers. A CLB serving HTTP traffic should138 migrate to ALB, not NLB. Migrating to NLB breaks HTTP features.139140- **NEVER** disable cross-zone load balancing on an ALB to save cost.141 ALBs include cross-zone traffic in the LCU price — there is no142 additional charge. Disabling cross-zone on an ALB has no cost143 benefit and degrades availability. (On NLBs, disabling cross-zone144 avoids the $0.01/GB charge but may cause uneven distribution.)145146- **NEVER** ignore access log costs for high-traffic ALBs. ALB access147 logs are stored in S3 at $0.023/GB/month. A high-traffic ALB can148 generate 100+ GB/month of access logs ($2.30/month + PUT request149 costs). While not the primary cost driver, it compounds with150 multiple ALBs. Consider sampling, lifecycle rules, or disabling151 for non-production ALBs.152153## Process — ELB cost optimization decision tree (apply in order)154155### Step 0: Capture the ELB inventory and LCU metrics156157Gather these inputs. Each step below branches on which are available.158159| Signal | Source | Why required |160|---|---|---|161| **Load balancer inventory** | `aws elbv2 describe-load-balancers` | ALB/NLB configs, type, scheme, VPC |162| **CLB inventory** | `aws elb describe-load-balancers` | Legacy CLBs, migration candidates |163| **Listeners and rules** | `aws elbv2 describe-listeners`, `describe-rules` | Path-based routing, rule count |164| **Target groups** | `aws elbv2 describe-target-groups` | Consolidation opportunities |165| **LCU metrics** | CloudWatch `ConsumedLCUs`, `NewConnectionCount`, `ActiveConnectionCount`, `ProcessedBytes`, `RuleEvaluations` | LCU dimension analysis |166| **Cost data** | `aws ce get-cost-and-usage` filtered by ELB | Baseline spend |167168If the user has not provided LB data or metrics, output:169170Full NEED_MORE_INFO output block moved verbatim to [references/worked-examples.md](references/worked-examples.md).171Load on demand when LB inventory or LCU metrics are missing.172Inventory / LCU capture CLI (describe-load-balancers, describe-load-balancers for CLB, 14-day ConsumedLCUs) moved verbatim to [references/elb-optimization-commands.md](references/elb-optimization-commands.md).173Load on demand when gathering ELB inventory and LCU metrics.174175### Step 1: Identify the optimization category176177| Category | Signal | Diagnostic step |178|---|---|---|179| **A. IDLE_LB** | RequestCount < 100/day or zero healthy targets for 7+ days | Step 2 |180| **B. LCU_DIM** | ConsumedLCUs > 10 (indicating a high peak dimension) | Step 3 |181| **C. CONSOLIDATION** | Multiple ALBs in the same VPC serving related paths | Step 4 |182| **D. CLB_MIGRATION** | Any active CLB in the account | Step 5 |183| **E. DATA_TRANSFER** | NLB with cross-zone enabled + high GB processed | Step 6 |184| **F. ALREADY_OPTIMAL** | Right-sized, consolidated, no CLBs, LCU-efficient | Verdict: OPTIMIZED |185| **G. ACCESS_LOGS** | ALB access logs to S3 with no lifecycle policy | Step 6 |186187**Apply A before B before C.** Eliminating idle LBs is the easiest188win (delete = 100% savings). Then reduce LCU consumption. Then189consolidate remaining LBs. CLB migration is a larger project —190schedule it separately.191192### Step 2: IDLE_LB — detect and eliminate idle load balancers193194An idle load balancer costs $16.43/month (ALB/NLB) or $18.25/month195(CLB) just for existing — plus LCU/GB charges for any minimal traffic.196Idle LBs are the #1 ELB cost waste.197198**Idle detection criteria:**199200| Metric | Threshold | Action |201|---|---|---|202| RequestCount (ALB) | < 100/day for 7 days | Candidate for deletion |203| ProcessedBytes (NLB) | < 1 MB/day for 7 days | Candidate for deletion |204| HealthyHostCount | 0 for 7 days | Delete — no targets registered |205| NewConnectionCount | < 50/day for 7 days | Investigate; likely deletable |206207**Diagnostic commands:**208Idle-detection CLI (RequestCount, HealthyHostCount, Route 53 record check) moved verbatim to [references/elb-optimization-commands.md](references/elb-optimization-commands.md).209Load on demand when confirming a load balancer is idle before deletion.210211**Savings: deleting one idle ALB = $16.43/month + LCU charges.212Deleting 5 idle ALBs = $82+/month.**213214### Step 3: LCU_DIM — LCU dimension analysis and peak reduction215216ALB charges per LCU-hour. The LCU rate is $0.008/hour. The number of217LCUs is determined by the MAX of four dimensions:218219**LCU dimension definitions:**220221| Dimension | 1 LCU = | Metric name |222|---|---|---|223| New connections | 25 new connections/sec | NewConnectionCount |224| Active connections | 3000 active connections | ActiveConnectionCount |225| Processed bytes | 1 GB/hour (2.78 Mbps) | ProcessedBytes |226| Rule evaluations | 1000 rule evaluations/sec | RuleEvaluations |227228**LCU calculation example:**229230| Dimension | Observed value | LCUs consumed |231|---|---|---|232| New connections | 500/sec | 500/25 = 20.0 LCU |233| Active connections | 15,000 | 15000/3000 = 5.0 LCU |234| Processed bytes | 2 GB/hour | 2/1 = 2.0 LCU |235| Rule evaluations | 3000/sec | 3000/1000 = 3.0 LCU |236| **Peak (billed)** | | **20.0 LCU** |237238You pay for 20 LCU/hour = $0.16/hour = $116.80/month.239240**The peak dimension is "new connections" at 20 LCU.** Reducing the241other three dimensions to zero saves nothing. The only way to reduce242the bill is to reduce new connections/sec.243244**Peak dimension reduction strategies:**245246| Peak dimension | Reduction strategy | Expected savings |247|---|---|---|248| New connections | Connection reuse (HTTP keep-alive), merge endpoints | 30-60% |249| Active connections | Reduce idle timeout (default 60s), connection draining | 10-30% |250| Processed bytes | Response compression (gzip/brotli), reduce payload | 20-50% |251| Rule evaluations | Reduce listener rules, simplify conditions | 10-40% |252253**Diagnostic commands for per-dimension analysis:**254Per-dimension LCU metric CLI (NewConnectionCount, ActiveConnectionCount, ProcessedBytes, RuleEvaluations) moved verbatim to [references/elb-optimization-commands.md](references/elb-optimization-commands.md).255Load on demand when identifying the peak LCU billing dimension.256257### Step 4: CONSOLIDATION — multi-path routing to reduce ALB count258259Multiple ALBs in the same VPC serving related services can often be260consolidated into a single ALB using path-based and host-based261routing. Each consolidated ALB saves $16.43/month + its LCU charges.262263**Consolidation decision table:**264265| Scenario | Consolidate? | Method |266|---|---|---|267| 3 ALBs, each serving one microservice, same domain | YES | Host-based routing (one ALB, 3 listener rules on host header) |268| 5 ALBs, each serving one path of the same domain | YES | Path-based routing (one ALB, 5 listener rules on path pattern) |269| 2 ALBs in different VPCs (prod and staging) | NO | Different VPCs — keep separate |270| 1 ALB internal + 1 ALB internet-facing for the same service | MAYBE | Can use one ALB with both schemes? No — ALB scheme is immutable. Keep separate. |271| 4 ALBs with different TLS certificates for different domains | YES (with SAN cert) | Obtain a multi-domain certificate; consolidate with SNI |272273**Example: 3 ALBs -> 1 ALB consolidation**274275Before: 3 ALBs at $16.43/month each = $49.29/month + LCU charges.276After: 1 ALB at $16.43/month + LCU charges (merged).277**Savings: $32.86/month minimum (just from per-hour charges).**278Consolidation CLI (create-rule path-pattern rules for merged ALB) moved verbatim to [references/elb-optimization-commands.md](references/elb-optimization-commands.md).279Load on demand when consolidating ALBs via multi-path routing.280281### Step 5: CLB_MIGRATION — CLB to ALB/NLB cost and feature savings282283Classic Load Balancers (CLBs) are a legacy product with no new feature284development. They cost $0.025/hour ($18.25/month) plus $0.008/GB285processed. Migrating to ALB or NLB saves on per-hour cost AND enables286modern features (path routing, SNI, LCU-based pricing).287288**CLB migration decision:**289290| CLB workload | Migrate to | Rationale |291|---|---|---|292| HTTP/HTTPS traffic | ALB | Path routing, LCU pricing, SNI, better metrics |293| TCP/UDP traffic | NLB | Higher performance, static IPs, lower latency |294| Mixed HTTP + TCP | ALB for HTTP, NLB for TCP | Split services across two LB types |295296**CLB vs ALB cost comparison (1 TB/month processed):**297298| Type | Hourly | GB rate | Monthly total | Features |299|---|---|---|---|---|300| CLB | $0.025/h | $0.008/GB | $18.25 + $8.00 = $26.25 | Legacy, no path routing |301| ALB | $0.0225/h | LCU-based | $16.43 + LCU charges | Path routing, SNI, metrics |302| NLB | $0.0225/h | $0.006/GB | $16.43 + $6.00 = $22.43 | TCP/UDP, static IPs |303304CLB migration CLI (describe CLB listeners, create target group, create replacement ALB) moved verbatim to [references/elb-optimization-commands.md](references/elb-optimization-commands.md).305Load on demand when planning a CLB migration.306### Step 6: DATA_TRANSFER — cross-zone and PrivateLink optimization307308**Cross-zone load balancing:**309310| LB type | Cross-zone default | Cost impact |311|---|---|---|312| ALB | Always on (cannot disable) | Included in LCU price — no extra charge |313| NLB | Off by default (can enable) | $0.01/GB for cross-AZ traffic when enabled |314315For NLBs with cross-zone enabled, the cross-AZ data transfer can316exceed the NLB hourly cost. A 5 TB/month NLB with cross-zone enabled317incurs $51/month in data transfer alone.318319**PrivateLink cost reduction:**320321When ALBs serve traffic from clients in different VPCs, the traffic322crosses VPC peering or Transit Gateway, incurring data transfer323charges. PrivateLink (interface VPC endpoints) can reduce this cost324by keeping traffic within the AWS network.325326**Decision: NLB cross-zone on vs off:**327328| Scenario | Recommendation | Rationale |329|---|---|---|330| Targets evenly distributed across AZs | OFF | Each AZ handles its own traffic; no cross-AZ charge |331| Targets concentrated in one AZ | ON | Without cross-zone, one AZ is overloaded |332| Clients concentrated in one AZ | OFF | Route to local AZ targets; avoid cross-AZ |333| Unpredictable traffic distribution | ON | Better availability; accept cross-AZ charge |334335**Access log optimization:**336337ALB access logs are stored in S3 at $0.023/GB/month. For high-traffic338ALBs:339340| ALB traffic | Log volume/month | S3 cost/month |341|---|---|---|342| 1M req/day | ~30 GB | $0.69 |343| 10M req/day | ~300 GB | $6.90 |344| 100M req/day | ~3000 GB | $69.00 |345346**Recommendation:** Apply S3 lifecycle rules to transition access logs347to Standard-IA after 30 days, Glacier after 90 days, and expire after3481 year. This reduces the effective S3 cost by 70-90%.349350### Step 7: Map to root-cause catalog351352| # | Pattern | Category | Fix | Est. savings |353|---|---|---|---|---|354| 1 | ALB with < 100 requests/day for 7+ days | IDLE_LB | Delete the ALB | $16.43+/month per ALB |355| 2 | ALB with 0 healthy targets for 7+ days | IDLE_LB | Delete; no traffic possible | $16.43+/month |356| 3 | Peak LCU dimension = new connections (keep-alive disabled) | LCU_DIM | Enable HTTP keep-alive on targets | 30-60% LCU reduction |357| 4 | Peak LCU dimension = active connections (idle timeout 60s) | LCU_DIM | Reduce idle timeout to 30s | 10-30% LCU reduction |358| 5 | Peak LCU dimension = processed bytes (no compression) | LCU_DIM | Enable gzip/brotli compression | 20-50% LCU reduction |359| 6 | Peak LCU dimension = rule evaluations (too many rules) | LCU_DIM | Simplify rule conditions, reduce rules | 10-40% LCU reduction |360| 7 | 3+ ALBs in same VPC serving related paths | CONSOLIDATION | Multi-path routing into single ALB | $32.86+/month per merged ALB |361| 8 | Active CLB serving HTTP traffic | CLB_MIGRATION | Migrate to ALB | $1.82+/month + feature gains |362| 9 | NLB with cross-zone enabled + 5 TB/month | DATA_TRANSFER | Disable cross-zone if targets evenly distributed | $51/month |363| 10 | ALB access logs with no S3 lifecycle | ACCESS_LOGS | Add lifecycle: IA@30d, Glacier@90d, expire@365d | 70-90% of log S3 cost |364365### Step 8: Verify the recommendation366367- **For IDLE_LB:** tag the LB for 7 days before deletion. After 7 days368 of zero traffic, delete. Verify Route 53 records are updated.369- **For LCU_DIM:** after enabling keep-alive or compression, monitor370 ConsumedLCUs for 7 days. Verify the peak dimension dropped.371- **For CONSOLIDATION:** after merging ALBs, verify all paths route372 correctly. Test each listener rule. Monitor 5xx error rate for 24373 hours. Keep the old ALBs tagged but not deleted for 7 days as374 rollback.375- **For CLB_MIGRATION:** migrate traffic gradually (DNS weighted376 routing). Monitor error rates and latency for 7 days before377 decommissioning the CLB.378- **For DATA_TRANSFER:** after disabling NLB cross-zone, verify target379 health and traffic distribution remain balanced across AZs.380381### Step 9: Decide — OPTIMIZED vs FURTHER_OPTIMIZATION_AVAILABLE382383- **FURTHER_OPTIMIZATION_AVAILABLE.** At least one dimension has a384 cost optimization opportunity. Output RECOMMENDATION and385 ESTIMATED_SAVINGS.386- **OPTIMIZED.** No idle LBs, LCU peak dimension is well-managed,387 ALBs are consolidated where possible, no CLBs, data transfer is388 optimized, and access logs have lifecycle rules. No further action.389390## Expert heuristic — "LCU is max not sum, consolidate to cut the floor, idle is free money"391Expert heuristic deep dive (LCU dimension maximization, multi-path consolidation math, CLB elimination urgency, idle-LB economics) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).392Load on demand when explaining or prioritizing ELB savings levers.393394## Configuration dependency graph395396```397ELB Inventory (describe-load-balancers + describe-load-balancers for CLB)398 |399 +-- RequestCount / ProcessedBytes (CloudWatch, 14-day)400 | |401 | +-- [IDLE_LB] -> Tag 7 days -> Delete if confirmed idle402 |403 +-- ConsumedLCUs (CloudWatch, 14-day)404 | |405 | +-- Per-dimension metrics (NewConn, ActiveConn, Bytes, RuleEval)406 | | |407 | | +-- [LCU_DIM] -> Reduce peak dimension (keep-alive, compression, rule simplification)408 | |409 | +-- Total LCU cost = peak_LCU x $0.008/h x 730h410 |411 +-- Listeners + Rules (describe-listeners + describe-rules)412 | |413 | +-- [CONSOLIDATION] -> Merge ALBs via multi-path routing414 | |415 | +-- TLS Certificate (acm list-certificates) -> SAN cert for multi-domain416 |417 +-- CLB Inventory (elb describe-load-balancers)418 | |419 | +-- [CLB_MIGRATION] -> Migrate to ALB (HTTP) or NLB (TCP/UDP)420 |421 +-- NLB cross-zone setting + ProcessedBytes422 | |423 | +-- [DATA_TRANSFER] -> Disable cross-zone if targets evenly distributed424 |425 +-- ALB Access Logs -> S3426 |427 +-- [ACCESS_LOGS] -> Lifecycle: IA@30d, Glacier@90d, expire@365d428```429430## Recent AWS features (2024-2026)431Recent AWS features (ALB Zonal DNS Exclusion, NLB cross-zone visibility, access log partitioning, LCU efficiency, PrivateLink-ALB) moved verbatim to [references/advanced-patterns.md](references/advanced-patterns.md).432Load on demand when checking feature-dependent optimizations.433434## References435436See `references/elb-pricing-and-lcu-matrix.md` for the full pricing437reference (ALB/NLB/CLB rates, LCU dimension calculations, data transfer438rates, regional notes) and `references/elb-optimization-commands.md`439for the canonical command script for each optimization dimension.440441## References (load on demand)442443- [references/elb-optimization-commands.md](references/elb-optimization-commands.md) — canonical command script per optimization dimension; extended with the CLI blocks moved from SKILL.md Steps 0, 2, 3, 4, and 5.444- [references/worked-examples.md](references/worked-examples.md) — the NEED_MORE_INFO output example from Step 0.445- [references/advanced-patterns.md](references/advanced-patterns.md) — expert heuristic deep dive and recent AWS features.446- [references/elb-pricing-and-lcu-matrix.md](references/elb-pricing-and-lcu-matrix.md) — full ALB/NLB/CLB pricing and LCU dimension matrix.447448## Domain449450AWS CloudOps / Networking FinOps & Load Balancer Cost Optimization.451452## AWS documentation453454- **Elastic Load Balancing pricing** — https://aws.amazon.com/elasticloadbalancing/pricing/455- **ALB LCU details** — https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-cloudwatch-metrics.html456- **CLB to ALB migration** — https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/migrate-classic-load-balancer.html457- **Listener rules** — https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-rules.html458- **NLB cross-zone** — https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#cross-zone-load-balancing459- **ALB access logs** — https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-access-logs.html460- **AWS PrivateLink** — https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html461- **ACM certificates** — https://docs.aws.amazon.com/acm/latest/userguide/acm-overview.html