Home > Mobile >  Unable to hit public AWS API gateway endpoints if a VPC Endpoint is created
Unable to hit public AWS API gateway endpoints if a VPC Endpoint is created

Time:11-10

I am trying to set up a VPC endpoint in an existing VPC. I am able to make calls to the private gateway endpoints from the lambda which is within the VPC.

Problem: When I try to invoke a Regional API gateway endpoint, I am getting a 403. Nat Gateway is setup. I am able to hit the internet via NAT gateway.

I need to call the private endpoint as well as regional endpoints from the lambdas within the VPC

CodePudding user response:

Your VPC endpoint shadows your public API endpoints. From docs:

you cannot access public APIs from a VPC by using an API Gateway VPC endpoint with private DNS enabled

Thus, you can disable private DNS for the VPC endpoint. This way, you will have to explicitly use private VPC endpoint URL in your lambda.

Alternative way to access public API is through:

Note that these DNS settings don't affect the ability to call these public APIs from the VPC if you're using an edge-optimized custom domain name to access the public API

  • Related