Skip to content

feat(#225): wire live NAT Gateway pricing (Infracost EC2 → stored under VPC) - #229

Merged
elecnix merged 1 commit into
mainfrom
feat/225-nat-gateway-descriptor
Jul 3, 2026
Merged

feat(#225): wire live NAT Gateway pricing (Infracost EC2 → stored under VPC)#229
elecnix merged 1 commit into
mainfrom
feat/225-nat-gateway-descriptor

Conversation

@elecnix

@elecnix elecnix commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #225. NAT Gateway had no live Infracost descriptor — it was commented out as "TBD" because it isn't under a standard AmazonVPC productFamily. It's actually priced under AmazonEC2 / "NAT Gateway" (operation=NatGateway, distinguishing it from RegionalNatGateway), while the handler and seed model it under AmazonVPC.

Two small, general descriptor capabilities

  • store_service — upsert fetched rows under a different catalog service than the one queried (AmazonEC2AmazonVPC), so the engine/handler query finds them.
  • usagetype_exclude — drop sibling usagetypes that share the metric's unit. Here NAT Gateway's data-processed GB unit is shared by a $0 NatGateway-Prvd-Bytes (provisioned-throughput) row that would otherwise dilute the rate.

Descriptors

Metric Query Stored under
NAT-Gateway-Hour AmazonEC2/"NAT Gateway", op=NatGateway, Hrs AmazonVPC
NAT-Gateway-DataProcessed same, GB, exclude Prvd AmazonVPC

Live end-to-end validation (real cache + catalog)

  • Hourly: 730h = $32.85 ($0.045/hr); Data: 100 GB = $4.50 ($0.045/GB) — both stored under AmazonVPC.
  • _nat_cost(730, 100) = $37.35, matching the handler's existing expectation.
  • Verified across regions during discovery (us-east-1 bare NatGateway-Hours, EU-NatGateway-Hours, APS3-NatGateway-Hours — the APS3 for ap-south-1 also confirms the fix: correct ap-southeast-3 usagetype prefix; drop duplicate registry/seed rows #221 prefix fix).

Test plan (HTTP mocked)

  • Descriptor presence (service/store_service/family).
  • Service remap AmazonEC2AmazonVPC.
  • Prvd row exclusion for data-processed.
  • Full suite: 913 passed locally.

…er VPC)

NAT Gateway had no live descriptor — it was commented out as "TBD" because it
isn't under a standard AmazonVPC productFamily. It is priced under service
AmazonEC2 / productFamily "NAT Gateway" (operation=NatGateway, distinguishing it
from RegionalNatGateway), but the handler and seed model it under AmazonVPC.

Two small, general descriptor capabilities support this:
- store_service: upsert fetched rows under a different catalog service than the
  one queried (AmazonEC2 → AmazonVPC), so the engine/handler query finds them.
- usagetype_exclude: drop sibling usagetypes sharing the metric's unit — here the
  $0 "Prvd" (provisioned-throughput) GB row that would otherwise dilute the
  data-processed rate.

Descriptors added:
- NAT-Gateway-Hour        AmazonEC2/"NAT Gateway", op=NatGateway, Hrs  → AmazonVPC
- NAT-Gateway-DataProcessed  same, GB, exclude "Prvd"                  → AmazonVPC

Live end-to-end (real cache+catalog): 730h = $32.85, 100GB = $4.50,
_nat_cost(730,100) = $37.35 — all under AmazonVPC, matching the handler's query.

Tests (HTTP mocked): descriptor presence, service remap AmazonEC2→AmazonVPC, and
the Prvd-row exclusion for data-processed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@elecnix
elecnix marked this pull request as ready for review July 3, 2026 17:00
@elecnix
elecnix merged commit 89f852f into main Jul 3, 2026
3 checks passed
@elecnix
elecnix deleted the feat/225-nat-gateway-descriptor branch July 3, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pricing: NAT Gateway has no live Infracost descriptor (seed-only)

1 participant