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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南