Creates a vServer group and adds backend servers to the vServer group.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateVServerGroup

The operation that you want to perform.

Set the value to CreateVServerGroup.

LoadBalancerId String Yes lb-bp1qjwo61pqz3ahl******

The ID of the Server Load Balancer (SLB) instance.

RegionId String Yes cn-hangzhou

The ID of the region where the SLB instance is deployed.

VServerGroupName String No Group1

The name of the vServer group.

The name must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.),and underscores (_).

BackendServers String No [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }, { "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }]

The list of backend servers to be added.

The value of this parameter must be a STRING list in the JSON format. You can specify up to 20 elements in each request.

  • ServerId: Required. Specify the ID of an Elastic Compute Service (ECS) instance or an Elastic Network Interface (ENI). This parameter must be of the STRING type.
  • Port: Required. Specify the port that is used by the backend server. This parameter must be of the INTEGER type. Valid values: 1 to 65535.
  • Weight: Required. Specify the weight of the backend server. This parameter must be of the INTEGER type. Valid values: 0 to 100.
  • Description: Optional. Specify the description of the backend server. This parameter must be of the STRING type. The description must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.),and underscores (_).
  • Type: Specify the type of the backend server. This parameter must be of the STRING type. Valid values:
    • ecs: an ECS instance. This is the default value.
    • eni: an ENI.
  • ServerIp: The IP address of the ECS instance or ENI.

Examples:

  • ECS instance: [{ "ServerId": "i-xxxxxxxxx", "Weight": "100", "Type": "ecs", "Port": "80", "Description": "test-112" }].
  • ENI: [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" }]
  • ENI with multiple IP addresses: [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112" },{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "172.166.**.**", "Port":"80","Description":"test-113" }]

Response parameters

Parameter Type Example Description
VServerGroupId String rsp-cige6******

The ID of the vServer group.

BackendServers Array of BackendServer

The list of backend servers.

BackendServer
ServerId String vm-2****

The ID of the ECS instance or ENI.

Port Integer 70

The port that is used by the backend server.

Weight Integer 100

The weight of the backend server.

Description String vServerGroup

The description of the vServer group.

Type String Type

The type of the backend server. Valid values:

  • ecs: an ECS instance. This is the default value.
  • eni: an ENI.
RequestId String 9DEC9C28-AB05-4DDF-9A78-6B08EC9CE18C

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateVServerGroup
&LoadBalancerId=lb-bp1qjwo61pqz3ahl******
&RegionId=cn-hangzhou
&BackendServers= [{ "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112"  }, { "ServerId": "eni-xxxxxxxxx", "Weight": "100", "Type": "eni", "ServerIp": "192.168.**.**", "Port":"80","Description":"test-112"  }]
&<Common request parameters>

Sample success responses

XML format

<CreateVServerGroupResponse>
  <VServerGroupId>rsp-bp1i4c******</VServerGroupId>
  <RequestId>3EBBDBAE-8E8B-438F-A109-95C2FDB2C333</RequestId>
  <BackendServers>
        <BackendServer>
              <Type>ecs</Type>
              <ServerId>i-bp1ds2yjlk66********</ServerId>
              <Description>test-11244</Description>
              <Port>80</Port>
              <Weight>100</Weight>
        </BackendServer>
  </BackendServers>
</CreateVServerGroupResponse>

JSON format

{
  "VServerGroupId": "rsp-bp1i4c3******",
  "RequestId": "3EBBDBAE-8E8B-438F-A109-95C2FDB2C333",
  "BackendServers": {
    "BackendServer": [
      {
        "Type": "ecs",
        "ServerId": "i-bp1ds2yjlk666******",
        "Description": "test-11244",
        "Port": 80,
        "Weight": 100
      }
    ]
  }
}

Error codes

For a list of error codes, visit the API Error Center.