EC2 could not resolve private API Gateway

1.2k Views Asked by At

The current set up is:

  • EC2 instance deployed in a VPC in subnet A.
  • VPC Endpoint for execute-api in the same VPC in the same subnet (A)
  • Private API Gateway with a resource policy to Allow both the VPC and VPC Endpoint to invoke the API

VPC has all its DNS settings enabled. DNS Hostnames & DNS resolution.

VPC Endpoint and EC2 instances both have allowed all traffic to port 443.

What am I missing here? The EC2 instance cannot seem to resolve the API via its https://(api ID).execute-api.(region).amazonaws.com/(api)

1

There are 1 best solutions below

1
On

Very late on this, but for anyone else googling the correct link is : https://{api-id}-{vpc-endpoint}.execute-api.{region}.amazonaws.com/{stage}/.

I believe the issue in the original post here is the vpc-endpoint id is missing from the link. I've seen that incorrect format referenced in a few places, I don't know then but it definitely won't work without it now.