Overview
A VPC upstream is to open the services deployed in the VPC for external access through API Gateway. It provides load balancing capabilities and can connect to multiple services in the VPC at the same time.
Solution Strengths
There is no need to purchase private network CLBs. With VPC upstreams, you can use API Gateway alone to open services in the VPC for external access. The VPC upstream feature itself is free of charge, resulting in low costs.
VPC subnets are used for communication, resulting in low network latency and high performance.
Prerequisites
You have created VPC resources such as CVMs. Note:
Currently, VPC upstreams support only APIs mounted under dedicated instances but not shared instances.
Directions
Step 1. Create a VPC upstream
2. On the left sidebar, click VPC Upstreams. The VPC upstream list page is displayed.
3. Click Create in the top-left corner of the page to create a VPC upstream.
|
| | Name of the VPC upstream. An upstream name can contain up to 50 characters out of a-z, A-Z, 0-9, and _. |
| | VPC of the backend resource to be connected. |
| | Remarks of the VPC upstream. |
| | Only the weighted polling algorithm is supported currently. |
| | Protocol for API Gateway to interact with backend resources. HTTP and HTTPS are supported. |
| | Request header Host of backend requests, usually the backend service domain name and port number. |
| | List of backend nodes to which API Gateway forwards messages. A list can contain up to 200 nodes. You need to set the node address, port number, and weight for each node. |
| | Number of retry attempts for a failed node request of API Gateway. The default value is 5. Enter an integer ranging from 1 to 100. |
Step 2. Create an API for the backend to connect to resources in the VPC and associate it with the VPC upstream
2. In the service list, click a service name mounted under a dedicated instance to view the service details.
3. In the service details, click the Manage API tab and choose to create a general API based on the backend business type.
4. Click Create, enter the API frontend configuration, and click Next.
5. In Backend Configuration, set Backend Type to VPC resources, set Connection Mode to VPC Upstream, and select the VPC upstream created in step 1.
6. Complete the rest configuration.
Step 3. Call the API
Call the API created in step 2. The API can be called successfully.
Notes
On the Associated APIs tab on the VPC upstream details page, you can view the APIs that use the current VPC channel as the backend. You need to delete these APIs before deleting the VPC upstream to avoid affecting API calling.
A dedicated instance runs in a VPC. If the VPC where the dedicated instance resides is inconsistent with the VPC connected to the VPC upstream, connect the two VPCs via Cloud Connect Network to avoid affecting API calling.
Was this page helpful?