Search code examples
amazon-web-servicesapiprivateendpointvpc

Invoke Private API Gateway Without Host/x-apigw-api-id Headers


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.


Solution

  • 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