Private Amazon API Gateway with private custom domain name

Amazon Route 53 → private hosted zone → VPC Endpoint → Amazon API Gateway → (private)

Create a Private API Gateway with a custom domain. Configure access via VPC endpoint and set up DNS routing with Amazon Route 53 private hosted zone.

This AWS SAM template demonstrates how to create a private Amazon API Gateway with a private custom domain mame, configure secure access based on a specific VPC endpoint, and route traffic through Route 53 in a private hosted zone.
Private custom domain name is only accessible from a VPC endpoint, which is mapped to a stage in private Amazon API Gateway. A custom domain name is configured with an SSL/TLS certificate to provide secure access, and an associated Route 53 A-Alias record ensures that traffic is routed to the API.
As prerequisites for this pattern, you must have:
* A DNS name of execute-api VPC endpoint
* A custom domain name that you would like to create (e.g. private.mydomain.com)
* A valid certificate in ACM (Amazon Certificate Manager) in the same Region as Private Amazon API Gateway, that covers the namespace of the domain you would like to use (i.e. *.mydomain.com).
* A Route 53 Private Hosted Zone ID that has the domain name you would like to use (e.g. mydomain.com).

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/private-apigw-custom-domain

Deploy

Deploy the stack: <code>sam deploy --guided</code>


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Created by:

Usama Ali Khan

Usama Ali Khan

Usama is a Technical Account Manager at Amazon Web Services.

Follow on LinkedIn