RegisterBackend

1. API Description

This API is used to add one or more backend servers to a load balance listener.

Note

  • The state of the load balance instance must be RUNNING.

  • Adding bare metal instances is supported. The bare metal instance must be connected to the border gateway of the load balancer’s VPC through the Layer 3 Cloud Router in Cloud Networking.

  • When adding a bare metal instance, only its private IP address should be specified; the instance ID must not be provided.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

loadBalancerId

Yes

String

The ID of the load balance instance.

listenerId

Yes

String

The listener ID of the load balancer.

backendServers

Yes

Array of BackendServer

List of backend servers to be added.

The same server cannot be bound multiple times under a single listener.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required to locate a problem.

4. Code Example

Add a backend server to a listener.

POST /api/v2/zlb HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: RegisterBackend
<Common Request Params>

Request:
{
  "loadBalancerId": "<loadBalancerId>",
  "listenerId": "<listenerId>",
  "backendServers": [
    {
      "instanceId": "<instanceId>",
      "privateIpAddress": "10.0.0.1",
      "weight": 100
    }
  ]
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

HTTP Status Code
Error code
Description

404

INVALID_LB_LISTENER_NOT_FOUND

The load balancer listener does not exist.

400

INVALID_INSTANCE_IP_ADDRESS

The instance's private IP is invalid.

404

INVALID_INSTANCE_NOT_FOUND

Backend server does not exist.

409

INVALID_BACKEND_INSTANCE_LISTENER_EXIST

Backend server already exists.

409

INVALID_BACKEND_INSTANCE_MULTIPLE

Duplicated backend servers.

400

INVALID_BACKEND_IP_ADDRESS

No instance found for the specified private IP of the backend server.

409

INVALID_BACKEND_IP_ZBG_REQUIRED

A border gateway is required for the VPC to which the backend server IP belongs.

400

INVALID_BACKEND_SERVER_IP_INVALID

Invalid backend server IP. The backend server IP must be a private IP.

409

INVALID_BACKEND_SERVER_IP_REPEAT

Duplicated backend server IPs.

400

INVALID_BACKEND_SERVER_PORT

When a listener listens on multiple ports, the backend port must match and cannot be set manually.

400

INVALID_LB_STATUS

Load balancer state is not supported.

404

INVALID_BACKEND_ROUTE_NOT_FOUND

Route to the backend server IP is not found.

Last updated