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
已提问 1 个月前91 查看次数
1 回答
4
已接受的回答

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
专家
已回答 1 个月前
profile picture
专家
Artem
已审核 25 天前
profile picture
专家
已审核 1 个月前
profile pictureAWS
专家
iBehr
已审核 1 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则