I'm looking for advice on the best way to set up AWS for routing users to different regional ALBs based on a unique case UUID in the URL, rather than their geographical location. Currently, my setup includes two EKS clusters in eu-west-1 and us-east-1, each with its own ALB, RDS Aurora instance, and a web server running a Django app. I've defined the DNS records to point to the appropriate ALBs for each region. The challenge is creating a unified URL like https://app.something.com that routes users to the right region based solely on the case UUID. For example, requests to https://app.something.com/case/uuid5/ should route to eu-west-1, while https://app.something.com/case/uuid15/ should go to us-east-1. I'm considering using CloudFront with a Lambda@Edge function or CloudFront Function to inspect the incoming requests, parse the UUID, and then leverage a key-value store to map those UUIDs to regions. Has anyone successfully implemented something like this? Are there better solutions out there?
2 Answers
I get your idea, but I have some concerns. How do users log in or interact with the app before hitting a case? That might require them to log into one of the regional sites first, which could complicate things. You should check with your product manager about the real need for a unified URL—I've not encountered many services using a single URL across multiple regions.
It sounds like your UUID-region map could see a lot of traffic, so just be ready for that load. If you can, it might be easier to embed a region ID in the UUID itself when you generate it. That way, you won’t need to constantly check the map for each request, keeping things efficient. You can maintain the map for any legacy cases, though!
Good point! We actually have shared tables for users, cases, and sessions that sit in a smaller, accessible database shared across regions, so that should help with that part.