Skip to Content

Networking costs

Data transfer costs within an AZ, between AZs and between Regions, minimizing egress, S3 data transfer pricing, NAT gateway vs gateway endpoint, and the public IPv4 charge.

Networking costs per GB, simplified

Data transfer costs, simplified: traffic between instances in the same AZ over private IPs is free; between AZs it costs about 0.01 dollars per GB in each direction over private IPs, and 0.02 over public or Elastic IPs; between Regions it costs about 0.02 dollars per GB Data transfer costs, simplified: traffic between instances in the same AZ over private IPs is free; between AZs it costs about 0.01 dollars per GB in each direction over private IPs, and 0.02 over public or Elastic IPs; between Regions it costs about 0.02 dollars per GB

Stay in the AZ and use private IPs to pay least.
  • Traffic in to AWS: free.
  • Between instances in the same AZ over private IPs: free.
  • Between AZs: $0.01 per GB (in each direction) using private IPs; $0.02 per GB using public or Elastic IPs.
  • Between Regions: $0.02 per GB.
  • Use private IPs instead of public IPs for good savings and better network performance.
  • Use the same AZ for maximum savings (at the cost of high availability).

Minimizing egress traffic network cost

  • Egress traffic: outbound traffic (from AWS to outside).
  • Ingress traffic: inbound traffic, from outside to AWS (typically free).
  • Try to keep as much internet traffic within AWS as possible to minimize costs.

For example, an application in a corporate data center queries a database in AWS: if the query returns 100 MB that the app reduces to a 50 KB result, move the application into AWS so only the 50 KB leaves AWS.

  • Direct Connect locations that are co-located in the same AWS Region result in lower cost for egress network.

S3 data transfer pricing (USA)

  • S3 ingress: free.
  • S3 to the internet: $0.09 per GB.
  • S3 Transfer Acceleration:
    • faster transfer times (50 to 500% better);
    • additional cost on top of data transfer pricing: +$0.04 to $0.08 per GB.
  • S3 to CloudFront: $0.00 per GB.
  • CloudFront to the internet: $0.085 per GB (slightly cheaper than S3):
    • caching capability (lower latency);
    • reduces costs associated with S3 request pricing (7× cheaper with CloudFront).
  • S3 Cross-Region Replication: $0.02 per GB.

NAT gateway vs gateway VPC endpoint

Reaching S3 from private subnets: through a NAT gateway the cost is about 0.045 dollars per hour plus 0.045 dollars per GB processed; through a gateway VPC endpoint for S3 in the same Region the endpoint is free Reaching S3 from private subnets: through a NAT gateway the cost is about 0.045 dollars per hour plus 0.045 dollars per GB processed; through a gateway VPC endpoint for S3 in the same Region the endpoint is free

Same S3 access, very different bill.

In us-east-1:

  • NAT gateway: $0.045 per hour and $0.045 per GB of data processed; plus $0.09 per GB data transfer out to S3 cross-Region ($0.00 same-Region).
  • Gateway VPC endpoint: no cost for using it (only standard same-Region data transfer).

For heavy S3 or DynamoDB traffic from private subnets, a gateway endpoint is the cost answer.

Not in the course slides

Since February 2024, AWS charges $0.005 per hour for every public IPv4 address (about $3.60 a month), whether it's attached to an instance, a load balancer, a NAT gateway or idle as an Elastic IP. Using private subnets, endpoints and IPv6 cuts this cost.

Real-world examples

  • A log pipeline in private subnets sends 20 TB a month to S3 through a NAT gateway: about $900 a month in NAT processing alone. An S3 gateway endpoint makes it $0.
  • A website serves images from S3 through CloudFront: S3 to CloudFront is free, and CloudFront's per-GB rate and caching cut both transfer and request costs.

Exam tips

  • "Reduce data transfer cost between instances" → same AZ, private IPs.
  • "Reduce cost of private instances accessing S3 or DynamoDB" → gateway VPC endpoint instead of NAT gateway.
  • "Reduce S3 egress cost for global users" → CloudFront in front of S3.
  • "Reduce egress from AWS to on premises" → process data in AWS and send only results; Direct Connect.

Common traps

  • "Traffic between AZs is free." It costs about $0.01 per GB each way.
  • "Using public IPs inside AWS costs the same." Public or Elastic IPs between AZs cost more ($0.02 per GB).

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt