Search code examples
amazon-web-servicescluster-computingamazon-elb

Is a there way to config an ALB for two clusters?


I'm trying to set up a single loadbalancer in AWS for two clusters in a the same VPC, is that possible?

Because it only provides one DNS name which sometimes routes to cluster A and sometimes cluster B.


Solution

  • yes you can defintely use a single LB in front of multiple clusters which are in different AZ .

    one DNS name which sometimes routes to cluster A and sometimes cluster B.

    Its true that ALB exposes a single hostname which routes to cluster A and sometimes cluster B because this is what load balancing means, balancing load/raffic to different clusters, but this is happening because right now may be both the clusters are registered to a single target group.

    However, you can register cluster 1 in target group 1 and another cluster 2 in target group 2. ALB allows you to route request to different target group based on ;-

    • path in url
    • hostname
    • query string
    • source IP condition
    • HTTP header
    • host header

    so for example in the case of URL in path condition www.example.com/a will got to target group one means cluster 1 and for www.example.com/b request will got to target group 2 means cluster 2