Updated on 2022-02-21 GMT+08:00

Creating a VPC Channel

Scenario

VPC channels allow services deployed in VPCs to be accessed through their subnets, lowering latency and balancing loads of backend services.

After creating a VPC channel, you can configure it for an API with an HTTP/HTTPS backend service. You can create a maximum of 30 VPC channels.

For example, six ECSs have been deployed in a VPC, and a VPC channel has been created to reach ECS 01 and ECS 04. API Gateway can access these two ECSs through the VPC channel.

Figure 1 Accessing ECSs in a VPC channel through API Gateway

Prerequisites

You have created cloud servers.

Creating a Fast Channel

  1. Log in to the management console.
  2. Click in the upper left corner and choose API Gateway.
  3. In the navigation pane, choose API Publishing > VPC Channels.
  4. Click Create VPC Channel, and set the parameters listed in Table 1.

    Table 1 Parameters for creating a VPC channel

    Parameter

    Description

    Name

    VPC channel name.

    Port

    The host port of the VPC channel, that is, the port of the backend service.

    Range: 1–65535.

    Routing Algorithm

    The algorithm to be used to forward requests to cloud servers you select.

    The following routing algorithms are available:

    • WRR: weighted round robin
    • WLC: weighted least connection
    • SH: source hashing
    • URI hashing

    Protocol

    The protocol used to perform health checks on cloud servers associated with the VPC channel. Options:

    • TCP
    • HTTP
    • HTTPS

    Default value: TCP.

    Path

    The destination path for health checks.

    Set this parameter only when Protocol is not set to TCP.

    Check Port

    The destination port for health checks.

    By default, the port of the VPC channel will be used.

    Healthy Threshold

    The number of consecutive successful checks required for a cloud server to be considered healthy.

    Range: 2–10. Default value: 2.

    Unhealthy Threshold

    The number of consecutive failed checks required for a cloud server to be considered unhealthy.

    Range: 2–10. Default value: 5.

    Timeout (s)

    The timeout used to determine whether a health check has failed. Unit: s.

    Range: 2–30. Default value: 5.

    Interval (s)

    The interval between consecutive checks. Unit: s.

    Range: 5–300. Default value: 10.

    Response Codes

    The HTTP codes used to check for a successful response from a target.

    Set this parameter only when Protocol is not set to TCP.

  5. Click Next.
  6. Click Select Cloud Server.
  7. Select the cloud servers you want to add, and click OK.

    To ensure a successful health check and service availability, configure the security groups of the cloud servers to allow access from 100.125.0.0/16.

  8. Click Finish.

Creating an ELB Channel

  1. Log in to the management console.
  2. Click in the upper left corner and choose API Gateway.
  3. In the navigation pane, choose API Publishing > VPC Channels.
  4. Click Create ELB Channel.
  5. Enter a channel name, select a load balancer, and click OK.

    • Each load balancer can be used to create only one ELB channel. ELB channels cannot be updated once created.
    • ELB channels can be created only using private network load balancers. For more information, see .

Follow-Up Operations

Create an API for backend services deployed in a VPC to balance loads.