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

Adding Backend Instances (Cloud Servers)

Function

This API is used to add cloud servers to a specified VPC channel.

URI

The following table lists the HTTP/HTTPS request method and URI of the API.

Table 1 HTTP/HTTPS request method and URI

Request Method

URI

POST

/v1.0/apigw/vpc-channels/{id}/members

The following table lists the parameter in the URI.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

id

Yes

String

VPC channel ID

Request

Table 3 Parameter description

Parameter

Mandatory

Type

Description

vpc_instances

Yes

Dictionary

Backend instance list

Table 4 Backend instance details

Parameter

Mandatory

Type

Description

instance_name

Yes

String

Cloud server name

The name must contain 1–64 characters. Only letters, digits, periods (.), hyphens (-), and underscores (_) are allowed.

instance_id

Yes

String

Cloud server ID

The ID must contain 1–64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.

weight

Yes

Integer

Cloud server weight

The larger the weight is, the more requests are forwarded to the cloud server.

Range: 1–100

Example request:

{
  "vpc_instances": [
    {
      "instance_id": "instance02",
      "instance_name": "instance_name02",
      "weight": 10
    }
  ]
}

Response

Table 5 Parameter description

Parameter

Type

Description

total

Integer

Total number of cloud servers under the VPC channel

size

Integer

Total number of cloud servers returned

vpc_instances

Dictionary

Cloud server list

Table 6 Backend instance details

Parameter

Type

Description

id

String

Backend instance object ID

vpc_id

String

VPC channel ID

status

Integer

Status of the backend instance object

instance_name

String

Cloud server name

instance_id

String

Cloud server ID

host

String

Cloud server IP address

weight

Integer

Cloud server weight

The larger the weight is, the more requests are forwarded to the cloud server.

Range: 1–100

create_time

Timestamp

Time when the cloud server is added to the VPC channel

Example response:

{
  "total": 2,
  "size": 2,
  "vpc_instances": [
    {
      "instance_id": "instance02",
      "instance_name": "instance_name02",
      "host": "127.0.0.2",
      "weight": 10,
      "id": "680e42fab429447ca23b9623107523d9",
      "vpc_id": "c3e6a7d85d9e47be89dfcc3cd37405d7",
      "status": 1,
      "create_time": "2018-07-27T12:42:32Z"
    },
    {
      "instance_id": "instance01",
      "instance_name": "instance_name01",
      "host": "127.0.0.1",
      "weight": 10,
      "id": "c3bc73605a8b400793363c87574fbad7",
      "vpc_id": "c3e6a7d85d9e47be89dfcc3cd37405d7",
      "status": 1,
      "create_time": "2018-07-27T12:30:48Z"
    }
  ]
}

Status Codes

Table 7 Status codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

500

Server Internal Error