Is it possible to decide which EC2 instance to request to?

0

I'm new to AWS. Let’s say i have a standard REST API deployed in 3 EC2 instances in different regions, and in a different application, I have a frontend. Is it possible to decide know which instance to use and receive the frontend request based on a user configuration?

I want to know if this is possible because my app needs to test connections based on region.

Thanks is advance.

Al
asked 13 days ago79 views
1 Answer
4
Accepted Answer

You can create 1 Application Load Balancer. Create VPC peering between Load Balancer VPC and VPCs in other regions, where your REST API EC2 instances are deployed. Create 3 target groups for your ALB. Each Target group has own EC2 instance (target by IP address)

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html#target-group-ip-address-type

When all 3 instances are registered under ALB, create 3 rules where you will analyze HTTP headers and route requests to the appropriate EC2 instance

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-listeners.html#http-header-conditions

profile picture
EXPERT
answered 13 days ago
profile picture
EXPERT
Artem
reviewed 8 days ago
profile picture
EXPERT
reviewed 13 days ago
profile pictureAWS
EXPERT
iBehr
reviewed 13 days 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.

Guidelines for Answering Questions