Skip to content

Internal ALB Cross-AZ Traffic-DNS Resolution and Data Transfer Charges

0

I am looking for guidance on Application Load Balancer cross-AZ traffic and DNS resolution behavior. We have an internal Application Load Balancer deployed across two Availability Zones (AZ1 and AZ2). When an EC2 instance in AZ1 makes a call to the ALB listener, the DNS lookup sometimes returns the IP address of the ALB node in AZ2 first. Does this DNS behavior result in cross-AZ data transfer charges when the EC2 instance connects to the ALB node in a different Availability Zone? Is there a way to ensure that calls to the internal ALB from within AZ1 preferentially use the IP address of the ALB node in AZ1 to avoid cross-AZ charges?

2 Answers
0
Accepted Answer

Yes, your understanding is correct. if an EC2 instance in AZ1 resolves the internal ALB DNS name and gets back the AZ2 IP first, the traffic will cross AZs and you will incur cross-AZ data transfer charges ($0.01/GB in each direction).

In order to minimize this you can configure Client-side DNS caching. Since, the ALB DNS name returns IPs for all enabled AZs. Many DNS resolvers and HTTP clients will round-robin or return them in arbitrary order. If your client respects DNS TTLs and caches the resolved IP, it may continue sending to an AZ2 IP even after TTL expiry.

Also, AWS supports zonal DNS names for ALBs (e.g., <az>.elb.amazonaws.com). Using the zonal DNS name ensures your client always gets the IP in the specific AZ. This is another recommended approach for AZ-affinity and cross-AZ cost optimization for ALB.

AWS
answered 2 months ago
EXPERT
reviewed 2 months ago
0

When an EC2 instance in one Availability Zone connects to an Application Load Balancer (ALB) node in a different Availability Zone, cross-AZ data transfer charges do apply. Specifically, a charge of $0.01 per GB applies for both incoming and outgoing traffic between the client and the load balancer when they are in different AZs.

To minimize cross-AZ traffic and associated charges, you can disable cross-zone load balancing on your ALB. When cross-zone load balancing is disabled, the ALB will send traffic to an ALB Elastic Network Interface (ENI) in the same AZ as the target endpoint. This helps keep traffic within the same Availability Zone and reduces the frequency of cross-AZ data transfers.

However, it's important to note that DNS resolution itself may still return IP addresses from different AZs. To further optimize for AZ affinity, you could implement application-level logic where your applications decide which server or resource to connect to within the same AZ, helping to keep traffic local and minimize cross-AZ charges.

Additionally, regularly reviewing your network traffic patterns and monitoring data transfer charges can help you identify opportunities to adjust resource placement and routing strategies to optimize both performance and costs in your multi-AZ architecture.
Sources
Exploring Data Transfer Costs for AWS Network Load Balancers | Networking & Content Delivery
Community | Optimizing Performance and Cost with Multi-AZ Architecture: Guidelines for Multi-Account Environments

answered 2 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.