0

I have :

  1. 3 AWS EKS clusters, each in diff regions (us, eu, and as). Each cluster runs the same application, but with a localized database (nearest to the deployment region).
  2. Each cluster has a load balancer, to distribute the traffic to multiple ec2 instances.

Now I want to distribute the HTTP traffic based on the region provided in the 'x-user-region' (custom)header.

So if Header x-user-region == 'us' , it should be directed to 'us-loadbalancer', if Header is equal to 'eu', it should be directed to 'eu-loadbalancer', and default will go to the third load balancer.

I tried achieving this by making a new AWS Application Load Balancer, but it only works in a single VPC. I tried AWS Global Accelerator, but sadly it works with ip, and custom routing does not provide any means to put conditions on Headers values.

What could be a possible solution/approach? Any help is highly appreciated.

1 Answers1

0

...if a user registered himself as a EU citizen, his data must be saved in EU region only, even if he travels accross the globe and access the data from US or AS region.

the apis must pass a 'x-user-region' header...

Your server can response by sending a redirection to the desired endpoint based on the given x-user-region header value. If you cannot change the server code, you can use solution like Nginx example, Traefik guide, or ALB to redirect on your behalf.

gohm'c
  • 13,492
  • 1
  • 9
  • 16
  • I do not want geolocation based routing. My goal is to run application as well as store the data in the users residential region. So if a user registered himself as a EU citizen, his data must be saved in EU region only, even if he travels accross the globe and access the data from US or AS region. So to acheive this, the apis must pass a 'x-user-region' header, and I want to forward those request to corresponding region's loadbalancer. Geolocation works by mapping IP addresses to locations. – user2405349 Sep 25 '21 at 07:33
  • Checkout the updated answer. – gohm'c Sep 25 '21 at 08:40