DEV Community

Cover image for Beyond the NAT Gateway: Modernizing AWS Workloads with Egress-Only IPv6

Beyond the NAT Gateway: Modernizing AWS Workloads with Egress-Only IPv6

In modern cloud networking, the traditional method of routing private subnet traffic to the internet over IPv4 has become a costly architectural bottleneck.

Organizations relying on NAT Gateways face recurring provisioning fees and steep per-gigabyte data processing charges just to allow internal workloads—like AWS Lambda functions, CI/CD runners, and microservices—to fetch external updates.

Transitioning your private subnets to IPv6 with an Egress-Only Internet Gateway completely changes the economics of the cloud. This architecture enables secure, one-way outbound connectivity for private resources while inherently blocking unsolicited inbound traffic. Best of all, it entirely eliminates the NAT middleman, offering direct end-to-end routing, native network efficiency, and a drastic reduction in your monthly AWS bill.

Numerous AWS services support dual-stack (IPv4 and IPv6) networking for compute workloads, endpoint management, or VPC environments.

1. Core Infrastructure & Compute

  • Amazon Virtual Private Cloud (VPC): Supports dual-stack VPCs, allowing subnets to handle both IPv4 and IPv6 traffic.
  • Amazon EC2: Instances within dual-stack VPCs can be assigned both IPv4 and IPv6 addresses.
  • AWS Lambda: Supports dual-stack endpoints, enabling functions to process events and reach external targets via IPv6 or IPv4.
  • Amazon EKS & ECS: Workloads running on Amazon EKS or ECS can use dual-stack networking, allowing pods and containers to acquire unique IPv6 addresses.

2. Networking & Content Delivery

  • Elastic Load Balancing (ELB): Both Application Load Balancers (ALB) and Network Load Balancers (NLB) support dual-stack configurations for internet-facing and internal traffic.
  • Amazon API Gateway: Provides first-class support for both HTTP and REST APIs via dual-stack endpoints.
  • Amazon Route 53: Supports AAAA records and offers dual-stack Route 53 Resolver Endpoints for hybrid networks.
  • Amazon CloudFront: Uses dual-stack distributions to optimize global content delivery for IPv6 users.
  • AWS Transit Gateway & Site-to-Site VPN: Connects multiple VPCs or on-premises environments in dual-stack mode.

3. Storage, Database & Messaging

  • Amazon S3: Supports dual-stack endpoints for standard object storage and Amazon S3 on Outposts.
  • Amazon Aurora & RDS: Can be assigned IPv6 addresses alongside IPv4 in a dual-stack setup.
  • Amazon ElastiCache: Enables caching layer access over IPv4 and IPv6 using ElastiCache dual-stack endpoints.
  • Amazon SNS & SQS: Support Amazon SNS dual-stack endpoints and SQS endpoints for messaging.

4. Security & Management

  • AWS Identity and Access Management (IAM): Allows programmatic access via IAM dual-stack public endpoints.
  • AWS KMS: Features KMS dual-stack public endpoints for encryption operations.
  • AWS Backup: Provides dual-stack connectivity for its Backup API endpoint.

Benefits of Transitioning
You can transition to IPv6 to future-proof your overall architecture by preparing ahead of the broader transition to IPv6, and establish compatibility with IPv6 clients or services. Using IPv6 directly eliminates the need for expensive NAT Gateways in private subnets, leading to significant structural cost reductions in AWS.

Below is how IPv6 cuts costs, the exact financial comparison, and the architectural differences:

1. The Mechanics: Why IPv6 Removes NAT Gateways

  • NAT Gateway Purpose in IPv4: Private subnets use private IPv4 ranges (RFC 1918) that cannot route over the internet. A NAT Gateway translates these into a public IPv4 address, acting as a costly middleman for outbound traffic.

  • The IPv6 Alternative: AWS assigns globally unique, routable IPv6 addresses to resources in a private subnet. Because these addresses are natively routable, instances connect directly to external targets without any address translation.

  • The Egress-Only Internet Gateway: To maintain security and block unsolicited inbound internet traffic, AWS uses an Egress-Only Internet Gateway. This functions as a one-way security boundary, completely replacing the NAT Gateway for IPv6 traffic.

See the lambda function example below;

architecture diagram

Fig.1: Lambda internet connectivity through a NAT Gateway (IPv4) and Lambda internet connectivity through an egress-only internet gateway (IPv6).

2. Financial Comparison: NAT Gateway vs. Egress-Only Internet Gateway

Cost Component IPv4 NAT Gateway (AWS Pricing) IPv6 Egress-Only Internet Gateway
Hourly Provisioning Fee $0.045 per hour (~$32.85/month per gateway) $0.00 / hour (Completely free)
Data Processing Fee $0.045 per GB of data transferred $0.00 per GB (Completely free)
Public IPv4 Address Fee $0.005 per hour (~$3.65/month per IP) $0.00 (Not applicable)
Standard Data Transfer Applicable data egress charges apply Applicable data egress charges apply

3. Operational Cost Impact at Scale

  • Fixed Savings: A standard architecture deployed across 3 Availability Zones requires 3 NAT Gateways for high availability.
    • IPv4 Cost: ~$110/month just to keep the gateways running (excluding data fees).
    • IPv6 Cost: $0/month.
  • Variable Savings (Data Processing): If your private compute workloads (e.g., AWS Lambda, EC2 clusters, ECS tasks) download 10 TB of data, updates, or third-party API payloads per month:
    • IPv4 NAT Data Fee: 10,000 GB × $0.045 = $450/month.
    • IPv6 NAT Data Fee: $0.

IPv6 in the Wild: 4 Real-World Architectural Transformations

The shift to IPv6 is no longer a theoretical debate, it is a production reality driving efficiency across the most demanding cloud environments. From enterprise API backends to massive container orchestration, organizations are using the next-generation protocol to bypass the hard constraints of the legacy IPv4 internet.

By deploying dual-stack architectures and replacing expensive translation layers with egress-only gateways, teams are not just saving money; they are building highly scalable networks designed for continuous traffic growth.

The following use cases demonstrate how real-world engineering teams leverage IPv6 to eliminate architectural bottlenecks, slash operational overhead, and permanently solve IP exhaustion.

Use Case 1: High-Performance Serverless APIs (E-Commerce & FinTech)
The Problem: An enterprise processes millions of API requests daily using Amazon API Gateway and AWS Lambda. Routing Lambda functions inside a VPC through an IPv4 NAT Gateway incurs thousands of dollars in data processing fees and introduces latency due to Network Address Translation (NAT) overhead.
The IPv6 Solution:

  • Configuration: The VPC is updated to a Dual-Stack configuration using an Amazon-provided /56 IPv6 CIDR block. The Lambda functions are configured to use an Egress-Only Internet Gateway for external API routing (::/0).
  • Result: Lambda connects directly to external payment gateways and inventory providers natively over IPv6. NAT processing fees drop to zero, and fixed hourly NAT Gateway costs are eliminated.

Use Case 2: Massively Scalable Microservices (SaaS Platforms)
The Problem: A SaaS provider hosts microservices on Amazon EKS (Kubernetes). They are entirely exhausted of internal private IPv4 addresses (RFC 1918 CIDR ranges), preventing them from spinning up new pods and causing deployment failures.
The IPv6 Solution:

  • Configuration: The infrastructure team migrates the EKS clusters to IPv6-only mode. Every Kubernetes pod is directly assigned a globally unique IPv6 address.
  • Result: Address exhaustion is permanently resolved without re-architecting the entire internal network. Pod-to-pod communication happens without complex internal load balancing or address translation, simplifying microservices networking.

Use Case 3: Ephemeral CI/CD Pipelines (DevOps Teams)
The Problem: A tech company runs hundreds of automated daily tests using ephemeral EC2 build runners or ECS tasks. These runners must securely fetch source code from GitHub and download large container images from public registries, resulting in massive outbound data traffic and high IPv4 NAT costs.
The IPv6 Solution:

  • Configuration: Builders configure a secure, isolated private subnet. They attach an Egress-Only Internet Gateway and add the default route (::/0) to the subnet's route table.
  • Result: The build runners pull source code and large image dependencies over the free Egress-Only Gateway. External scanning bots cannot initiate connections to the runners, ensuring top-tier security for the build pipeline.

Use Case 4: Internet of Things (IoT) Management (Smart Infrastructure)
The Problem: An IoT vendor manages millions of smart devices (meters, sensors) that report data back to AWS. Using an IPv4 NAT layer creates connection bottlenecks, as the NAT table quickly exhausts its port limits trying to handle millions of persistent, concurrent connections.

The IPv6 Solution:

  • Configuration: The IoT devices are provisioned with native IPv6 addresses. The AWS ingestion layer runs on dual-stack Application Load Balancers (ALBs).
  • Result: Every device communicates directly with the load balancer via end-to-end IPv6. Eliminating address translation layers reduces edge latency and eliminates the port-exhaustion issues common in high-concurrency IPv4 systems.

Conclusion

The transition to IPv6 is no longer a future-proofing exercise—it is a competitive necessity for the modern cloud. Continuing to rely solely on IPv4 introduces unnecessary translation bottlenecks, exposes your infrastructure to IP exhaustion, and adds thousands of dollars in "NAT taxes" to your cloud bill .

By adopting IPv6, leveraging dual-stack configurations, and utilizing free architectural components like egress-only internet gateways, you can unlock a faster, more secure, and highly cost-effective infrastructure . The protocol has matured, the tooling has caught up, and major platforms are actively prioritizing it. Don't wait until IPv4 costs and limits restrict your business growth; start migrating your critical workloads to IPv6 today.

Top comments (1)

Collapse
 
mlhpdx profile image
Lee Harding AWS Community Builders • Edited

Working with multi-region services is where those NAT Gateways really multiply! IPv6 opens-up some really interesting alternatives, but be aware that dynamic multicast (via IGMP) does not work with IPv6.