- Newest
- Most votes
- Most comments
I might have found the issue. It was a new vpce-id which was so similar that I didn't reflect over it. That in combination with command line history. :(
This is possible to resolve from both inside and outside of the VPC bbbbccccdd-vpce-000011112222aaaa7.execute-api.eu-west-1.amazonaws.com, where bbbbccccdd is the api-id and vpce-000011112222aaaa7 is the VPC Endpoint ID.
Your understanding of the setup is correct, but there are a few considerations and potential solutions for accessing your private REST API from on-premises:
-
DNS Resolution: The issue with resolving the API URL from on-premises is likely due to DNS resolution. To resolve this, you can set up a Route 53 private hosted zone in your VPC and create a DNS record for your API. Then, configure your on-premises DNS to forward queries for this domain to Route 53.
-
VPC Endpoint Configuration: Ensure that your VPC endpoint has private DNS enabled. This allows the API's DNS name to resolve to the private IP of the VPC endpoint within your VPC.
-
Custom Domain Name: Consider setting up a custom domain name for your private API. This provides a stable, vanity URL for your API that can be more easily managed across your network. You'll need an ACM certificate and a Route 53 private hosted zone for this.
-
CORS Configuration: For the CORS preflight issue, you need to configure CORS on your API Gateway. Ensure that the OPTIONS method is allowed and that the necessary headers (including x-apigw-api-id) are included in the Access-Control-Allow-Headers response.
-
Resource Policy: Make sure your API's resource policy allows access from your VPC endpoint. You may need to explicitly allow access from your on-premises IP range if it's not already covered.
-
Security Groups: Check that the security group associated with your VPC endpoint allows inbound traffic from your on-premises network.
If Postman works but browser-based access doesn't, it's likely a CORS issue. Focus on properly configuring CORS for your API, ensuring all necessary headers are allowed, and that the OPTIONS method is correctly set up.
Remember, when accessing the API from on-premises, you're essentially treating it as if you're inside the VPC, so the same access methods that work within the VPC should work from on-premises once DNS resolution and network routing are properly configured.
Sources
Internetwork traffic privacy - Amazon API Gateway
Implementing custom domain names for private endpoints with Amazon API Gateway | AWS Compute Blog
Prioritize API security - AWS Serverless Multi-Tier Architectures with Amazon API Gateway and AWS Lambda
Relevant content
asked 3 years ago
asked 2 years ago
- AWS OFFICIALUpdated 3 years ago

Point 1 is the key one here. You will need to establish a DNS zone to resolve to the endpoint