Tuesday, 6 February 2018

How to make API gateway listen to Microservice deployed on ECS under ALB

Now that the ECS and Docekerisation is something every AWS enthsuiast will be familiar with.There are still some challenges that are left to solve till AWS comes up with new features.

Problem:--  Enable API gateway URL endpoints for Microservices that are deployed on ECS in a private subnet  and are accessible through the ALB.

Constraint  API gateway can talk to Load balancer through VPC links but only when we have NLB.
No-brainer that we cant have a replicate deployment of API's under NLB to be accessible through API Gateway. ( unnecessary additional costs)


  1. Capture the instances and the dynamic port allocated to them by ALB under the desired Microservice target group.
  2. Create a target group specifically to be registered under NLB on the desired traffic port and add the captured instnaces and their port in the target registration tab.
  3. Create a NLB and make it listen to the created target group of step 2.
  4. Go to API gateway and create a VPC link with the NLB, it will take 3-4 minutes to become active.

You are set to use the VPC link for API Gateway deployment.

For secuity reasons will advise the use of API key.


1 comment: