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.

1 Antwort
4
Akzeptierte Antwort

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
EXPERTE
beantwortet vor einem Monat
profile picture
EXPERTE
Artem
überprüft vor einem Monat
profile picture
EXPERTE
überprüft vor einem Monat
profile pictureAWS
EXPERTE
iBehr
überprüft vor einem Monat

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen