HTTP API GW + API VPC Link + Cloudmap + Fargate - How does it load balance


I am using an infrastructure setup as described in the title. This setup is also somewhat shown in this picture:

In the official AWS blog here: the following is stated about using such setup:

As AWS Cloud Map provides client-side service discovery, you can replace the load balancer with a service registry. Now, connections are routed directly to backend resources, instead of being proxied. This involves fewer components, making deployments safer and with less management, and reducing complexity.

My question is simple: What load balancing algorithm does HTTP API GW use when distributing traffic to resources (the Fargate tasks) registered in a service registry? Is it round-robin just as it is with ALB?

Only thing I was able to find is this:

For integrations with AWS Cloud Map, API Gateway uses DiscoverInstances to identify resources. You can use query parameters to target specific resources. The registered resources' attributes must include IP addresses and ports. API Gateway distributes requests across healthy resources that are returned from DiscoverInstances.

3 Answers
Accepted Answer

Ok, So I got official answer from Support team:

For HTTP API -> CloudMap integration, API Gateway service calls "DiscoverInstances" API call. This call returns healthy instances. API Gateway then selects any one of the instances randomly to route the actual request to.

Hence we can understand that traffic distribution differs in HTTP API -> CloudMap integration from that of HTTP API -> Application Load Balancer. Because ALB uses round robin to distribute the traffic, where in the traffic is distributed randomly in case of integration with CloudMap.

answered 2 years ago
profile picture
reviewed 2 months ago


Tim here with the Premium Support Team and I’ve been reading through your notes and checked out the blog post you linked.

If you can could you open a AWS support case with us to further explore this topic? We’d like to understand the use case you have a bit more in depth and possibly gather some ARNs which you can privately share with us then.


answered 2 years ago
  • Yes, I have reached out to support already.


I've found this re:invent 2020 slide which says the traffic gets routed to available services in a round-robin pattern, hope that will be helpful.

answered a year ago

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