Skip to content

How API Gateway handle integration target and endpoint URL in a VPC link integration case.

0

Regarding API Gateway behaviour on handling integration target and endpoint URL in a VPC link and nonproxy integration case, I found it doesn't work when I only set an endpoint URL to my internal load balancer, I have to also set integration target to the load balancer arn. But it works well when I keep the integration target but change endpoint URL to a dummy link. So API Gateway basically forward my request to integration target regardless of the endpoint URL? And I also found if I have a path in my dummy link, for example www.abc.com/app/uset/get, the request path (/app/uset/get) also works. So API Gateway also attaches the request path in endpoint URL to my integration target load balancer?

Thanks.

1 Answer
1
Accepted Answer

Based on how API Gateway handles VPC link integrations, your observations are correct. Let me clarify the distinct roles of these two parameters:

Integration Target vs Endpoint URL:

The integration target (specified as the ARN of your Application Load Balancer or Network Load Balancer) is what actually determines where API Gateway routes your requests. This is the critical parameter for VPC link integrations - it tells API Gateway which load balancer in your VPC to send traffic to.

The endpoint URL serves a different purpose: it's primarily used to set the Host header of the integration request, not for routing. This is why your integration works when you change the endpoint URL to a dummy link but keep the integration target - API Gateway is still routing to the load balancer specified in the integration target.

Regarding the Path Behavior:

Yes, when you include a path in your endpoint URL (like www.abc.com/app/user/get), API Gateway does use that path. The path portion from the endpoint URL gets incorporated into the request sent to your integration target. This allows you to specify a base path that should be prepended to requests going through the VPC link.

In summary: for VPC link integrations, the integration target determines where the request goes (which load balancer), while the endpoint URL primarily sets the Host header and can provide a base path for your requests. The integration target is the required parameter for proper routing, which explains why your integration didn't work when you only specified the endpoint URL.
Sources
Tutorial: Create a REST API with a private integration - Amazon API Gateway
Set up a private integration - Amazon API Gateway
x-amazon-apigateway-integration object - Amazon API Gateway

answered a month ago

EXPERT

reviewed a month ago

AWS
SUPPORT ENGINEER

reviewed a month 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.