DEV Community

Cover image for The Hidden Cost of Paying Twice for Inter-AZ Network Traffic in AWS
Walid BATTOU for AWS Community Builders

Posted on • Originally published at linkedin.com

The Hidden Cost of Paying Twice for Inter-AZ Network Traffic in AWS

Today, it's well known that network cost on AWS can be very expensive.

I would like to explain the hidden cost of Inter-AZs network traffic when an AWS managed service (EC2) communicates with other AWS services like FSx, Amazon MQ, Load Balancer and Fargate.

We have several categories of network costs. This article will not duplicate content from existing articles like below:

Starting with Cost Explorer

How to check the cost of network traffic between Availability Zones?!

  • Filter by "API operation": InterZone-In and InterZone-Out InterZone-In

If you group by Service, these operations will be under "EC2-Other".
If you group by Usage type, these operations will be under "Region-DataTransfer-Regional-Bytes".

Most of your Inter-AZs traffic related to EC2 instances appears under the EC2-Other service category.

Let's filter by this Usage type:

  • Filter by "Region-DataTransfer-Regional-Bytes"
  • Group by "Service" DataTransfer-Regional-Bytes

What we can observe?

  • The "API operation" InterZone-In, InterZone-Out are under the service "EC2-Other" only and the Usage type "Region-DataTransfer-Regional-Bytes".
  • Under the Usage type "Region-DataTransfer-Regional-Bytes" we can have a lot of services, but what we have behind it?

Let's take an example with FSx

  • Filter by "Region-DataTransfer-Regional-Bytes"
  • Filter by Service "FSx"
  • Group by "API Operation" CreateFileSystem

Conclusion
For the FSx service, we are paying for the Usage type named ""Region-DataTransfer-Regional-Bytes" identified with the "API operation" "CreateFileSystem:Lustre". With Cost Explorer, we are not able to know if this traffic is related to Inter AZs, traffic Out of AWS, Inter Regions or other. We need to use the CUR(Cost & Usage Report) to understand what we have behind it.

Deep Dive into the CUR (CUDOS dashboard version 5.4)

If you're working on AWS and not aware of CUDOS and other dashboards provided by AWS, check this link.

Let's check the tab "Data Transfer & Networking"
On this tab, we have multiple choice to dig into the detail related to network cost. I checked the box "Inter AZ":
CUDOS

For clarity, I've added a column description to the 'Data Transfer Details Usage and Cost' visualization.

We find for FSx what we found in Cost Explorer:
Cost explorer

The description clarifies that with FSx, we need to pay for Inter-AZs network traffic between FSx and:

  • EC2
  • an EIP (Elastic IP)
  • a Load Balancer

For my example, we need to pay twice the Inter AZs network traffic between an EC2 and a file system on FSx:
Diagram

My first question when I discovered that was:

  • Is it mentioned in the AWS documentation?

The answer is yes for FSx but sometimes not clear for other services like Fargate.
Fargate

The description in the CUR is the same one for any managed services with inter AZs traffic:
Data Transfer Details

Take Away

  • Use CUDOS to check your Network Traffic on AWS
  • Keep resources within the same AZ (when it's possible)

Top comments (0)