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 回答
1
已接受的回答

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
已回答 8 个月前
  • 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!

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则