bruzza42
bruzza42

Reputation: 413

AWS Load Balancer Path Based Routing

I am running a microservice application off of AWS ECS. Each microservice currently has its own Load balancer.

There is one main public facing service which the rest of the services communicate with via gateways. Having each service have its own ELB is currently too expensive, is there some way to have only 1 ELB for the public facing service that will route to the other services based off of path. Is this possible without actually having the other service names in the URL. Could a reverse proxy work?

I know this is a broad question but any help would be appreciated

Upvotes: 0

Views: 752

Answers (1)

Hossein Heydari
Hossein Heydari

Reputation: 1549

Inside your EC2 panel go to loadbalancers section, choose a loadbalancer and then in listeners tab, there is a button named view/edit rules, there you set conditions to use a single loadbalancer for different clusters/instances of your app. note that for each container you need a target group defined.

You can config loadbalancer to route based on:

  1. Http Headers
  2. Path i.e: www.example.com/a or www.example.com/b
  3. Host Header(hostname)
  4. Query strings
  5. or even source Ip.

That's it! cheers.

Upvotes: 4

Related Questions