API Gateway per Multiple ECS services

0

I'm trying to figure out the best way to go about having 2 separate APIs on the same ECS cluster. I'm not sure if this is the best way to go about it or if I should have a separate ECS instance.

For the current configuration.

  • ECS Service is running with a task that deploys a Docker image running NodeJS
  • A Network Load Balancer is attached to the ECS instance
  • API Gateways is configured as a proxy with a VPCLINK which connects to the network load balancer
  • Docker Image is set to port 80

Now I want to add a second API and I want to open it to Port 81 I created a separate service which runs a task for another docker image I attached the same network load balancer and added a listener for port 81 I then went to setup the API Gateway for this second API and I wasn't sure how to point it to the right port.

As reference, this is the tutorial I used to setup API Gateway: https://manurana.medium.com/tutorial-connecting-an-api-gateway-to-a-vpc-using-vpc-link-682a21281263

I've also attached the architecture and the ECS service is created under the private subnets. Enter image description here

1 Answer
1
Accepted Answer

Since you said you have 2 separate APIs, it is generally preferable to separate your API Gateway, Network Load Balancer, ECS Cluster for each API if you don't have special reasons to share a common APIGW, NLB, Cluster across your services. This can make you easier to manage and troubleshoot each API because all the configurations and logs are separated. If one of the API goes wrong, the impact to the other APIs will also be mitigated.

profile picture
HS
answered 7 months ago
  • Thanks for the reply! I was leaning towards this approach but I needed some confirmation that it was the right idea. Thanks for providing the information!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions