Skip to content

feat: surface public IPv4 address charges on attached IPs #129

@babyhuey

Description

@babyhuey

Description

Since Feb 2024, AWS charges $0.005/hour (~$3.65/month) for every public IPv4 address in use, not just unassociated Elastic IPs. aws-doctor currently only flags unassociated EIPs, which misses the much larger category of IPs attached to EC2 instances, NAT Gateways, ELBs, RDS publicly accessible endpoints, and EKS nodes.

The goal is not necessarily to flag every attached IP as "waste" (many are legitimately needed) but to surface the charge so users know what they're paying for and can decide whether to switch to IPv6, private endpoints, or NAT for outbound.

Things to consider

  • Simple first pass: enumerate all public IPv4 addresses in the account (EC2 instances with PublicIpAddress, EIPs, ENIs with Association.PublicIp, NAT Gateway public IPs) and report total count × $0.005/hr.
  • Stretch: flag IPs that appear unused relative to the resource they're on (e.g. EC2 instance idle per feat: detect idle running EC2 instances #126, NAT Gateway idle already covered, etc).
  • Pricing: region-aware rate already available via the Pricing API integration from feat: use AWS Pricing API for region-aware cost estimates #90 (AmazonVPC / VPCPublicIPv4Address / usagetype PublicIPv4:InUseAddress). Current loader only caches the IdleAddress variant for EIPs; add a second cache entry for in-use.
  • Could be a new summary section rather than a per-resource list, since hundreds of IPs would be noisy.

Current state

service/ec2/service.go has GetElasticIPAddressesInfo which already counts associated vs unassociated EIPs and computes info. A new GetPublicIPv4Summary (or an expansion of the existing EIP check) could pull counts from instances, ENIs, NAT Gateways, and LBs to give an account-wide total.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions