Joe
Joe

Reputation: 187

Can an API Gateway point to multiple Application Load Balancers?

Having a hard time figuring out a microservices architecture.

Right now I have an ECS Cluster with two services (TodoService, CategoriesService) running in containers. Both of the services have their own Load Balancer. I'm trying to build an API Gateway where /todos would route to the Todo-app-load-balancer and /categories would route to the Categories-app-load-balancer.

First, is this a good approach to microservices? And second, question from the title.

Upvotes: 4

Views: 2402

Answers (2)

Jijo Alexander
Jijo Alexander

Reputation: 1290

Is it a good or bad approach is moreover an architectural decision, But I can suggest using one ALB(Ingress) with different rules can solve your problem, Also in API GATEWAY only allow to add ELB services directly ALB will not but still there is a workaround by adding direct DNS. Here I'm attaching two screenshots for your reference.

enter image description here

Direct integration is not allowed on ALB, but you can use the DNS name manually.

enter image description here

Upvotes: 1

Ervin Szilagyi
Ervin Szilagyi

Reputation: 16775

First, is this a good approach to microservices?

Yes, there is nothing wrong with this approach.

Can an API Gateway point to multiple Application Load Balancers?

Yes, you can point each method from the API gateway to an entirely different backend resource.

In case of an Application Load Balancer, there are multiple ways of doing this. Probably the easiest is to have a public Application Load Balancer and to create HTTP integration for it. You have to specify the DNS name for the application load balancer as the endpoint. For more information, see this support page.

enter image description here

Other option would be to use VPC Links, which would integration with private load balancers. While this would be recommended for production, it is a bit more complex to set it up.

Upvotes: 1

Related Questions