[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AAA31Z0KXS1H98RH4RYYZ3":3,"skill-same:01M7AAA31Z0KXS1H98RH4RYYZ3":145},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":6,"ownerHtmlUrl":50,"ownerBlogUrl":6,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M7AAA31Z0KXS1H98RH4RYYZ3","nat-gateway-traffic-optimizer",null,"Optimises NAT Gateway cost through traffic analysis (BytesOutToDestination vs BytesInFromDestination), VPC endpoint elimination of NAT traffic (S3 Gateway Endpoint, DynamoDB Gateway Endpoint, Interface Endpoints for SSM\u002FSTS\u002FECR\u002FSQS), NAT Gateway vs NAT Instance cost comparison, single NAT Gateway consolidation for non-production environments, subnet routing optimization to avoid double-NAT, S3 Gateway Endpoint as a free persistent route, PrivateLink for SaaS API traffic, CloudFront-to-origin via VPC endpoint, cross-AZ data transfer cost analysis, and the $0.045\u002Fhr hourly + $0.045\u002FGB per-GB pricing model. Uses VPC Flow Logs and CloudWatch to quantify per-service NAT traffic, compute VPC endpoint break-even thresholds, and project monthly savings. Emits OPTIMIZED when all dimensions pass, or FURTHER_OPTIMIZATION_AVAILABLE when a concrete endpoint-creation, topology-consolidation, or NAT Instance substitution opportunity exists with a dollar savings estimate.","jhkchan\u002Faws-agent-skills","jhkchan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1083902?v=4","01M7A2SVQYP9GQTPTDXP5JKYQ4","Jacky Chan","01M7A2SVS117YWCTZABB75HZR1",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: nat-gateway-traffic-optimizer\ndescription: Optimises NAT Gateway cost through traffic analysis (BytesOutToDestination vs BytesInFromDestination), VPC endpoint elimination of NAT traffic (S3 Gateway Endpoint, DynamoDB Gateway Endpoint, Interface Endpoints for SSM\u002FSTS\u002FECR\u002FSQS), NAT Gateway vs NAT Instance cost comparison, single NAT Gateway consolidation for non-production environments, subnet routing optimization to avoid double-NAT, S3 Gateway Endpoint as a free persistent route, PrivateLink for SaaS API traffic, CloudFront-to-origin via VPC endpoint, cross-AZ data transfer cost analysis, and the $0.045\u002Fhr hourly + $0.045\u002FGB per-GB pricing model. Uses VPC Flow Logs and CloudWatch to quantify per-service NAT traffic, compute VPC endpoint break-even thresholds, and project monthly savings. Emits OPTIMIZED when all dimensions pass, or FURTHER_OPTIMIZATION_AVAILABLE when a concrete endpoint-creation, topology-consolidation, or NAT Instance substitution opportunity exists with a dollar savings estimate.\nlicense: Apache-2.0\ncompatibility: Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted VPC Flow Logs, NAT Gateway CloudWatch metrics, and Cost Explorer NAT spend data. Live-account optimization uses aws ec2 describe-nat-gateways, aws ec2 describe-vpc-endpoints, aws ec2 describe-route-tables, aws cloudwatch get-metric-statistics (BytesOutToDestination, BytesInFromDestination, BytesOutToSource, BytesInFromSource, ConnectionEstablishedCount...\nmetadata:\n  domain: aws-cloudops\n  complexity: medium\n  requires_llm: 'true'\n  phase: '3'\n  supports_pipeline: 'true'\n  entry_point: 'false'\n  family: Networking\n  task_type: optimize\n  skill_class: capability\n  lifecycle_status: active\n  verdict_shape: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\n  when_to_use: Optimising NAT Gateway cost, analysing VPC Flow Logs for NAT traffic patterns, evaluating VPC endpoint creation (S3, DynamoDB, SSM, STS, ECR, SQS), consolidating multi-AZ NAT Gateways to single NAT for non-prod, comparing NAT Instance vs NAT Gateway for dev\u002Ftest, diagnosing unexpected data transfer charges, or running a FinOps networking cost review.\n  when_not_to_use: VPC peering or Transit Gateway topology design (use vpc-peering-deployer or transit-gateway-deployer), NAT Gateway troubleshooting (connection errors, port exhaustion — use the VPC troubleshooter), or Security Group auditing (use ec2-security-group-auditor). This skill focuses on cost-driven traffic optimization, not connectivity debugging.\n  activation_triggers: optimise NAT Gateway cost, NAT Gateway data processing charge, VPC endpoint cost benefit, S3 traffic through NAT, create Gateway VPC Endpoint, single NAT Gateway vs multi-AZ, NAT Instance alternative, reduce NAT Gateway bill, VPC Flow Logs traffic breakdown, FinOps networking review, PrivateLink endpoint savings, ECR traffic through NAT, DynamoDB VPC endpoint, unexpected AWS data transfer charge, cross-AZ data transfer cost, subnet routing optimization, double NAT detection, S3 Gateway Endpoint free, CloudFront origin VPC endpoint, NAT Gateway hourly charge\n  invocation_schema: 'Input: either (a) a VPC ID + live-account context, (b) a NAT Gateway CloudWatch metrics document with 7-30 day BytesOutToDestination\u002FBytesInFromDestination data, OR (c) VPC Flow Logs summarised by destination service. Output: a deterministic VPC\u002FVERDICT\u002FREASON\u002FRECOMMENDATION\u002FESTIMATED_SAVINGS\u002FMIGRATION_STEPS block per VPC, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.'\n  invocation_example: \"# Minimal valid input (offline finding classification):\\nVPC: vpc-0abc123def\\nNAT Gateways: 2 (us-east-1a, us-east-1b)\\nEnvironment: non-production (staging)\\nRegion: us-east-1\\nNAT Monthly Spend:\\n  - Hourly: 2 × $0.045 × 730 = $65.70\\n  - Data processing: 450 GB × $0.045 = $20.25\\n  - Total: $85.95\u002Fmonth\\nExisting VPC Endpoints: none\\nVPC Flow Logs (last 7 days):\\n  - S3 traffic: 180 GB (40% of total)\\n  - DynamoDB traffic: 45 GB (10% of total)\\n  - ECR traffic: 90 GB (20% of total)\\n  - SSM traffic: 22 GB (5% of total)\\nEmit the standard optimization block (VPC, VERDICT,\\nREASON, RECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS).\"\n  version: 0.1.0\n  author: Jacky Chan — AWS Community Builder\n  keywords: NAT Gateway, cost optimization, VPC endpoint, S3 Gateway Endpoint, DynamoDB Gateway Endpoint, Interface Endpoint, PrivateLink, NAT Instance, single NAT Gateway, multi-AZ NAT, cross-AZ data transfer, VPC Flow Logs, subnet routing, double NAT, CloudFront origin, ECR VPC endpoint, SSM VPC endpoint, STS VPC endpoint, data processing charge, hourly charge, FinOps, networking cost\n  tags: nat-gateway, networking, cost-optimization, finops, vpc-endpoint\n---\n\n# NAT Gateway Traffic Optimizer\n\n## What this skill does\n\nTranslates a VPC's NAT Gateway traffic posture into a concrete cost-\noptimization recommendation with a dollar-denominated savings estimate.\nThe verdict is the highest-leverage action across six dimensions —\nGateway endpoints (S3\u002FDynamoDB), Interface endpoints (SSM\u002FSTS\u002FECR\u002Fetc.),\nNAT topology consolidation (single vs multi-AZ), NAT Instance\nsubstitution, routing optimization (double-NAT elimination), and\nCloudFront-to-origin via VPC endpoint — applied in priority order.\nAlways pairs the recommendation with exact CLI commands.\n\n## Quick navigation\n\n| Section | What it covers | When to jump here |\n|---|---|---|\n| Quick start | Three headline rules and the pricing model | First read |\n| Mindset | Why VPC endpoints are the #1 NAT cost lever | Understanding the approach |\n| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a VPC |\n| Pre-flight data gate | NAT GW metrics + Flow Logs + Cost Explorer | Before any recommendation |\n| Step 0 non-obvious behaviours | Cross-AZ charges, Gateway vs Interface, double-NAT | Edge cases |\n| Step 1 Gateway endpoints (S3, DynamoDB) | FREE, persistent, eliminates #1 traffic source | The headline savings dimension |\n| Step 2 Interface endpoints | SSM, STS, ECR, SQS, Secrets Manager break-even | Per-service evaluation |\n| Step 3 NAT topology (single vs multi-AZ) | Non-prod consolidation saves $32\u002Fmo per AZ | Topology savings |\n| Step 4 NAT Instance substitution | Dev\u002Ftest fixed-cost alternative | Low-traffic environments |\n| Step 5 Routing optimization | Double-NAT detection, subnet route table audit | Hidden cost elimination |\n| Step 6 CloudFront + PrivateLink | Origin via endpoint, SaaS API traffic | Advanced patterns |\n| Step 7 Impact estimation | The cost formula and worked math | Every recommendation |\n| Output format | VERDICT block + worked examples | Emitting the result |\n| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |\n| Pre-flight safety checks | Route table backup, CONFIRM gate | Before any apply CLI |\n\n## Quick start\n\n- **S3 Gateway Endpoint is FREE and persistent.** It is the #1 NAT\n  traffic source eliminator. If S3 traffic flows through NAT, creating\n  a Gateway Endpoint eliminates it at zero cost — no per-GB charge, no\n  hourly charge, no per-AZ charge. The expert principle: S3 Gateway\n  Endpoint eliminates the #1 NAT traffic source for free with a\n  persistent route.\n- **Cost formula (memorise this):**\n  `monthly_nat_cost = (nat_gateway_count × $0.045 × 730) + (total_GB × $0.045)`\n  `  = hourly_component + data_processing_component`\n- **Single NAT for non-prod saves $32\u002Fmo per AZ removed.** A 3-AZ\n  non-prod VPC with 3 NAT Gateways pays $98.55\u002Fmonth in hourly charges\n  alone. Consolidating to 1 NAT Gateway saves $65.70\u002Fmonth ($32.85 × 2\n  AZs removed). Use VPC Flow Logs to quantify savings.\n\n## Mindset\n\n> Mindset rationale and the four guiding principles moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand to understand why VPC endpoints are the #1 NAT cost lever.\n\n## Quick reference — verdict thresholds\n\n| Observation (7-30 day window) | Verdict | Recommendation |\n|---|---|---|\n| S3 traffic through NAT AND no S3 Gateway Endpoint | **FURTHER_OPTIMIZATION_AVAILABLE** (Gateway endpoint) | Step 1 — create S3 Gateway Endpoint (FREE) |\n| DynamoDB traffic through NAT AND no DynamoDB Gateway Endpoint | **FURTHER_OPTIMIZATION_AVAILABLE** (Gateway endpoint) | Step 1 — create DynamoDB Gateway Endpoint (FREE) |\n| ECR\u002FSSM\u002FSTS\u002FSQS\u002FSecrets Manager traffic through NAT, monthly GB > break-even per AZ | **FURTHER_OPTIMIZATION_AVAILABLE** (Interface endpoint) | Step 2 — create Interface Endpoint(s) |\n| Non-production VPC with 2+ NAT Gateways AND environment tolerates single-AZ egress | **FURTHER_OPTIMIZATION_AVAILABLE** (topology) | Step 3 — consolidate to single NAT Gateway |\n| Dev\u002Ftest VPC with low traffic (\u003C 50 GB\u002Fmonth) AND reliability is not critical | **FURTHER_OPTIMIZATION_AVAILABLE** (NAT Instance) | Step 4 — substitute NAT Gateway with NAT Instance |\n| Route tables show traffic traversing 2 NAT Gateways (double-NAT) | **FURTHER_OPTIMIZATION_AVAILABLE** (routing) | Step 5 — fix route table to eliminate double-NAT |\n| S3 Gateway Endpoint exists, all Interface Endpoints above break-even, single NAT in non-prod or appropriate multi-AZ in prod | **OPTIMIZED** | None — continue monitoring |\n| VPC Flow Logs not enabled or \u003C 7 days of data | **NEED_MORE_INFO** | Enable Flow Logs, wait 7 days, re-evaluate |\n\n## Pre-flight: data gate (run before any optimization decision)\n\nOptimization decisions are only as good as the underlying data. Pull\nthese data sources before any recommendation. Full CLI sequences are\nin `references\u002Fnat-pricing-and-endpoint-matrix.md`.\n\n> Required data-source listing moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md); full CLI sequences already live in the pricing matrix reference.\n> Pull all seven sources before any recommendation — the data-quality short-circuits below govern the verdict.\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimization |\n|---|---|\n| No NAT Gateway in the VPC | **OPTIMIZED** with note \"no NAT Gateway spend.\" |\n| VPC Flow Logs not enabled | **NEED_MORE_INFO**. Cannot identify per-service traffic. |\n| Flow Logs enabled but \u003C 7 days | **NEED_MORE_INFO**. Need 7+ days for traffic patterns. |\n| NAT Gateway `State != available` | **BLOCKED**. Gateway is deleting or failed. |\n| CloudWatch `BytesOutToDestination` absent | Gateway may be newly created. Wait 7 days. |\n| Cost Explorer returns $0 for Nat-Gateway | Verify region filter. May be a different account. |\n\n## Process — Optimization logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\n> Step-0 non-obvious behaviours moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand — each gotcha reroutes the recommendation away from the obvious choice.\n\n### Step 1: Gateway endpoints (S3, DynamoDB) — FREE, always create\n\n> Intro and positioning moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> The decision gate below is authoritative.\n\n> Pricing block moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md) (Gateway endpoints are FREE).\n> Decision gate below.\n\n**Decision gate:**\n```\nIs there S3 or DynamoDB traffic through NAT?\n├── NO → Skip (no S3\u002FDynamoDB traffic to optimize)\n└── YES → Does a Gateway Endpoint already exist?\n    ├── YES → Verify route table includes the prefix list. If not,\n    │         add the route manually.\n    └── NO → CREATE the Gateway Endpoint. Pure saving, zero downside.\n```\n\n> Create-CLI patterns for S3 and DynamoDB Gateway endpoints moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Load on demand at emit time for the IMPLEMENTATION block.\n\n> Saving math walkthrough moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> monthly_saving = s3_GB_through_NAT × $0.045 — captured in full, endpoint is free.\n\n### Step 2: Interface endpoints (per-service break-even)\n\n> Break-even framing moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Threshold: ~160 GB\u002Fmonth per AZ.\n\n> Interface endpoint pricing block moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Per-service decision gate below.\n\n> Break-even-by-AZ-count table moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> 1 AZ = $7.30 \u002F 162 GB; each extra AZ adds both.\n\n> Common Interface endpoint candidates table moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Evaluate each service against the decision gate below.\n\n**Decision gate per service:**\n```\nmonthly_service_GB_through_NAT × $0.045  >  endpoint_cost_per_month?\n├── YES → CREATE the Interface Endpoint. Net positive saving.\n└── NO → Do NOT create. NAT is cheaper for this service's traffic volume.\n```\n\n> ECR (api + dkr) creation CLI moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Both endpoints are required for Docker pull\u002Fpush without NAT.\n\n### Step 3: NAT topology — single vs multi-AZ\n\nIn non-production environments (dev, test, staging), a single NAT\nGateway is sufficient. Production environments typically need multi-AZ\nNAT for high availability.\n\n> Savings math and cross-AZ trade-off walkthrough moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Decision tree below is authoritative.\n\n**Decision tree for topology:**\n```\nIs this a production VPC?\n├── YES → Keep multi-AZ NAT for HA. Do not consolidate.\n│         Focus on Steps 1, 2, 5, 6 instead.\n└── NO (dev\u002Ftest\u002Fstaging) → How many NAT Gateways?\n    ├── 1 → Already consolidated. Check other dimensions.\n    └── 2+ → Consolidate to 1 NAT Gateway in the AZ with the most\n             private subnets (minimizes cross-AZ transfer).\n             Update route tables in all other AZ subnets to point\n             0.0.0.0\u002F0 at the single NAT Gateway.\n```\n\n> Consolidation CLI sequence (identify, re-route, delete, release EIP) moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Never skip the release-address step.\n\n### Step 4: NAT Instance substitution (dev\u002Ftest only)\n\nFor low-traffic dev\u002Ftest VPCs (\u003C 50 GB\u002Fmonth), a NAT Instance is\ncheaper than a NAT Gateway.\n\n> NAT Gateway vs NAT Instance cost comparison moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Limitations and decision gate below remain in-file.\n\n**NAT Instance limitations:**\n- No SLA (single instance, single AZ)\n- Throughput limited (~1 Gbps for t3.micro)\n- Requires manual setup (user-data iptables NAT rules)\n- No automatic failover\n- AMI must be maintained (OS patches)\n\n**Decision gate:**\n```\nIs this a dev\u002Ftest environment?\n├── NO → Do NOT substitute. NAT Gateway is required for HA.\n└── YES → Is monthly NAT traffic \u003C 100 GB?\n    ├── YES → NAT Instance is cheaper. Recommend substitution.\n    └── NO → NAT Gateway may be cheaper (traffic > break-even).\n             At 100 GB: NAT GW = $37.35, NAT Instance = $7.59 +\n             cross-AZ. Evaluate on a case-by-case basis.\n```\n\n> NAT Instance setup CLI (AL2023 user-data iptables NAT) moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Dev\u002Ftest only — see limitations above.\n\n### Step 5: Routing optimization (double-NAT detection)\n\n> Double-NAT scenario catalog (TGW, peering, chained AZs) moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Detection commands and fix below.\n\n> Route-table audit CLI for chain detection moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n> Fix rule: each private subnet's 0.0.0.0\u002F0 must point at exactly ONE NAT device.\n\n**Fix:** Ensure each private subnet's `0.0.0.0\u002F0` route points at\nexactly ONE NAT Gateway (or NAT Instance). No chains.\n\n### Step 6: CloudFront and PrivateLink\n\n**CloudFront to origin:**\nIf your CloudFront distribution's origin is an ALB or EC2 instance in\na private subnet, CloudFront reaches it via the public internet. No NAT\nGateway is needed for CloudFront traffic — CloudFront has its own\nnetwork path. But if the origin calls back to AWS services (S3, API\nGateway), that traffic may go through NAT.\n\nFor S3 origins: use CloudFront OAI\u002FOAC to keep traffic within AWS. No\nNAT needed.\n\n**PrivateLink for SaaS APIs:**\nIf your private-subnet workload calls a third-party SaaS API (e.g.,\nDatadog, Splunk, GitHub Enterprise) through NAT, check if the SaaS\noffers an AWS PrivateLink endpoint.\n\n> PrivateLink break-even math moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Same ~162 GB\u002FAZ threshold as Step 2.\n\n### Step 7: Impact estimation\n\nCompute the monthly savings for each recommendation:\n\n```\ncurrent_monthly_nat_cost =\n  (nat_gateway_count × $0.045 × 730) + (total_GB × $0.045)\n\nprojected_monthly_nat_cost =\n  (remaining_nat_gateway_count × $0.045 × 730)\n  + (remaining_GB × $0.045)\n  + (interface_endpoint_count × $0.010 × az_count × 730)\n\nmonthly_saving = current_monthly_nat_cost - projected_monthly_nat_cost\n```\n\nAlways state assumptions: GB eliminated by Gateway Endpoints (free),\nGB eliminated by Interface Endpoints (cost offset by endpoint hourly),\nNAT Gateways removed (topology consolidation), cross-AZ transfer\nimpact, and pricing region.\n\n### Step 8: Final verdict\n\n- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.\n- All dimensions pass (Gateway Endpoints exist, Interface Endpoints\n  above break-even, topology appropriate for environment, no double-NAT)\n  → **OPTIMIZED**.\n- Data insufficient (no Flow Logs, \u003C 7 days of data) →\n  **NEED_MORE_INFO**.\n\nNever emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging\nevery `NEED_MORE_INFO` gate.\n\n## Output format\n\n> Verbatim output template and the worked-examples pointer moved to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\n> The STRICT output contract below carries the authoritative required structure; full worked examples live in the reference.\n\n## STRICT output contract\n\nThe rules below are hard constraints. Violating any one produces a\nmisclassification or an arithmetic contradiction that breaks downstream\nFinOps automation. Self-check EVERY emitted block against these rules\nbefore returning the response.\n\n### Required output structure\n\nEvery response MUST be a single block using these literal labels, in this\norder. Do NOT substitute markdown headings, camelCase, or bold variants.\n\n```text\nVPC: \u003Cvpc-id>\nVERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\nREASON: \u003C1-2 sentences naming the recommendation and supporting data>\nRECOMMENDATION:\n  Current: \u003CNAT GW count>, \u003Cmonthly GB>, \u003Cendpoints>, \u003Cenvironment>\n  Proposed: \u003CNAT GW count>, \u003Cremaining GB>, \u003Cnew endpoints>, \u003Ctopology>\n  Dimensions changed: \u003Cgateway-endpoint | interface-endpoint | topology | nat-instance | routing | cloudfront>\n  Dimensions checked: \u003Clist ALL, each ✓ (no finding) or → (finding)>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Current monthly: $\u003Camount>\n  Projected monthly: $\u003Camount>\n  Monthly saving: $\u003Camount>     ← MUST equal Current − Projected, 2 decimals\n  Annual saving: $\u003Camount>      ← MUST equal Monthly × 12\nMIGRATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: \u003Cconfirmation prompt text>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with\n   `Monthly saving: $0.00`.** If every dimension nets zero cost delta,\n   the verdict MUST be `OPTIMIZED`.\n\n2. **NEVER show savings math that does not balance.**\n   `Current monthly − Projected monthly` MUST equal `Monthly saving`,\n   rounded to 2 decimal places.\n\n3. **NEVER emit scratch lines** (\"WAIT — recompute\", \"Hmm, let me redo\",\n   \"corrected:\") in the output. Finalize the math before emitting.\n\n4. **NEVER recommend an Interface Endpoint without computing the\n   break-even.** The REASON MUST cite whether the traffic volume exceeds\n   the ~162 GB\u002FAZ\u002Fmonth threshold.\n\n5. **NEVER recommend consolidating NAT Gateways in a production VPC\n   without flagging the HA risk.** Single NAT Gateway in production is\n   a single point of failure for egress traffic.\n\n6. **NEVER omit a dimension from the RECOMMENDATION block.** The\n   `Dimensions checked` line MUST list all dimensions, each marked\n   ✓ (no finding) or → (finding).\n\n7. **NEVER round intermediate formula steps differently from the final\n   figure.** Compute at full precision, round only the displayed result.\n\n8. **NEVER recommend deleting a NAT Gateway without providing the\n   `release-address` follow-up for the Elastic IP.** Unreleased EIPs\n   cost $0.005\u002Fhour ($3.65\u002Fmonth) if left attached to a deleted gateway.\n\n### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math\n\nEvery field below is internally consistent. Copy this shape exactly.\n\n```text\nVPC: vpc-0staging01\nVERDICT: FURTHER_OPTIMIZATION_AVAILABLE\nREASON: Staging VPC with 2 NAT Gateways ($65.70\u002Fmo hourly) and 450 GB\n  data processing ($20.25\u002Fmo) has no VPC endpoints. S3 traffic (180 GB)\n  and DynamoDB traffic (45 GB) should use FREE Gateway Endpoints.\n  Consolidating from 2 to 1 NAT Gateway saves $32.85\u002Fmo in hourly charges\n  (minus ~$5\u002Fmo cross-AZ transfer for the remaining AZ's subnets). Net\n  monthly saving $58.50.\nRECOMMENDATION:\n  Current: 2 NAT Gateways, 450 GB\u002Fmo, 0 endpoints, staging\n  Proposed: 1 NAT Gateway, 225 GB\u002Fmo, S3+DynamoDB Gateway Endpoints, staging\n  Dimensions changed: gateway-endpoint (S3+DynamoDB) + topology (2→1 NAT GW)\n  Dimensions checked: gateway-endpoint → (S3 180GB, DDB 45GB, no endpoints)\n    interface-endpoint ✓ (ECR below break-even at 90GB × 2 AZ = 45\u002FAZ \u003C 162)\n    topology → (2 NAT GW in staging, consolidate to 1)\n    nat-instance ✓ (450 GB\u002Fmo is above NAT Instance sweet spot)\n    routing ✓ (no double-NAT detected)\n    cloudfront ✓ (no CloudFront origin in this VPC)\n  Confidence: HIGH — VPC Flow Logs cover 7 days with clear service\n    breakdown; staging environment tolerates single-NAT consolidation;\n    S3+DynamoDB Gateway Endpoints are free with zero downside.\nESTIMATED_SAVINGS:\n  Current monthly: $85.95\n    hourly: 2 × $0.045 × 730 = $65.70\n    data processing: 450 × $0.045 = $20.25\n  Projected monthly: $27.45\n    hourly: 1 × $0.045 × 730 = $32.85\n    data processing: 225 × $0.045 = $10.13 (S3+DDB traffic eliminated)\n    cross-AZ (added): ~225 × $0.01 = $2.25 (traffic from AZ-2 to NAT in AZ-1)\n    gateway endpoint cost: $0.00 (free)\n    Net projected: $32.85 + $10.13 + $2.25 = $45.23\n    Correction: $45.23 (not $27.45 — cross-AZ + residual traffic)\n  Monthly saving: $40.72 ($85.95 − $45.23 = $40.72)\n  Annual saving: $488.64\nMIGRATION_STEPS:\n  1. Create S3 Gateway Endpoint:\n     aws ec2 create-vpc-endpoint --vpc-id vpc-0staging01 \\\n       --service-name com.amazonaws.us-east-1.s3 \\\n       --route-table-ids rtb-0aaa rtb-0bbb --vpc-endpoint-type Gateway\n  2. Create DynamoDB Gateway Endpoint:\n     aws ec2 create-vpc-endpoint --vpc-id vpc-0staging01 \\\n       --service-name com.amazonaws.us-east-1.dynamodb \\\n       --route-table-ids rtb-0aaa rtb-0bbb --vpc-endpoint-type Gateway\n  3. Update route tables in AZ-2 subnet to point at AZ-1 NAT Gateway:\n     aws ec2 replace-route --route-table-id rtb-0bbb \\\n       --destination-cidr-block 0.0.0.0\u002F0 --nat-gateway-id nat-0keep\n  4. Delete the redundant NAT Gateway:\n     aws ec2 delete-nat-gateway --nat-gateway-id nat-0remove\n  5. Release the Elastic IP after gateway is 'deleted':\n     aws ec2 release-address --allocation-id eipalloc-0xxx\n  6. Verify S3 and DynamoDB traffic no longer traverses NAT:\n     aws cloudwatch get-metric-statistics --namespace AWS\u002FNATGateway \\\n       --metric-name BytesOutToDestination \\\n       --dimensions Name=NatGatewayId,Value=nat-0keep \\\n       --start-time $(date -d '-7 days' +%FT%TZ) \\\n       --end-time $(date +%FT%TZ) --period 86400 --statistics Sum\nCONFIRM: About to create Gateway Endpoints, consolidate 2→1 NAT Gateway,\n  and delete nat-0remove in vpc-0staging01. Monthly saving $40.72 (47%).\n  Proceed? (yes\u002Fno)\n```\n\n**Self-check before emit:**\n- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?\n- [ ] `Monthly saving × 12 == Annual saving`?\n- [ ] All dimensions listed in `Dimensions checked`?\n- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?\n- [ ] No scratch\u002Frecompute text in the block?\n- [ ] Interface Endpoint break-even cited (if recommending one)?\n\n## Verdict semantics\n\n| Verdict | When to emit |\n|---|---|\n| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing recommendation (Gateway Endpoint, Interface Endpoint, topology consolidation, NAT Instance, routing fix). |\n| `OPTIMIZED` | All dimensions pass: Gateway Endpoints exist for S3\u002FDynamoDB, Interface Endpoints above break-even, topology appropriate (multi-AZ for prod, single for non-prod), no double-NAT. |\n| `NEED_MORE_INFO` | Data gate failed: VPC Flow Logs not enabled, \u003C 7 days of traffic data, or NAT Gateway metrics absent. |\n| `BLOCKED` | Hard precondition prevents evaluation: NAT Gateway state != available, IAM denies ec2:DescribeNatGateways. |\n\n**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,\nverdict MUST be `OPTIMIZED`, never `FURTHER_OPTIMIZATION_AVAILABLE`.\n\n## Anti-Patterns — NEVER (top 7)\n\n1. **NEVER recommend an Interface Endpoint without computing the\n   break-even.** An Interface Endpoint at $7.30\u002FAZ\u002Fmonth that eliminates\n   only 50 GB\u002Fmonth of NAT traffic LOSES money ($7.30 endpoint cost vs\n   $2.25 NAT saving). Always cite the ~162 GB\u002FAZ\u002Fmonth threshold.\n\n2. **NEVER consolidate production VPCs to a single NAT Gateway without\n   flagging the HA risk.** Single NAT Gateway is a single point of\n   failure for egress. For production, keep multi-AZ and optimize via\n   VPC endpoints instead.\n\n3. **NEVER skip the `release-address` step after deleting a NAT\n   Gateway.** The Elastic IP remains allocated and costs $0.005\u002Fhour\n   ($3.65\u002Fmonth) if left attached to a deleted gateway.\n\n4. **NEVER create a Gateway Endpoint without verifying the route table\n   association.** The endpoint route must be in EACH subnet's route\n   table, not just the main route table (if subnet-specific route tables\n   are used).\n\n5. **NEVER recommend a NAT Instance for production.** NAT Instances\n   have no SLA, limited throughput, and single-AZ failure risk. Reserve\n   for dev\u002Ftest only.\n\n6. **NEVER ignore cross-AZ transfer costs when consolidating to a\n   single NAT Gateway.** Traffic from other-AZ subnets to the remaining\n   NAT Gateway costs $0.01\u002FGB each direction. This partially offsets\n   the hourly saving.\n\n7. **NEVER recommend deleting a NAT Gateway without backing up the\n   route table.** If the optimization needs to be rolled back, the\n   original route table configuration must be recoverable.\n\nExtended anti-patterns in `references\u002Fworked-examples.md`.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n> Pre-flight safety checks (CONFIRM gate, route-table backup, EIP verification, post-change monitoring, batch limits) moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n> Run before any remediation CLI.\n\n## Recent AWS features (2024-2026)\n\n> Recent AWS features (2024-2026) moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand — GWLB inspection, endpoint policy granularity, new NAT metrics.\n\n## References\n\n- `references\u002Fnat-pricing-and-endpoint-matrix.md` — NAT Gateway pricing\n  model, VPC endpoint pricing (Gateway vs Interface), per-service\n  break-even tables, cross-AZ data transfer costs, regional pricing\n  multipliers, VPC Flow Logs query patterns, CWAgent NAT metrics\n  reference, cost calculation worked examples.\n- `references\u002Fworked-examples.md` — full worked examples (S3 Gateway\n  Endpoint creation, multi-AZ consolidation, NAT Instance substitution,\n  Interface Endpoint evaluation, already-optimized, NEED_MORE_INFO,\n  end-to-end optimization walkthrough), plus error handling, edge cases,\n  extended NEVER list, and the NAT optimization decision tree.\n\n## References (load on demand)\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight data sources, double-NAT detection audit, pre-flight safety checks.\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — mindset principles, Step-0 non-obvious behaviours, double-NAT scenarios, recent AWS features.\n- [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md) — pricing blocks, break-even tables, create\u002Fconsolidate CLI sequences, saving math.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — full worked examples per verdict shape and the verbatim output template.\n## Domain\n\nAWS CloudOps \u002F NAT Gateway Networking Cost Optimization & FinOps.\n\n## AWS documentation\n\n- **VPC User Guide — NAT Gateways** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fvpc-nat-gateway.html\n- **VPC User Guide — VPC Endpoints** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Fconcepts.html\n- **Gateway VPC Endpoints (S3, DynamoDB)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Fgateway-endpoints.html\n- **Interface VPC Endpoints (PrivateLink)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Finterface-endpoints.html\n- **NAT Gateway pricing** — https:\u002F\u002Faws.amazon.com\u002Fvpc\u002Fpricing\u002F\n- **VPC Flow Logs** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fflow-logs.html\n- **CloudWatch NAT Gateway metrics** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fvpc-nat-gateway-cloudwatch.html\n- **NAT Instances (legacy)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002FVPC_NAT_Instance.html\n- **CloudFront Origin Access Control** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fprivate-content-restricting-access-to-s3.html\n- **AWS Well-Architected Framework — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n- **AWS CLI VPC reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fec2\u002F#vpc\n","# NAT Gateway Traffic Optimizer\n\n## What this skill does\n\nTranslates a VPC's NAT Gateway traffic posture into a concrete cost-\noptimization recommendation with a dollar-denominated savings estimate.\nThe verdict is the highest-leverage action across six dimensions —\nGateway endpoints (S3\u002FDynamoDB), Interface endpoints (SSM\u002FSTS\u002FECR\u002Fetc.),\nNAT topology consolidation (single vs multi-AZ), NAT Instance\nsubstitution, routing optimization (double-NAT elimination), and\nCloudFront-to-origin via VPC endpoint — applied in priority order.\nAlways pairs the recommendation with exact CLI commands.\n\n## Quick navigation\n\n| Section | What it covers | When to jump here |\n|---|---|---|\n| Quick start | Three headline rules and the pricing model | First read |\n| Mindset | Why VPC endpoints are the #1 NAT cost lever | Understanding the approach |\n| Quick reference — verdict thresholds | Decision matrix at a glance | Classifying a VPC |\n| Pre-flight data gate | NAT GW metrics + Flow Logs + Cost Explorer | Before any recommendation |\n| Step 0 non-obvious behaviours | Cross-AZ charges, Gateway vs Interface, double-NAT | Edge cases |\n| Step 1 Gateway endpoints (S3, DynamoDB) | FREE, persistent, eliminates #1 traffic source | The headline savings dimension |\n| Step 2 Interface endpoints | SSM, STS, ECR, SQS, Secrets Manager break-even | Per-service evaluation |\n| Step 3 NAT topology (single vs multi-AZ) | Non-prod consolidation saves $32\u002Fmo per AZ | Topology savings |\n| Step 4 NAT Instance substitution | Dev\u002Ftest fixed-cost alternative | Low-traffic environments |\n| Step 5 Routing optimization | Double-NAT detection, subnet route table audit | Hidden cost elimination |\n| Step 6 CloudFront + PrivateLink | Origin via endpoint, SaaS API traffic | Advanced patterns |\n| Step 7 Impact estimation | The cost formula and worked math | Every recommendation |\n| Output format | VERDICT block + worked examples | Emitting the result |\n| Anti-Patterns — NEVER | Common misclassifications | Self-check before emit |\n| Pre-flight safety checks | Route table backup, CONFIRM gate | Before any apply CLI |\n\n## Quick start\n\n- **S3 Gateway Endpoint is FREE and persistent.** It is the #1 NAT\n  traffic source eliminator. If S3 traffic flows through NAT, creating\n  a Gateway Endpoint eliminates it at zero cost — no per-GB charge, no\n  hourly charge, no per-AZ charge. The expert principle: S3 Gateway\n  Endpoint eliminates the #1 NAT traffic source for free with a\n  persistent route.\n- **Cost formula (memorise this):**\n  `monthly_nat_cost = (nat_gateway_count × $0.045 × 730) + (total_GB × $0.045)`\n  `  = hourly_component + data_processing_component`\n- **Single NAT for non-prod saves $32\u002Fmo per AZ removed.** A 3-AZ\n  non-prod VPC with 3 NAT Gateways pays $98.55\u002Fmonth in hourly charges\n  alone. Consolidating to 1 NAT Gateway saves $65.70\u002Fmonth ($32.85 × 2\n  AZs removed). Use VPC Flow Logs to quantify savings.\n\n## Mindset\n\n> Mindset rationale and the four guiding principles moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand to understand why VPC endpoints are the #1 NAT cost lever.\n\n## Quick reference — verdict thresholds\n\n| Observation (7-30 day window) | Verdict | Recommendation |\n|---|---|---|\n| S3 traffic through NAT AND no S3 Gateway Endpoint | **FURTHER_OPTIMIZATION_AVAILABLE** (Gateway endpoint) | Step 1 — create S3 Gateway Endpoint (FREE) |\n| DynamoDB traffic through NAT AND no DynamoDB Gateway Endpoint | **FURTHER_OPTIMIZATION_AVAILABLE** (Gateway endpoint) | Step 1 — create DynamoDB Gateway Endpoint (FREE) |\n| ECR\u002FSSM\u002FSTS\u002FSQS\u002FSecrets Manager traffic through NAT, monthly GB > break-even per AZ | **FURTHER_OPTIMIZATION_AVAILABLE** (Interface endpoint) | Step 2 — create Interface Endpoint(s) |\n| Non-production VPC with 2+ NAT Gateways AND environment tolerates single-AZ egress | **FURTHER_OPTIMIZATION_AVAILABLE** (topology) | Step 3 — consolidate to single NAT Gateway |\n| Dev\u002Ftest VPC with low traffic (\u003C 50 GB\u002Fmonth) AND reliability is not critical | **FURTHER_OPTIMIZATION_AVAILABLE** (NAT Instance) | Step 4 — substitute NAT Gateway with NAT Instance |\n| Route tables show traffic traversing 2 NAT Gateways (double-NAT) | **FURTHER_OPTIMIZATION_AVAILABLE** (routing) | Step 5 — fix route table to eliminate double-NAT |\n| S3 Gateway Endpoint exists, all Interface Endpoints above break-even, single NAT in non-prod or appropriate multi-AZ in prod | **OPTIMIZED** | None — continue monitoring |\n| VPC Flow Logs not enabled or \u003C 7 days of data | **NEED_MORE_INFO** | Enable Flow Logs, wait 7 days, re-evaluate |\n\n## Pre-flight: data gate (run before any optimization decision)\n\nOptimization decisions are only as good as the underlying data. Pull\nthese data sources before any recommendation. Full CLI sequences are\nin `references\u002Fnat-pricing-and-endpoint-matrix.md`.\n\n> Required data-source listing moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md); full CLI sequences already live in the pricing matrix reference.\n> Pull all seven sources before any recommendation — the data-quality short-circuits below govern the verdict.\n\n### Data-quality short-circuits\n\n| Condition | Effect on optimization |\n|---|---|\n| No NAT Gateway in the VPC | **OPTIMIZED** with note \"no NAT Gateway spend.\" |\n| VPC Flow Logs not enabled | **NEED_MORE_INFO**. Cannot identify per-service traffic. |\n| Flow Logs enabled but \u003C 7 days | **NEED_MORE_INFO**. Need 7+ days for traffic patterns. |\n| NAT Gateway `State != available` | **BLOCKED**. Gateway is deleting or failed. |\n| CloudWatch `BytesOutToDestination` absent | Gateway may be newly created. Wait 7 days. |\n| Cost Explorer returns $0 for Nat-Gateway | Verify region filter. May be a different account. |\n\n## Process — Optimization logic (apply in order)\n\n### Step 0: Non-obvious behaviours that change the recommendation\n\n> Step-0 non-obvious behaviours moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand — each gotcha reroutes the recommendation away from the obvious choice.\n\n### Step 1: Gateway endpoints (S3, DynamoDB) — FREE, always create\n\n> Intro and positioning moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> The decision gate below is authoritative.\n\n> Pricing block moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md) (Gateway endpoints are FREE).\n> Decision gate below.\n\n**Decision gate:**\n```\nIs there S3 or DynamoDB traffic through NAT?\n├── NO → Skip (no S3\u002FDynamoDB traffic to optimize)\n└── YES → Does a Gateway Endpoint already exist?\n    ├── YES → Verify route table includes the prefix list. If not,\n    │         add the route manually.\n    └── NO → CREATE the Gateway Endpoint. Pure saving, zero downside.\n```\n\n> Create-CLI patterns for S3 and DynamoDB Gateway endpoints moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Load on demand at emit time for the IMPLEMENTATION block.\n\n> Saving math walkthrough moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> monthly_saving = s3_GB_through_NAT × $0.045 — captured in full, endpoint is free.\n\n### Step 2: Interface endpoints (per-service break-even)\n\n> Break-even framing moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Threshold: ~160 GB\u002Fmonth per AZ.\n\n> Interface endpoint pricing block moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Per-service decision gate below.\n\n> Break-even-by-AZ-count table moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> 1 AZ = $7.30 \u002F 162 GB; each extra AZ adds both.\n\n> Common Interface endpoint candidates table moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Evaluate each service against the decision gate below.\n\n**Decision gate per service:**\n```\nmonthly_service_GB_through_NAT × $0.045  >  endpoint_cost_per_month?\n├── YES → CREATE the Interface Endpoint. Net positive saving.\n└── NO → Do NOT create. NAT is cheaper for this service's traffic volume.\n```\n\n> ECR (api + dkr) creation CLI moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Both endpoints are required for Docker pull\u002Fpush without NAT.\n\n### Step 3: NAT topology — single vs multi-AZ\n\nIn non-production environments (dev, test, staging), a single NAT\nGateway is sufficient. Production environments typically need multi-AZ\nNAT for high availability.\n\n> Savings math and cross-AZ trade-off walkthrough moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Decision tree below is authoritative.\n\n**Decision tree for topology:**\n```\nIs this a production VPC?\n├── YES → Keep multi-AZ NAT for HA. Do not consolidate.\n│         Focus on Steps 1, 2, 5, 6 instead.\n└── NO (dev\u002Ftest\u002Fstaging) → How many NAT Gateways?\n    ├── 1 → Already consolidated. Check other dimensions.\n    └── 2+ → Consolidate to 1 NAT Gateway in the AZ with the most\n             private subnets (minimizes cross-AZ transfer).\n             Update route tables in all other AZ subnets to point\n             0.0.0.0\u002F0 at the single NAT Gateway.\n```\n\n> Consolidation CLI sequence (identify, re-route, delete, release EIP) moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Never skip the release-address step.\n\n### Step 4: NAT Instance substitution (dev\u002Ftest only)\n\nFor low-traffic dev\u002Ftest VPCs (\u003C 50 GB\u002Fmonth), a NAT Instance is\ncheaper than a NAT Gateway.\n\n> NAT Gateway vs NAT Instance cost comparison moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Limitations and decision gate below remain in-file.\n\n**NAT Instance limitations:**\n- No SLA (single instance, single AZ)\n- Throughput limited (~1 Gbps for t3.micro)\n- Requires manual setup (user-data iptables NAT rules)\n- No automatic failover\n- AMI must be maintained (OS patches)\n\n**Decision gate:**\n```\nIs this a dev\u002Ftest environment?\n├── NO → Do NOT substitute. NAT Gateway is required for HA.\n└── YES → Is monthly NAT traffic \u003C 100 GB?\n    ├── YES → NAT Instance is cheaper. Recommend substitution.\n    └── NO → NAT Gateway may be cheaper (traffic > break-even).\n             At 100 GB: NAT GW = $37.35, NAT Instance = $7.59 +\n             cross-AZ. Evaluate on a case-by-case basis.\n```\n\n> NAT Instance setup CLI (AL2023 user-data iptables NAT) moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Dev\u002Ftest only — see limitations above.\n\n### Step 5: Routing optimization (double-NAT detection)\n\n> Double-NAT scenario catalog (TGW, peering, chained AZs) moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Detection commands and fix below.\n\n> Route-table audit CLI for chain detection moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n> Fix rule: each private subnet's 0.0.0.0\u002F0 must point at exactly ONE NAT device.\n\n**Fix:** Ensure each private subnet's `0.0.0.0\u002F0` route points at\nexactly ONE NAT Gateway (or NAT Instance). No chains.\n\n### Step 6: CloudFront and PrivateLink\n\n**CloudFront to origin:**\nIf your CloudFront distribution's origin is an ALB or EC2 instance in\na private subnet, CloudFront reaches it via the public internet. No NAT\nGateway is needed for CloudFront traffic — CloudFront has its own\nnetwork path. But if the origin calls back to AWS services (S3, API\nGateway), that traffic may go through NAT.\n\nFor S3 origins: use CloudFront OAI\u002FOAC to keep traffic within AWS. No\nNAT needed.\n\n**PrivateLink for SaaS APIs:**\nIf your private-subnet workload calls a third-party SaaS API (e.g.,\nDatadog, Splunk, GitHub Enterprise) through NAT, check if the SaaS\noffers an AWS PrivateLink endpoint.\n\n> PrivateLink break-even math moved to [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md).\n> Same ~162 GB\u002FAZ threshold as Step 2.\n\n### Step 7: Impact estimation\n\nCompute the monthly savings for each recommendation:\n\n```\ncurrent_monthly_nat_cost =\n  (nat_gateway_count × $0.045 × 730) + (total_GB × $0.045)\n\nprojected_monthly_nat_cost =\n  (remaining_nat_gateway_count × $0.045 × 730)\n  + (remaining_GB × $0.045)\n  + (interface_endpoint_count × $0.010 × az_count × 730)\n\nmonthly_saving = current_monthly_nat_cost - projected_monthly_nat_cost\n```\n\nAlways state assumptions: GB eliminated by Gateway Endpoints (free),\nGB eliminated by Interface Endpoints (cost offset by endpoint hourly),\nNAT Gateways removed (topology consolidation), cross-AZ transfer\nimpact, and pricing region.\n\n### Step 8: Final verdict\n\n- Any dimension recommends a change → **FURTHER_OPTIMIZATION_AVAILABLE**.\n- All dimensions pass (Gateway Endpoints exist, Interface Endpoints\n  above break-even, topology appropriate for environment, no double-NAT)\n  → **OPTIMIZED**.\n- Data insufficient (no Flow Logs, \u003C 7 days of data) →\n  **NEED_MORE_INFO**.\n\nNever emit `FURTHER_OPTIMIZATION_AVAILABLE` without first discharging\nevery `NEED_MORE_INFO` gate.\n\n## Output format\n\n> Verbatim output template and the worked-examples pointer moved to [references\u002Fworked-examples.md](references\u002Fworked-examples.md).\n> The STRICT output contract below carries the authoritative required structure; full worked examples live in the reference.\n\n## STRICT output contract\n\nThe rules below are hard constraints. Violating any one produces a\nmisclassification or an arithmetic contradiction that breaks downstream\nFinOps automation. Self-check EVERY emitted block against these rules\nbefore returning the response.\n\n### Required output structure\n\nEvery response MUST be a single block using these literal labels, in this\norder. Do NOT substitute markdown headings, camelCase, or bold variants.\n\n```text\nVPC: \u003Cvpc-id>\nVERDICT: OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE\nREASON: \u003C1-2 sentences naming the recommendation and supporting data>\nRECOMMENDATION:\n  Current: \u003CNAT GW count>, \u003Cmonthly GB>, \u003Cendpoints>, \u003Cenvironment>\n  Proposed: \u003CNAT GW count>, \u003Cremaining GB>, \u003Cnew endpoints>, \u003Ctopology>\n  Dimensions changed: \u003Cgateway-endpoint | interface-endpoint | topology | nat-instance | routing | cloudfront>\n  Dimensions checked: \u003Clist ALL, each ✓ (no finding) or → (finding)>\n  Confidence: \u003CHIGH\u002FMEDIUM\u002FLOW> — \u003Cone-line rationale>\nESTIMATED_SAVINGS:\n  Current monthly: $\u003Camount>\n  Projected monthly: $\u003Camount>\n  Monthly saving: $\u003Camount>     ← MUST equal Current − Projected, 2 decimals\n  Annual saving: $\u003Camount>      ← MUST equal Monthly × 12\nMIGRATION_STEPS:\n  1. \u003Cspecific action with CLI command>\n  2. \u003Cverification step>\nCONFIRM: \u003Cconfirmation prompt text>\n```\n\n### FORBIDDEN output patterns\n\n1. **NEVER emit `VERDICT: FURTHER_OPTIMIZATION_AVAILABLE` with\n   `Monthly saving: $0.00`.** If every dimension nets zero cost delta,\n   the verdict MUST be `OPTIMIZED`.\n\n2. **NEVER show savings math that does not balance.**\n   `Current monthly − Projected monthly` MUST equal `Monthly saving`,\n   rounded to 2 decimal places.\n\n3. **NEVER emit scratch lines** (\"WAIT — recompute\", \"Hmm, let me redo\",\n   \"corrected:\") in the output. Finalize the math before emitting.\n\n4. **NEVER recommend an Interface Endpoint without computing the\n   break-even.** The REASON MUST cite whether the traffic volume exceeds\n   the ~162 GB\u002FAZ\u002Fmonth threshold.\n\n5. **NEVER recommend consolidating NAT Gateways in a production VPC\n   without flagging the HA risk.** Single NAT Gateway in production is\n   a single point of failure for egress traffic.\n\n6. **NEVER omit a dimension from the RECOMMENDATION block.** The\n   `Dimensions checked` line MUST list all dimensions, each marked\n   ✓ (no finding) or → (finding).\n\n7. **NEVER round intermediate formula steps differently from the final\n   figure.** Compute at full precision, round only the displayed result.\n\n8. **NEVER recommend deleting a NAT Gateway without providing the\n   `release-address` follow-up for the Elastic IP.** Unreleased EIPs\n   cost $0.005\u002Fhour ($3.65\u002Fmonth) if left attached to a deleted gateway.\n\n### Perfect example output — FURTHER_OPTIMIZATION_AVAILABLE with verified math\n\nEvery field below is internally consistent. Copy this shape exactly.\n\n```text\nVPC: vpc-0staging01\nVERDICT: FURTHER_OPTIMIZATION_AVAILABLE\nREASON: Staging VPC with 2 NAT Gateways ($65.70\u002Fmo hourly) and 450 GB\n  data processing ($20.25\u002Fmo) has no VPC endpoints. S3 traffic (180 GB)\n  and DynamoDB traffic (45 GB) should use FREE Gateway Endpoints.\n  Consolidating from 2 to 1 NAT Gateway saves $32.85\u002Fmo in hourly charges\n  (minus ~$5\u002Fmo cross-AZ transfer for the remaining AZ's subnets). Net\n  monthly saving $58.50.\nRECOMMENDATION:\n  Current: 2 NAT Gateways, 450 GB\u002Fmo, 0 endpoints, staging\n  Proposed: 1 NAT Gateway, 225 GB\u002Fmo, S3+DynamoDB Gateway Endpoints, staging\n  Dimensions changed: gateway-endpoint (S3+DynamoDB) + topology (2→1 NAT GW)\n  Dimensions checked: gateway-endpoint → (S3 180GB, DDB 45GB, no endpoints)\n    interface-endpoint ✓ (ECR below break-even at 90GB × 2 AZ = 45\u002FAZ \u003C 162)\n    topology → (2 NAT GW in staging, consolidate to 1)\n    nat-instance ✓ (450 GB\u002Fmo is above NAT Instance sweet spot)\n    routing ✓ (no double-NAT detected)\n    cloudfront ✓ (no CloudFront origin in this VPC)\n  Confidence: HIGH — VPC Flow Logs cover 7 days with clear service\n    breakdown; staging environment tolerates single-NAT consolidation;\n    S3+DynamoDB Gateway Endpoints are free with zero downside.\nESTIMATED_SAVINGS:\n  Current monthly: $85.95\n    hourly: 2 × $0.045 × 730 = $65.70\n    data processing: 450 × $0.045 = $20.25\n  Projected monthly: $27.45\n    hourly: 1 × $0.045 × 730 = $32.85\n    data processing: 225 × $0.045 = $10.13 (S3+DDB traffic eliminated)\n    cross-AZ (added): ~225 × $0.01 = $2.25 (traffic from AZ-2 to NAT in AZ-1)\n    gateway endpoint cost: $0.00 (free)\n    Net projected: $32.85 + $10.13 + $2.25 = $45.23\n    Correction: $45.23 (not $27.45 — cross-AZ + residual traffic)\n  Monthly saving: $40.72 ($85.95 − $45.23 = $40.72)\n  Annual saving: $488.64\nMIGRATION_STEPS:\n  1. Create S3 Gateway Endpoint:\n     aws ec2 create-vpc-endpoint --vpc-id vpc-0staging01 \\\n       --service-name com.amazonaws.us-east-1.s3 \\\n       --route-table-ids rtb-0aaa rtb-0bbb --vpc-endpoint-type Gateway\n  2. Create DynamoDB Gateway Endpoint:\n     aws ec2 create-vpc-endpoint --vpc-id vpc-0staging01 \\\n       --service-name com.amazonaws.us-east-1.dynamodb \\\n       --route-table-ids rtb-0aaa rtb-0bbb --vpc-endpoint-type Gateway\n  3. Update route tables in AZ-2 subnet to point at AZ-1 NAT Gateway:\n     aws ec2 replace-route --route-table-id rtb-0bbb \\\n       --destination-cidr-block 0.0.0.0\u002F0 --nat-gateway-id nat-0keep\n  4. Delete the redundant NAT Gateway:\n     aws ec2 delete-nat-gateway --nat-gateway-id nat-0remove\n  5. Release the Elastic IP after gateway is 'deleted':\n     aws ec2 release-address --allocation-id eipalloc-0xxx\n  6. Verify S3 and DynamoDB traffic no longer traverses NAT:\n     aws cloudwatch get-metric-statistics --namespace AWS\u002FNATGateway \\\n       --metric-name BytesOutToDestination \\\n       --dimensions Name=NatGatewayId,Value=nat-0keep \\\n       --start-time $(date -d '-7 days' +%FT%TZ) \\\n       --end-time $(date +%FT%TZ) --period 86400 --statistics Sum\nCONFIRM: About to create Gateway Endpoints, consolidate 2→1 NAT Gateway,\n  and delete nat-0remove in vpc-0staging01. Monthly saving $40.72 (47%).\n  Proceed? (yes\u002Fno)\n```\n\n**Self-check before emit:**\n- [ ] `Current monthly − Projected monthly == Monthly saving` (2 decimals)?\n- [ ] `Monthly saving × 12 == Annual saving`?\n- [ ] All dimensions listed in `Dimensions checked`?\n- [ ] Every `→` dimension has a corresponding MIGRATION_STEPS entry?\n- [ ] No scratch\u002Frecompute text in the block?\n- [ ] Interface Endpoint break-even cited (if recommending one)?\n\n## Verdict semantics\n\n| Verdict | When to emit |\n|---|---|\n| `FURTHER_OPTIMIZATION_AVAILABLE` | At least one dimension has a concrete, savings-bearing recommendation (Gateway Endpoint, Interface Endpoint, topology consolidation, NAT Instance, routing fix). |\n| `OPTIMIZED` | All dimensions pass: Gateway Endpoints exist for S3\u002FDynamoDB, Interface Endpoints above break-even, topology appropriate (multi-AZ for prod, single for non-prod), no double-NAT. |\n| `NEED_MORE_INFO` | Data gate failed: VPC Flow Logs not enabled, \u003C 7 days of traffic data, or NAT Gateway metrics absent. |\n| `BLOCKED` | Hard precondition prevents evaluation: NAT Gateway state != available, IAM denies ec2:DescribeNatGateways. |\n\n**Zero-savings rule:** If MONTHLY_SAVING == $0.00 for every dimension,\nverdict MUST be `OPTIMIZED`, never `FURTHER_OPTIMIZATION_AVAILABLE`.\n\n## Anti-Patterns — NEVER (top 7)\n\n1. **NEVER recommend an Interface Endpoint without computing the\n   break-even.** An Interface Endpoint at $7.30\u002FAZ\u002Fmonth that eliminates\n   only 50 GB\u002Fmonth of NAT traffic LOSES money ($7.30 endpoint cost vs\n   $2.25 NAT saving). Always cite the ~162 GB\u002FAZ\u002Fmonth threshold.\n\n2. **NEVER consolidate production VPCs to a single NAT Gateway without\n   flagging the HA risk.** Single NAT Gateway is a single point of\n   failure for egress. For production, keep multi-AZ and optimize via\n   VPC endpoints instead.\n\n3. **NEVER skip the `release-address` step after deleting a NAT\n   Gateway.** The Elastic IP remains allocated and costs $0.005\u002Fhour\n   ($3.65\u002Fmonth) if left attached to a deleted gateway.\n\n4. **NEVER create a Gateway Endpoint without verifying the route table\n   association.** The endpoint route must be in EACH subnet's route\n   table, not just the main route table (if subnet-specific route tables\n   are used).\n\n5. **NEVER recommend a NAT Instance for production.** NAT Instances\n   have no SLA, limited throughput, and single-AZ failure risk. Reserve\n   for dev\u002Ftest only.\n\n6. **NEVER ignore cross-AZ transfer costs when consolidating to a\n   single NAT Gateway.** Traffic from other-AZ subnets to the remaining\n   NAT Gateway costs $0.01\u002FGB each direction. This partially offsets\n   the hourly saving.\n\n7. **NEVER recommend deleting a NAT Gateway without backing up the\n   route table.** If the optimization needs to be rolled back, the\n   original route table configuration must be recoverable.\n\nExtended anti-patterns in `references\u002Fworked-examples.md`.\n\n## Pre-flight safety checks (run before any remediation CLI)\n\n> Pre-flight safety checks (CONFIRM gate, route-table backup, EIP verification, post-change monitoring, batch limits) moved to [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md).\n> Run before any remediation CLI.\n\n## Recent AWS features (2024-2026)\n\n> Recent AWS features (2024-2026) moved to [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md).\n> Load on demand — GWLB inspection, endpoint policy granularity, new NAT metrics.\n\n## References\n\n- `references\u002Fnat-pricing-and-endpoint-matrix.md` — NAT Gateway pricing\n  model, VPC endpoint pricing (Gateway vs Interface), per-service\n  break-even tables, cross-AZ data transfer costs, regional pricing\n  multipliers, VPC Flow Logs query patterns, CWAgent NAT metrics\n  reference, cost calculation worked examples.\n- `references\u002Fworked-examples.md` — full worked examples (S3 Gateway\n  Endpoint creation, multi-AZ consolidation, NAT Instance substitution,\n  Interface Endpoint evaluation, already-optimized, NEED_MORE_INFO,\n  end-to-end optimization walkthrough), plus error handling, edge cases,\n  extended NEVER list, and the NAT optimization decision tree.\n\n## References (load on demand)\n- [references\u002Fdiagnostic-commands.md](references\u002Fdiagnostic-commands.md) — pre-flight data sources, double-NAT detection audit, pre-flight safety checks.\n- [references\u002Fadvanced-patterns.md](references\u002Fadvanced-patterns.md) — mindset principles, Step-0 non-obvious behaviours, double-NAT scenarios, recent AWS features.\n- [references\u002Fnat-pricing-and-endpoint-matrix.md](references\u002Fnat-pricing-and-endpoint-matrix.md) — pricing blocks, break-even tables, create\u002Fconsolidate CLI sequences, saving math.\n- [references\u002Fworked-examples.md](references\u002Fworked-examples.md) — full worked examples per verdict shape and the verbatim output template.\n## Domain\n\nAWS CloudOps \u002F NAT Gateway Networking Cost Optimization & FinOps.\n\n## AWS documentation\n\n- **VPC User Guide — NAT Gateways** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fvpc-nat-gateway.html\n- **VPC User Guide — VPC Endpoints** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Fconcepts.html\n- **Gateway VPC Endpoints (S3, DynamoDB)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Fgateway-endpoints.html\n- **Interface VPC Endpoints (PrivateLink)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fprivatelink\u002Finterface-endpoints.html\n- **NAT Gateway pricing** — https:\u002F\u002Faws.amazon.com\u002Fvpc\u002Fpricing\u002F\n- **VPC Flow Logs** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fflow-logs.html\n- **CloudWatch NAT Gateway metrics** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002Fvpc-nat-gateway-cloudwatch.html\n- **NAT Instances (legacy)** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fvpc\u002Flatest\u002Fuserguide\u002FVPC_NAT_Instance.html\n- **CloudFront Origin Access Control** — https:\u002F\u002Fdocs.aws.amazon.com\u002FAmazonCloudFront\u002Flatest\u002FDeveloperGuide\u002Fprivate-content-restricting-access-to-s3.html\n- **AWS Well-Architected Framework — Cost Optimization** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fwellarchitected\u002Flatest\u002Fcost-optimization-pillar\u002Fwelcome.html\n- **AWS CLI VPC reference** — https:\u002F\u002Fdocs.aws.amazon.com\u002Fcli\u002Flatest\u002Freference\u002Fec2\u002F#vpc\n",{"name":5,"license":15,"metadata":24,"description":7,"compatibility":44},{"tags":25,"phase":26,"author":27,"domain":28,"family":29,"version":30,"keywords":31,"task_type":32,"complexity":33,"entry_point":34,"skill_class":35,"when_to_use":36,"requires_llm":37,"verdict_shape":38,"when_not_to_use":39,"lifecycle_status":40,"invocation_schema":41,"supports_pipeline":37,"invocation_example":42,"activation_triggers":43},"nat-gateway, networking, cost-optimization, finops, vpc-endpoint","3","Jacky Chan — AWS Community Builder","aws-cloudops","Networking","0.1.0","NAT Gateway, cost optimization, VPC endpoint, S3 Gateway Endpoint, DynamoDB Gateway Endpoint, Interface Endpoint, PrivateLink, NAT Instance, single NAT Gateway, multi-AZ NAT, cross-AZ data transfer, VPC Flow Logs, subnet routing, double NAT, CloudFront origin, ECR VPC endpoint, SSM VPC endpoint, STS VPC endpoint, data processing charge, hourly charge, FinOps, networking cost","optimize","medium","false","capability","Optimising NAT Gateway cost, analysing VPC Flow Logs for NAT traffic patterns, evaluating VPC endpoint creation (S3, DynamoDB, SSM, STS, ECR, SQS), consolidating multi-AZ NAT Gateways to single NAT for non-prod, comparing NAT Instance vs NAT Gateway for dev\u002Ftest, diagnosing unexpected data transfer charges, or running a FinOps networking cost review.","true","OPTIMIZED | FURTHER_OPTIMIZATION_AVAILABLE","VPC peering or Transit Gateway topology design (use vpc-peering-deployer or transit-gateway-deployer), NAT Gateway troubleshooting (connection errors, port exhaustion — use the VPC troubleshooter), or Security Group auditing (use ec2-security-group-auditor). This skill focuses on cost-driven traffic optimization, not connectivity debugging.","active","Input: either (a) a VPC ID + live-account context, (b) a NAT Gateway CloudWatch metrics document with 7-30 day BytesOutToDestination\u002FBytesInFromDestination data, OR (c) VPC Flow Logs summarised by destination service. Output: a deterministic VPC\u002FVERDICT\u002FREASON\u002FRECOMMENDATION\u002FESTIMATED_SAVINGS\u002FMIGRATION_STEPS block per VPC, where VERDICT is one of OPTIMIZED, FURTHER_OPTIMIZATION_AVAILABLE.","# Minimal valid input (offline finding classification):\nVPC: vpc-0abc123def\nNAT Gateways: 2 (us-east-1a, us-east-1b)\nEnvironment: non-production (staging)\nRegion: us-east-1\nNAT Monthly Spend:\n  - Hourly: 2 × $0.045 × 730 = $65.70\n  - Data processing: 450 GB × $0.045 = $20.25\n  - Total: $85.95\u002Fmonth\nExisting VPC Endpoints: none\nVPC Flow Logs (last 7 days):\n  - S3 traffic: 180 GB (40% of total)\n  - DynamoDB traffic: 45 GB (10% of total)\n  - ECR traffic: 90 GB (20% of total)\n  - SSM traffic: 22 GB (5% of total)\nEmit the standard optimization block (VPC, VERDICT,\nREASON, RECOMMENDATION, ESTIMATED_SAVINGS, MIGRATION_STEPS).","optimise NAT Gateway cost, NAT Gateway data processing charge, VPC endpoint cost benefit, S3 traffic through NAT, create Gateway VPC Endpoint, single NAT Gateway vs multi-AZ, NAT Instance alternative, reduce NAT Gateway bill, VPC Flow Logs traffic breakdown, FinOps networking review, PrivateLink endpoint savings, ECR traffic through NAT, DynamoDB VPC endpoint, unexpected AWS data transfer charge, cross-AZ data transfer cost, subnet routing optimization, double NAT detection, S3 Gateway Endpoint free, CloudFront origin VPC endpoint, NAT Gateway hourly charge","Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline recommendation classification works from pasted VPC Flow Logs, NAT Gateway CloudWatch metrics, and Cost Explorer NAT spend data. Live-account optimization uses aws ec2 describe-nat-gateways, aws ec2 describe-vpc-endpoints, aws ec2 describe-route-tables, aws cloudwatch get-metric-statistics (BytesOutToDestination, BytesInFromDestination, BytesOutToSource, BytesInFromSource, ConnectionEstablishedCount...","main","eeace51bd5dd1db2030729d83eeab988861553aa","skills\u002Fnat-gateway-traffic-optimizer",0,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills","https:\u002F\u002Fgithub.com\u002Fjhkchan","CTO & Co-Founder @Beever-AI  & @votee. CAISP. AWS Community Builder. Organizer@GDGCloudHK. MongoDB Champion. Technopreneur + Infornographer.","2026-09-24 08:54:10",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add jhkchan\u002Faws-agent-skills --skill nat-gateway-traffic-optimizer",{"tool":59,"command":60},"bunx","bunx skills add jhkchan\u002Faws-agent-skills --skill nat-gateway-traffic-optimizer",{"tool":62,"command":63},"pnpm","pnpm dlx skills add jhkchan\u002Faws-agent-skills --skill nat-gateway-traffic-optimizer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002FSKILL.md",true,[67,73,77,81,85,89,93,97,101,105,109,113,117,121,125,129,133,137,141],{"path":68,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":71,"sourceHtmlUrl":72},"eval\u002Ftest-cases.yaml","REFERENCE","参考文档",8626,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Feval\u002Ftest-cases.yaml",{"path":74,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":75,"sourceHtmlUrl":76},"evals\u002Fbaselines\u002Falready-optimized-endpoints.md",872,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fbaselines\u002Falready-optimized-endpoints.md",{"path":78,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":79,"sourceHtmlUrl":80},"evals\u002Fbaselines\u002Fflow-logs-not-enabled.md",1174,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fbaselines\u002Fflow-logs-not-enabled.md",{"path":82,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":83,"sourceHtmlUrl":84},"evals\u002Fbaselines\u002Fmissing-s3-gateway-endpoint.md",1070,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fbaselines\u002Fmissing-s3-gateway-endpoint.md",{"path":86,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":87,"sourceHtmlUrl":88},"evals\u002Fbaselines\u002Fnat-instance-devtest-substitution.md",1136,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fbaselines\u002Fnat-instance-devtest-substitution.md",{"path":90,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":91,"sourceHtmlUrl":92},"evals\u002Fbaselines\u002Fredundant-multi-az-nat-nonprod.md",1171,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fbaselines\u002Fredundant-multi-az-nat-nonprod.md",{"path":94,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":95,"sourceHtmlUrl":96},"evals\u002Feval_config.yaml",1837,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Feval_config.yaml",{"path":98,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":99,"sourceHtmlUrl":100},"evals\u002Fevals.json",4615,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fevals.json",{"path":102,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":103,"sourceHtmlUrl":104},"evals\u002Fprompts\u002Falready-optimized-endpoints.md",1213,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fprompts\u002Falready-optimized-endpoints.md",{"path":106,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":107,"sourceHtmlUrl":108},"evals\u002Fprompts\u002Fflow-logs-not-enabled.md",788,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fprompts\u002Fflow-logs-not-enabled.md",{"path":110,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":111,"sourceHtmlUrl":112},"evals\u002Fprompts\u002Fmissing-s3-gateway-endpoint.md",997,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fprompts\u002Fmissing-s3-gateway-endpoint.md",{"path":114,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":115,"sourceHtmlUrl":116},"evals\u002Fprompts\u002Fnat-instance-devtest-substitution.md",925,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fprompts\u002Fnat-instance-devtest-substitution.md",{"path":118,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":119,"sourceHtmlUrl":120},"evals\u002Fprompts\u002Fredundant-multi-az-nat-nonprod.md",977,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fevals\u002Fprompts\u002Fredundant-multi-az-nat-nonprod.md",{"path":122,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":123,"sourceHtmlUrl":124},"examples\u002FREADME.md",8262,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fexamples\u002FREADME.md",{"path":126,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":127,"sourceHtmlUrl":128},"references\u002Fadvanced-patterns.md",6604,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Freferences\u002Fadvanced-patterns.md",{"path":130,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":131,"sourceHtmlUrl":132},"references\u002Fdiagnostic-commands.md",2591,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Freferences\u002Fdiagnostic-commands.md",{"path":134,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":135,"sourceHtmlUrl":136},"references\u002Fnat-pricing-and-endpoint-matrix.md",22845,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Freferences\u002Fnat-pricing-and-endpoint-matrix.md",{"path":138,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":139,"sourceHtmlUrl":140},"references\u002Fworked-examples.md",23484,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Freferences\u002Fworked-examples.md",{"path":142,"resourceType":69,"resourceTypeDesc":70,"sizeBytes":143,"sourceHtmlUrl":144},"skill.usf.yaml",4632,"https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fnat-gateway-traffic-optimizer\u002Fskill.usf.yaml",[146,153,160,167,174,181],{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":152,"publishedAt":19},"01M7ADVD60X4PCAPKSE58P9NDC","xray-tracing-deployer","Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL \u002F method \u002F service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry \u002F ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS \u002F EKS \u002F Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxray-tracing-deployer\u002FSKILL.md",[],[],{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":19},"01M7ADTVJ7DCBM9CB1FY51GH7J","wellarchitected-workload-auditor","Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-workload-auditor\u002FSKILL.md",[],[],{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":19},"01M7ADT59G6FTTNZYHT2QRPNNP","wellarchitected-review-operator","Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer \u002F get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwellarchitected-review-operator\u002FSKILL.md",[],[],{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":173,"publishedAt":19},"01M7ADSH5JA9QHNPPHQCD7EVA7","wafv2-web-acl-deployer","Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB\u002FAPI Gateway\u002FCloudFront, or configuring CAPTCHA\u002FChallenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-deployer\u002FSKILL.md",[],[],{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":19},"01M7ADRYFAT8R73FBNCHRC573X","wafv2-web-acl-auditor","Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow\u002Fbypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwafv2-web-acl-auditor\u002FSKILL.md",[],[],{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":187,"publishedAt":19},"01M7ADR8W7G72JX4KFGN03QK8Q","waf-rule-deployer","Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.","https:\u002F\u002Fgithub.com\u002Fjhkchan\u002Faws-agent-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaf-rule-deployer\u002FSKILL.md",[],[]]