Lesson 2 of 2 Network Cost Optimization

Reducing Network Costs

This lesson explains the few standard changes that produce most network cost savings: keeping traffic off NAT gateways, keeping it within an Availability Zone, serving it from the edge and removing unused public addresses.

Learning outcomes

After completing this lesson, you will be able to:

  • Use gateway and interface endpoints to reduce NAT charges.
  • Keep traffic within an Availability Zone.
  • Reduce edge, public IPv4 and connection costs.

NAT and endpoints

Traffic from private subnets to S3 and DynamoDB in the same Region should use gateway endpoints, which are free and remove NAT processing charges. For other AWS services, interface endpoints cost per hour per AZ plus a lower per-GB rate than NAT, so they save money when traffic volume to that service is high, and they are required anyway for isolated subnets. Each AZ's private subnets should route to a NAT gateway in the same AZ (or use a regional NAT gateway) to avoid paying cross-AZ charges on top of NAT processing. Development environments can share NAT through a central egress VPC via Transit Gateway, though Transit Gateway processing charges must be weighed against NAT hourly savings.

The following diagram compares a higher-cost and a lower-cost design for the same traffic.

Common NAT and endpoint cost reductions. S3 traffic through a NAT gateway adds per-GB processing charges, and a single NAT gateway makes other AZs' traffic cross zones. An S3 gateway endpoint carries S3 traffic at no charge, a NAT gateway in each AZ keeps traffic local, and releasing idle public IPv4 addresses removes their hourly charge.
The saving depends on how much traffic goes to S3 and DynamoDB.
Scenario questions

Cutting NAT costs

Exam skills 5.1.4 · 5.1.2

Choose the change that lowers network cost most for each pattern.

Log in to try this activity Interactive activities are free with an account.

Keeping traffic local

Cross-AZ data transfer is charged in both directions, so chatty components should be AZ-aware: clients reading from replicas in their own AZ, cross-zone load balancing considered carefully for NLBs (where cross-AZ traffic is charged, unlike ALBs), Kafka-style or cache clients preferring local nodes, and ECS or EKS services using topology-aware routing. High availability still requires multiple AZs, so the aim is to keep the steady-state path local while retaining failover. Placing tightly coupled batch workloads in one AZ is acceptable when they can tolerate an AZ outage.

Edge delivery, IPv4 and connection choices

CloudFront reduces internet egress costs because data transfer from CloudFront is priced lower than from EC2 or S3 directly, origin fetches from AWS origins to CloudFront are free, and caching reduces origin load; flat-rate CloudFront pricing plans bundle transfer and security features. Public IPv4 addresses are charged hourly, so release unused Elastic IPs, avoid auto-assigning public IPs to instances that sit behind load balancers, use NAT or endpoints for outbound access, and adopt IPv6 (no charge) with egress-only gateways where possible. For connecting VPCs, VPC peering has no hourly or processing charge, so a few high-volume VPC-to-VPC flows can be cheaper over peering than through Transit Gateway. The following table summarises the main optimisations.

Cost driverOptimisation
NAT processing for S3 or DynamoDB trafficGateway endpoints
NAT processing for high-volume AWS API trafficInterface endpoints
Private subnets using another AZ's NAT gatewayNAT gateway per AZ or regional NAT gateway
Cross-AZ chatterAZ-aware clients and routing
Internet egress for downloads and mediaCloudFront caching and pricing
Idle or unnecessary public IPv4 addressesRelease Elastic IPs; disable auto-assign; use IPv6
High-volume traffic between two VPCs over Transit GatewayVPC peering for that pair
Select all that apply

Cutting public IPv4 cost

Exam skills 5.1.4

Identify changes that reduce public IPv4 address charges.

Log in to try this activity Interactive activities are free with an account.
Worked example

Cutting the NAT bill

Following the analysis in the previous topic, the team adds an S3 gateway endpoint to the private route tables, removing 36 TB a month of NAT processing, creates a NAT gateway in the second AZ so each AZ routes locally, and configures the application's cache client to read from the replica in its own AZ. They also find 18 idle Elastic IP addresses from decommissioned servers and release them. Network costs fall by about 70% with no change to availability.

Check yourself

How can internet egress cost for static content be reduced?

Show answer

Serve it through CloudFront, which also reduces origin load.

Exam Tips

Remember for the exam

  • Gateway endpoints remove NAT charges for S3 and DynamoDB traffic.
  • Route each AZ to a local NAT gateway to avoid cross-AZ charges.
  • CloudFront lowers internet egress cost and origin load.
  • Release idle Elastic IPs and avoid unnecessary public IPv4 addresses.
  • VPC peering avoids Transit Gateway processing charges for heavy VPC pairs.