How to access EC2 Private IP address from Private API endpoint

Atit Shah
2 min readMar 4, 2022


We cannot use HTTP Proxy integration, as HTTP Proxy integration are used to integrate only the public endpoints and not the private endpoints (in our case it is EC2 Private IP address) inside a VPC.

So, to overcome this we need to establish a VPC Link Integration with the Private API endpoint instead of HTTP Proxy Integration. We need to integrate the Private API endpoint with VPC Link Integration by providing the EC2 Private IP as the endpoint URL. Then we will be able to successfully access the EC2 Private IP by invoking the Private API endpoint from within the VPC.

Basically, we are going to set up API Gateway Private Integration (VPC Link Integration) to achieve our use case. So, in order to extend access to our private VPC resources beyond the VPC boundaries or within the VPC, we can create an API with private integration. Basically, this is what the Private Integration (VPC Link Integration) flow looks like:

The EC2 part is already done, next would be.

NLB: You must first create a Network Load Balancer. Your Network Load Balancer must have a listener that routes requests to resources in your VPC, in our case, it would be EC2 Instance in our VPC.

VPC Link: Basically, VPC link is a concept of API Gateway that helps us to connect to a private resource in VPC that is behind an NLB. A VPC link acts like any other integration endpoint for an API and helps simplify configuring private integration. So next we create a VPC link that you use to connect your API and your Network Load Balancer.

API Gateway: After you create a VPC link, you create private integration (VPC Link Integration) to route traffic from your Private API endpoint to resources in your VPC through your VPC link and Network Load Balancer.

**Note that after creating NLB we need to grant permissions to create a VPC link. Where you or the user must have permissions to create, delete, and view VPC endpoint service configurations, change VPC endpoint service permissions, and examine load balancers.


[1] Set up API Gateway private integrations —

[2] Tutorial: Build a REST API with API Gateway private integration —



Atit Shah

Cloud Architect | DevOps Practitioner | Learner