0
votes

I have created public API using AWS api gateway with the resource cars and a GET method. I also have backend API,/api/routing, that is hosted on EC2 windows instance. The backend API only accepts POST request and used for routing the request based on some header values.

In integration request i also have Mapping Template setup so it can POST data to api/routing

So the integration request for cars public API looks like below

enter image description here

The Inbound rules for EC2 instance

enter image description here

Issue
The Endpoint URL is using private ip of EC2 instance. When i Test cars api i get error

Execution failed due to configuration error: Invalid endpoint address

If i change the Endpoint Url to use public ip address then its working as expected

Eventually, i would like to access backend API using private-ip. The EC2 instance is a free instance that AWS created.

I understand that if i have VPC then in API Gateway i need to setup VPC Links, but I have not created any VPC.(unless aws by default creates one).

1
AWS has created default VPC for you. You will need to use VPC links for integration with private subnets.Imran
i tried creating NLB as per the article and configured VPC Link. Only difference is i created internal NLB instead of public. Because I think, the client for EC2 instance is API Gateway. However that did not workLP13

1 Answers

0
votes

found it. After creating VPC link I was still selecting Integration Type as HTTP..it should be VPC Link