Docs
api
Load Balance(ULB)
CreateVServer

Create CLB's VServer - CreateVServer

Overview

Create a VServer instance for CLB, define the listening protocol and port, as well as the load balancing algorithm.

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is CreateVServer.Yes
PublicKeystringThe user's public key can be obtained from Console (opens in a new tab)Yes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
RegionstringRegion. See List of Regions and Availability ZonesYes
ProjectIdstringProject ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the GetProjectList interface.No
ULBIdstringTraditional Load Balancer Instance IDYes
VServerNamestringVServer instance name, default is 'VServer'.No
ListenTypestringListener type, enumeration value, RequestProxy, request proxy; PacketsTransmit, packet forwarding. The default is RequestProxy.No
ProtocolstringThe protocol of the VServer instance, under the request proxy mode there are HTTP, HTTPS, TCP, under the message forwarding mode there are TCP, UDP. The default is 'HTTP'.No
FrontendPortintVServer backend port, value range [1-65535]; default value is 80No
MethodstringVServer load balancing mode, enumeration values: Roundrobin -> Round Robin; Source -> Source Address; ConsistentHash -> Consistent Hashing; SourcePort -> Source Address (Calculate Port); ConsistentHashPort -> Consistent Hashing (Calculate Port); WeightRoundrobin -> Weighted Round Robin; Leastconn -> Least Connections; Backup -> Master-Slave Mode.
ConsistentHash, SourcePort, ConsistentHashPort are only used in packet forwarding; Leastconn is only used in request proxy; Roundrobin, Source, and WeightRoundrobin, Backup are used in both request proxy and packet forwarding.
The default is: "Roundrobin".
No
PersistenceTypestringVServer session persistence mode, session persistence is turned off by default. Enumerated values: None -> Off; ServerInsert -> Automatically generate KEY; UserDefined -> User-defined KEY.No
PersistenceInfostringConfirm according to PersistenceType; None and ServerInsert: This field is meaningless; UserDefined: This field passes in a custom session hold StringNo
ClientTimeoutintWhen ListenType is RequestProxy, it represents the recovery time of idle connections, unit: seconds, value range: time (0, 86400], default value is 60; When ListenType is PacketsTransmit, it represents the connection holding time, unit: seconds, value range: [60, 900], 0 means disabling connection holding.No
MonitorTypestringHealth check type, enumeration values: Port -> Port check; Path -> Path check; Ping -> Ping detection; Customize -> UDP check
The default value for request proxy type is Port, where TCP protocol only supports Port, other protocols support Port and Path;
For message forwarding type, TCP protocol only supports Port, UDP protocol supports Ping, Port and Customize, the default value is Ping.
No
DomainstringConfirm according to MonitorType; When MonitorType is Path, this field is meaningful, representing HTTP check domain.No
PathstringConfirm according to MonitorType; When MonitorType is Path, this field is meaningful, representing the HTTP check path.No
RequestMsgstringConfirm according to MonitorType; When MonitorType is Customize, this field is meaningful, representing the request message sent by UDP check.No
ResponseMsgstringConfirm according to MonitorType; When MonitorType is Customize, this field is meaningful, representing the response message that the UDP check request should receive.No
SecurityPolicyIdstringSecurity policy group ID, default value 'Default'No
EnableCompressionint0: Off 1: On, used for data compression functionNo
ForwardPortintRedirect port, value range [0-65535]; the default value is 0, representing closure; only the HTTP protocol supports the opening of the redirect function.No
EnableHTTP2int0: Off 1: On, used to enable the http2 feature; the default value is 0No

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
VServerIdstringId of the VServer instanceNo

Example

Request Example

https://api.ucloud-global.com/?Action=CreateVServer
&Region=cn-bj2
&ProjectId=project-XXXXX
&Action=CreateVServer
&ULBId=ulb-XXXXX
&ListenType=RequestProxy
&PersistenceType=None
&PersistenceInfo=hsdhs
&Protocol=TCP
&VServerName=testvserver1
&Method=Source
&FrontendPort=80
&ClientTimeout=180
&MonitorType=EAWmpFKo
&Domain=HbTPGDtS
&Path=ScoEPSuy
&EnableHTTP2=1
&RequestMsg=zMpxnICB
&ResponseMsg=gKFbkkOl
&SecurityPolicyId=OEKOGXjU
&EnableCompression=1
&ForwardPort=6

Response Example

{
  "Action": "CreateVServerResponse",
  "RetCode": 0,
  "VServerId": "vserver-XXXX"
}