0xOX0X
Cloud & SaaS

DNS Steering vs. NAT Gateways: Cutting Cloud Egress Costs

Quick Answer

The most effective way to cut NAT Gateway costs is to implement AZ-aware DNS steering that ensures traffic stays within its local Availability Zone (AZ), avoiding the $0.045/GB data processing fee. By using Cloudflare health probes for edge-to-origin traffic or Route 53 Private DNS for internal service-to-service communication, you can bypass NAT Gateways entirely for most intra-region workloads.

By Elena RostovaUpdated 2026-11-275 min read
Modern data center server racks with fiber optic cabling representing cloud infrastructure.

The FinOps Verdict: Probing Over Processing

If you have ever opened your AWS Cost Explorer only to find that "NAT Gateway-Bytes" is your second-highest line item after EC2, you aren't alone. Most teams set up a NAT Gateway in each Availability Zone (AZ) for high availability, but they forget that AWS charges $0.045 per GB for data processing. When Service A in AZ-1 talks to an external API or even Service B in AZ-2 through a NAT Gateway, you are paying a hidden tax on every single packet.

The architectural verdict is clear: DNS-based steering is significantly cheaper than hardware-level NAT traversal. By moving the intelligence of "where to send traffic" to the DNS layer through health probing, you can ensure that your instances only talk to endpoints within their own AZ or exit via the cheapest possible path. While this adds roughly 10-20ms of latency during a failover event (the time it takes for a TTL to expire), the cost savings for high-throughput applications—often thousands of dollars per month—far outweigh the momentary lag.

Side-by-Side: Cloudflare Edge vs. AWS Internal Steering

Choosing between steering at the edge (Cloudflare) versus steering inside your VPC (Route 53) depends on where your traffic originates. If you are handling public-facing ingress, Cloudflare's health probes are superior. For internal microservices, AWS Route 53 Resolver is the standard.

FeatureCloudflare Global SteeringAWS Route 53 + PrivateLink
Primary Cost Metric$5/month per probe + DNS queries$0.01/GB (PrivateLink) vs $0.045 (NAT)
Latency (Health Check)10s - 60s (Configurable)10s - 30s (Standard/Fast)
Traffic AwarenessGeo-steering & ProximityAZ-Local & Weighted Round Robin
Best Use CaseExternal API/Web IngressInternal Microservice Communication
Estimated SavingsUp to 90% of NAT processing fees60-75% reduction in cross-AZ fees

The Hidden Tax of Cross-AZ NAT Traversal

An engineer's workspace showing a cloud architecture diagram on a screen.

Most engineers treat the NAT Gateway as a transparent utility, but its pricing model is predatory for high-bandwidth users. When an instance in us-east-1a sends data to the internet via a NAT Gateway in us-east-1b, you are hit twice: once for the cross-AZ data transfer ($0.01/GB) and once for the NAT Gateway processing ($0.045/GB). This brings your effective cost to $0.055/GB before you even pay for the actual internet egress.

By implementing DNS health probing, you change the logic from "always use the gateway" to "use the local endpoint if it is healthy." Cloudflare's probing mechanism allows you to set up monitor-based steering. If your primary local endpoint in AZ-1 fails, the DNS record updates to point to AZ-2. This allows you to use cheaper alternatives like NAT Instances (which don't have a per-GB processing fee) or VPC Endpoints for specific services like S3 or DynamoDB without losing the resilience that a managed NAT Gateway provides.

Production Implementation: AZ-Aware Probing Runbook

To implement this using Cloudflare for your ingress traffic, you need to move beyond simple A records and into Load Balancing with Health Monitors. This ensures that if an entire AZ goes dark, your DNS won't lead users into a black hole.

Step 1: Define the Health Monitor

Create a monitor that checks a specific health endpoint on your origin. Use a short interval (15-30 seconds) to minimize downtime during a failure.

Step 2: Configure the Load Balancer with Steering

Use "Proximity Steering" or "Geo-Steering" to ensure users are directed to the closest healthy AZ. For internal AWS-to-AWS traffic, you would instead use Route 53 "Alias" records with "Evaluate Target Health" set to true.

Copy-Paste Asset: Terraform Configuration for Cloudflare Probing

hcl
# Define the Health Monitor
resource "cloudflare_load_balancer_monitor" "az_health_check" {
  account_id     = "your_account_id"
  type           = "http"
  path           = "/health"
  port           = 443
  method         = "GET"
  interval       = 15
  retries        = 2
  timeout        = 5
  expected_codes = "200"
  follow_redirects = false
}

# Define the Pool (One per AZ)
resource "cloudflare_load_balancer_pool" "az_1_pool" {
  account_id = "your_account_id"
  name       = "us-east-1a-pool"
  origins {
    name    = "primary-az1"
    address = "az1.your-backend.com"
  }
  monitor = cloudflare_load_balancer_monitor.az_health_check.id
}

# Steering Policy: Dynamic Failover
resource "cloudflare_load_balancer" "main_lb" {
  zone_id          = "your_zone_id"
  name             = "api.yourdomain.com"
  fallback_pool_id = cloudflare_load_balancer_pool.az_1_pool.id
  default_pool_ids = [cloudflare_load_balancer_pool.az_1_pool.id]
  steering_policy  = "proximity"
}

Failure Modes, Bottlenecks, and Rollback Checklist

While DNS steering saves a fortune, it introduces "DNS Caching" as a failure mode. If a client (like a mobile app or a poorly configured Java microservice) caches a DNS response longer than your TTL, it will continue to attempt to connect to a dead AZ even after your probes have marked it down.

Common Bottlenecks:

  1. TTL Mismatch: If your DNS TTL is 300 seconds (5 minutes) but your health probe fails in 30 seconds, you have 4.5 minutes of "zombie traffic" hitting a dead endpoint.
  2. Probe Flapping: If your health check is too sensitive, a minor network blip will cause DNS to oscillate between AZs, breaking active TCP sessions.
  3. Cross-AZ Dependency: Ensure your database isn't in a different AZ than your steered app, or you'll simply move the NAT cost to the database connection.

Rollback Checklist:

  • [ ] Keep the NAT Gateways Active: Do not delete your NAT Gateways immediately. Keep them as the default route in your route tables while testing DNS steering.
  • [ ] Monitor NXDOMAIN/Errors: Watch for a spike in DNS resolution errors after switching to Load Balanced records.
  • [ ] Verify TTL Compliance: Use dig or nslookup from within your VPC to ensure your internal resolvers are honoring the short TTLs required for failover.
Share this article

Frequently Asked Questions

Does DNS steering completely replace NAT Gateways?

Not entirely. NAT Gateways are still needed for instances without public IPs to access the internet. However, DNS steering ensures that only necessary traffic hits the NAT, while internal or service-specific traffic is routed through cheaper paths like VPC Endpoints.

What is the cost of Cloudflare Health Checks vs AWS Route 53?

Cloudflare typically charges a flat fee per monitor ($5/month), which is highly predictable. AWS Route 53 charges $0.50 to $0.75 per health check per month, which can add up if you are monitoring hundreds of individual microservice instances.

Will DNS failover cause dropped connections?

Yes, unlike a hardware load balancer, DNS failover relies on the client making a new request. Existing TCP connections to a failed AZ will time out, and the client must re-resolve the DNS name to find the new healthy IP.

Free Weekly Dispatch

Get the Weekly SMB AI & SaaS Brief

Practical software benchmarks, prompt templates, and ROI breakdowns delivered every Tuesday. No fluff, unsubscribe anytime.