Multi-Region Traffic Routing in AWS: Cost Analysis & Best Solutions
Manish Kumar
Cloud & IT Infrastructure Consultant | Architecting Secure, Scalable Solutions for Digital Transformation
Do you know, you cannot directly route traffic from an AWS Elastic Load Balancer (ELB) to EC2 instances in a different AWS region. ELB only supports routing traffic to resources within the same region where it is deployed, but there are solutions to it. We will discuss the possible solutions and analyze cost involved in each method in this blog.?
Solution 1: Using AWS Global Accelerator
The best AWS-native solution for cross-region traffic distribution is AWS Global Accelerator. It provides a single global static IP address that routes traffic to EC2 instances in different AWS regions with optimized performance.
How It Works:
Solution 2: Route 53 with Latency-Based Routing (LBR)
Solution 3: CloudFront + Regional ELBs
Here’s a step-by-step AWS CLI-based configuration to set up AWS Global Accelerator for routing traffic across multiple AWS regions.
?
Solution 1: Using AWS Global Accelerator
Step 1: Create an AWS Global Accelerator
Run the following command to create a new accelerator:
aws globalaccelerator create-accelerator \
--name "MyGlobalAccelerator" \
--ip-address-type IPV4 \
--enabled
Response Example:
{
"Accelerator": {
"AcceleratorArn": "arn:aws:globalaccelerator::123456789012:accelerator/abcdef123456",
"Name": "MyGlobalAccelerator",
"IpAddressType": "IPV4",
"Enabled": true,
"IpSets": [
{
"IpFamily": "IPV4",
"IpAddresses": ["192.0.2.1", "198.51.100.1"]
}
]
}
}
Note: The accelerator provides two static IPs (192.0.2.1 and 198.51.100.1) that users will connect to.?
Step 2: Create a Listener
A listener defines the port and protocol the accelerator will listen on.
aws globalaccelerator create-listener \
--accelerator-arn "arn:aws:globalaccelerator::123456789012:accelerator/abcdef123456" \
--name "MyListener" \
--protocol TCP \
--port-ranges FromPort=80,ToPort=80 \
--client-affinity NONE
Response Example:
{
"Listener": {
"ListenerArn": "arn:aws:globalaccelerator::123456789012:listener/abcdef123456",
"Protocol": "TCP",
"PortRanges": [{"FromPort": 80, "ToPort": 80}]
}
}
Step 3: Create an Endpoint Group for Each AWS Region
For each AWS region where you have EC2 instances (or ALBs), create an endpoint group.
aws globalaccelerator create-endpoint-group \
--listener-arn "arn:aws:globalaccelerator::123456789012:listener/abcdef123456" \
--endpoint-group-region us-east-1 \
--traffic-dial-percentage 50
aws globalaccelerator create-endpoint-group \
--listener-arn "arn:aws:globalaccelerator::123456789012:listener/abcdef123456" \
--endpoint-group-region us-west-1 \
--traffic-dial-percentage 50
Note: traffic-dial-percentage distributes traffic across multiple regions. (50% in each example above)?
Step 4: Add Endpoints (ALB or EC2 Instances)
You can add ALBs, EC2 instances, or NLBs as endpoints.
Option 1: Add an ALB as an Endpoint
aws globalaccelerator add-endpoints \
--endpoint-group-arn "arn:aws:globalaccelerator::123456789012:endpoint-group/abcdef123456" \
--endpoint-configurations "EndpointId=arn:aws:elasticloadbalancing:us-east-1:123456789012:loadbalancer/app/MyALB/abcdef,Weight=100"
Option 2: Add an EC2 Instance as an Endpoint
aws globalaccelerator add-endpoints \
--endpoint-group-arn "arn:aws:globalaccelerator::123456789012:endpoint-group/abcdef123456" \
--endpoint-configurations "EndpointId=i-1234567890abcdef0,Weight=100"
Note: Set the Weight for load distribution.?
Step 5: Verify the Global Accelerator Configuration
aws globalaccelerator list-accelerators
To check if traffic is being routed, use:
nslookup 192.0.2.1
or
curl -v https://192.0.2.1?
AWS Global Accelerator efficiently routes traffic across AWS regions with built-in failover and performance improvements. Let me know if you need more details or troubleshooting help!?
Solution 2: Route 53 with Latency-Based Routing (LBR)
Best For:
Steps to Configure Route 53 LBR:
Step 1: Create a Hosted Zone (if not created)
aws route53 create-hosted-zone \
--name mydomain.com \
--caller-reference $(date +%s)
This creates a DNS zone for mydomain.com.
Step 2: Create Latency-Based Records for Different Regions
For an ALB in us-east-1
aws route53 change-resource-record-sets \
--hosted-zone-id ZXXXXXXXXXXXXXX \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "app.mydomain.com",
"Type": "A",
"SetIdentifier": "us-east-1",
"Region": "us-east-1",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K",
"DNSName": "myalb-1234567890.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}'
Note:
For an ALB in us-west-1
aws route53 change-resource-record-sets \
--hosted-zone-id ZXXXXXXXXXXXXXX \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "app.mydomain.com",
"Type": "A",
"SetIdentifier": "us-west-1",
"Region": "us-west-1",
"AliasTarget": {
"HostedZoneId": "Z368ELLRRE2KJ0",
"DNSName": "myalb-0987654321.us-west-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
}
}
}]
}'
Now, users will be directed to the closest ALB based on latency!?
Solution 3: CloudFront + Regional ELBs
Best For:
Steps to Configure CloudFront with Regional ALBs
Step 1: Create a CloudFront Distribution
aws cloudfront create-distribution \
--origin-domain-name myalb-1234567890.us-east-1.elb.amazonaws.com \
--default-root-object index.html \
--enabled \
--comment "CloudFront with Multi-Region ALB"
Response:
{
"Distribution": {
"Id": "EDFDVBD6EXAMPLE",
"DomainName": "d1234567890.cloudfront.net"
}
}
The generated CloudFront Domain Name (d1234567890.cloudfront.net) will distribute traffic globally.
Step 2: Add a Second Origin (ALB in us-west-1)
To support multiple regions, update the distribution:
aws cloudfront update-distribution \
--id E1234567890EXAMPLE \
--default-cache-behavior '{ "TargetOriginId": "us-west-1", "ForwardedValues": { "QueryString": true }, "ViewerProtocolPolicy": "redirect-to-https" }'
CloudFront will now route traffic to the fastest ALB region!
?
Solution 3?: Multi-Region ALB with Route 53 Failover
Best For:
Steps to Configure Multi-Region ALB with Failover
Step 1: Create Health Checks for ALBs
aws route53 create-health-check \
--caller-reference "us-east-1-alb-health" \
--health-check-config '{
"IPAddress": "ALB_IP",
"Port": 80,
"Type": "HTTP",
"ResourcePath": "/",
"RequestInterval": 30,
"FailureThreshold": 3
}'
?? Replace ALB_IP with your ALB's public IP in us-east-1.
?? Repeat this step for us-west-1.
Step 2: Create Failover DNS Records
Primary ALB in us-east-1
aws route53 change-resource-record-sets \
--hosted-zone-id ZXXXXXXXXXXXXXX \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "app.mydomain.com",
"Type": "A",
"SetIdentifier": "Primary",
"Failover": "PRIMARY",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K",
"DNSName": "myalb-1234567890.us-east-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
},
"HealthCheckId": "hc-1234567890"
}
}]
}'
Secondary ALB in us-west-1 (Failover)
aws route53 change-resource-record-sets \
--hosted-zone-id ZXXXXXXXXXXXXXX \
--change-batch '{
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "app.mydomain.com",
"Type": "A",
"SetIdentifier": "Secondary",
"Failover": "SECONDARY",
"AliasTarget": {
"HostedZoneId": "Z368ELLRRE2KJ0",
"DNSName": "myalb-0987654321.us-west-1.elb.amazonaws.com",
"EvaluateTargetHealth": true
},
"HealthCheckId": "hc-0987654321"
}
}]
}'
?Now, if the us-east-1 ALB fails, traffic will automatically route to us-west-1.
?
Final Thoughts:
?
Which solution do you prefer? Need more details on any??
To analyze the monthly average cost of each multi-region routing solution, let's break down the cost structure for each AWS service involved.?
Cost Analysis by Solution:
?
Cost Breakdown for Each Solution:
1? AWS Global Accelerator
Best for: Ultra-low latency, automatic failover, high availability Cost Breakdown:
Estimated Monthly Cost:
?
2? Route 53 - Latency-Based Routing
Best for: Cost-efficient, region-aware routing Cost Breakdown:
Estimated Monthly Cost:
?
3? CloudFront + ALB
Best for: Caching & optimizing latency Cost Breakdown:
Estimated Monthly Cost:
?
4? Multi-Region ALB Failover (Route 53)
Best for: Disaster recovery with automatic failover Cost Breakdown:
Estimated Monthly Cost:
?
Final Cost Comparison Summary:
?
?