4

I have a private API Gateway stage with an associated VPC endpoint, and I have already followed the instructions here: https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-vpc-connections/ on how to connect to my API from inside the VPC. Using the Host/x-apigw-api-id works as expected, but I have some services that are third-party and I cannot add those headers to make them connect.

Is there any way to connect to an endpoint-specific hostname WITHOUT either Host or x-apigw-api-id header? e.g. (current) curl "https://vpc-endpoint-specific-hostname/route/" -H 'x-apigw-api-id: ' (desired) curl "https://.vpc-endpoint-specific-hostname/route/" (note no headers)

I know what the documents say, which is to use either of the two headers Host/x-apigw-api-id but I cannot add those headers for some of my services.

Zarka
  • 58
  • 1
  • 6

2 Answers2

5

if you enable private DNS, you can access the private API directly using this url

https://{restapi-id}.execute-api.{region}.amazonaws.com/{stage}

you can get read more here

Reza Nasiri
  • 1,360
  • 1
  • 6
  • 19
0

Even If you don’t have Private DNS enabled, you can still reach the Private API Gateway by using custom domains (which are technically not supported by Private API Gateways), we can ‘trick’ the VPC endpoint into understanding where to send traffic, without custom Host / x-apigw-api-id headers.

Steps:

  1. Create an internal-only Application Load Balancer
  2. The ALB needs to point to the IP addresses of the ENIs for the Interface VPC Endpoint - API Gateway (Steps to Create Interface VPC endpoint - API Gateway)
  3. Make sure that you have a DNS entry - example.com(in Route 53 or any other DNS provider) that points to the above load balancer we created.
  4. Make sure the ACM certificate is created for the above custom domain - example.com
  5. Navigate to the API Gateway console and click Custom Domain Names in the left menu bar. Select Regional and fill in your custom hostname and ACM certificate we created in steps 3 & 4

Please find the detailed steps here.

Velu
  • 1,681
  • 1
  • 22
  • 26