I am having a bunch of micro services running in AWS ECS fargate with ALB and Route53.Each micro service has an ALB with Route53.
Is there any kind of possibility where I can use only one ALB for all the microservices and route to their respective Route53 paths??
Here, I am not using EKS. Using AWS ECS Fargate.
To server multiple Fargate services from a single ALB, you need to create different target groups (TGs) for them. So, each service will have its own TG, and ALB will forward traffic to respective TGs based on some listener rules.
Since you have Route53, a common choice is to create sub-domains, e.g.:
service1.example.com
andservice2.example.com
. You associate them as simple Alias A records with the same ALB.On the ALB you will have single listener (e.g. HTTP 80), with different rules. For example:
Host header
equal toservice1.example.com
, withAction
ofForward
to TG1.Host header
equal toservice2.example.com
, withAction
ofForward
to TG2.And that's it. Any request from the internet directed to
service1.example.com
will go to your TG1 which is Fragete service1. Same for requests toservice2.example.com
.