Deploying API Gateway APIs on an Internal Website Using a VPC Endpoint and an Application Load Balancer
Overview
To meet the compliance requirements that private APIs are not accessible from the Internet and custom domain names are used, you can use VPC Endpoint (VPCEP), a dedicated application load balancer, API Gateway (Dedicated), and DNS to deploy APIs on an internal website accessible from an on-premises network. This architecture uses a VPC endpoint, an application load balancer, and the DNS service to route internal web traffic to the website backend server group or API Gateway backend server group based on the forwarding policies of the load balancer listener.
This architecture prevents network unreachability caused by deploying VPC endpoints in non-routable subnets and also avoids the side effects that may arise when using custom domain names and proxy servers for domain name routing. For example, transmitting API gateway traffic to an on-premises data center through Direct Connect may interrupt other internal sites.
Solution Architecture
The following architecture diagram shows how a dedicated application load balancer deployed in a VPC forwards web traffic to the website backend server group or API Gateway backend server group based on the listener forwarding policies.
The API gateway is configured for private network access. The backend server group uses the VPC endpoint IP address as the backend server address, and access control policies allow only calls from specific VPC endpoints. The custom domain name of the API gateway is updated to api.domain.com, and the ELB forwarding policy routes traffic based on the Host Header.

- DNS resolution and SSL offloading
A user in an on-premises data center accesses the internal website by sending requests to ui.domain.com and api.domain.com. After the requests reach the Huawei Cloud VPC through Direct Connect or VPN, DNS resolves the domain names to the private IP address of the load balancer. The load balancer terminates SSL connections and uses SNI certificates hosted on SCM to provide HTTPS services for ui.domain.com and api.domain.com.
- The ELB listener uses a forwarding policy to forward traffic based on the domain name.
- If the Host Header is api.domain.com, the request is forwarded to the API Gateway backend server group. ELB establishes a new connection to the API gateway over port 443.
- If the Host Header is ui.domain.com, the request is forwarded to the website backend server group.
After the request reaches the API gateway, the custom domain name mapping configured in the API gateway determines the host name and the target API.
Constraints
- IP as Backend cannot be disabled once enabled. Each backend server can handle a maximum of 100,000 concurrent connections.
- Each interface VPC endpoint corresponds to a VPC endpoint service. A VPC endpoint service can be accessed by other accounts only after a whitelist is configured.
- The private domain name of a dedicated API gateway does not need filing. You can add an A record set to point the domain name to the inbound access address of the gateway or add a CNAME record set to point the domain name to the group debugging domain name.
Preparations
- There is an SNI certificate for both the website and the API (covering both ui.domain.com and api.domain.com)
- There is a Direct Connect or VPN connection between the on-premises data center and the Huawei Cloud VPC.
- There is a private zone on the DNS console and the local DNS requests can be forwarded to the Huawei Cloud DNS through the inbound endpoint of DNS Resolver.
- There is a routable private subnet. Ensure that the on-premises data center can access the private subnet.
Tool Description
| Service | Description |
| API Gateway helps you create, release, maintain, monitor, and protect REST APIs, and supports API calls of any scale. Dedicated API gateways run in your VPCs and support private network access and custom domain names. | |
| Domain Name Service (DNS) provides high-availability, scalable DNS services. DNS supports private domain name resolution, allowing you to map private domain names to private IP addresses in VPCs for Huawei Cloud resources. | |
| CCM provides SSL Certificate Manager (SCM) and Private Certificate Authority (PCA) modules. SCM works with globally renowned Certificate Authorities (CAs) to provide full lifecycle management of SSL certificates and supports one-click deployment to ELB and Web Application Firewall (WAF). | |
| VPC Endpoint establishes private channels between VPCs and VPC endpoint services, allowing you to access cloud services or private services without using the Internet. Interface and gateway VPC endpoint services are supported. |
Procedure
This solution involves five tasks: creating an SNI certificate, deploying a VPC endpoint in a non-routable private subnet, configuring a load balancer, configuring DNS, and deploying an API gateway.
Step 1: Create an SNI Certificate
| Task | Description | Required Personnel |
| Creating an SNI certificate and importing it to CCM |
| Network administrator |
Step 2: Deploy a VPC Endpoint in a Non-Routable Private Subnet
| Task | Description | Required Personnel |
| Creating an interface VPC endpoint for an API gateway |
For details, see Buying a VPC Endpoint. | Cloud administrator |
Step 3: Create a Load Balancer
| Task | Description | Required Personnel |
| Creating a backend server group for an application | Create a backend server group for website resources and add the ECS in the VPC as the backend server. For details, see Creating a Backend Server Group. | Cloud administrator |
| Creating a backend server group for an API Gateway VPC endpoint |
For details, see Using IP as a Backend to Route Traffic Across Backend Servers. | Cloud administrator |
| Creating a dedicated application load balancer |
For details, see Creating a Dedicated Load Balancer. | Cloud administrator |
| Creating forwarding policies for the listener | Create forwarding policies for the HTTPS listener.
For details, see Adding a Forwarding Policy. NOTE: After advanced forwarding is enabled for a dedicated load balancer, more forwarding rules based on HTTP header, query string, and CIDR block are supported. | Cloud administrator |
Step 4: Configure DNS
| Task | Description | Required Personnel |
| Creating a private zone | Create the private zone domain.com in DNS and associate it with the VPC. For details, see Creating a Private Zone. | Cloud administrator |
| Creating record sets for the private zone | Add two CNAME record sets for the private zone:
For details, see Adding Record Sets for a Private Zone. NOTE: You can also add an A record set with the value set to the private IP address of the load balancer. | Cloud administrator |
Step 5: Create a Private API Endpoint on an API Gateway
| Task | Description | Required Personnel |
| Creating and configuring a dedicated API gateway |
For details, see Creating a Gateway. | Application developer and cloud administrator |
| Creating an API and configuring access control |
For details, see Configuring API Access Control. | Application developer and cloud administrator |
| Binding a custom domain name |
For details, see Configuring the Domain Name for Calling APIs and Binding a Domain Name. | Cloud administrator |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot