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 Risposta
4
Risposta accettata

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
ESPERTO
con risposta un mese fa
profile picture
ESPERTO
Artem
verificato un mese fa
profile picture
ESPERTO
verificato un mese fa
profile pictureAWS
ESPERTO
iBehr
verificato un mese fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande