- Newest
- Most votes
- Most comments
While it's possible to use AWS Cloud Map with API Gateway, the integration options differ between HTTP APIs and REST APIs. For REST APIs, the VPC Link options are more limited compared to HTTP APIs.
For REST APIs, you are correct that the primary option for VPC Links is to use a Network Load Balancer (NLB). REST APIs do not have direct integration with Cloud Map like HTTP APIs do.
If you're using ECS Service Connect and want to integrate it with a REST API in API Gateway, you would typically need to set up an NLB in front of your ECS services, and then create a VPC Link to that NLB from your REST API.
However, if you have the flexibility to use HTTP APIs instead of REST APIs, you would have more options. HTTP APIs support VPC Links that can integrate with Application Load Balancers (ALBs), Network Load Balancers (NLBs), and AWS Cloud Map. This would allow you to use Cloud Map directly with your API Gateway setup, which could be beneficial when working with ECS Service Connect.
If you must use a REST API and still want to leverage Cloud Map, you might need to consider an architecture where you use Cloud Map for service discovery within your VPC, but still front your services with an NLB to connect to the REST API's VPC Link. This approach would be more complex but could potentially meet both requirements.
In summary, while Cloud Map integration is not directly available for REST API-based API Gateway, it is an option for HTTP APIs. For REST APIs, you're currently limited to NLB-based VPC Links.
Sources
HTTP API - Best Practices for Designing Amazon API Gateway Private APIs and Private Integration
Create private integrations for HTTP APIs in API Gateway - Amazon API Gateway
No, it's not currently possible to directly link AWS CloudMap to a REST API-based API Gateway. The integration options for REST API Gateway are more limited compared to HTTP APIs.
For REST API Gateway, your only option for private integration is to use a VPC Link connected to a Network Load Balancer (NLB). There is no direct integration with CloudMap or ECS Service Connect for REST APIs.
If you're using ECS Service Connect and want to leverage CloudMap service discovery, you have two options:
-
Use HTTP APIs instead of REST APIs: HTTP APIs support CloudMap integration through the VPC Link, allowing you to connect to ECS services registered with CloudMap.
-
Create an intermediary layer: If you must use REST APIs, set up an NLB in front of your ECS services, then connect your API Gateway to this NLB via VPC Link. The NLB would target your ECS services, but you lose the dynamic service discovery benefits of CloudMap.
The architectural difference exists because HTTP APIs were designed with more modern integration patterns in mind, while REST APIs follow an older design that primarily focused on NLB integration for private endpoints.
Documentation:
