Creates a server group.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateServerGroup |
The operation that you want to perform. Set the value to CreateServerGroup. |
ServerGroupName | String | Yes | sg-atstuj3rtoptyui**** |
The name of the server group. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter. |
ServerGroupType | String | No | Instance |
The type of the server group. Valid values:
|
VpcId | String | No | vpc-bp15zckdt37pq72zv**** |
The ID of the virtual private cloud (VPC). You can add only backend servers that are deployed in the specified VPC to the server group. Note This parameter takes effect when the ServerGroupType parameter is set to Instance or Ip.
|
Scheduler | String | No | Wrr |
The scheduling algorithm. Valid values:
Note This parameter takes effect when the ServerGroupType parameter is set to Instance or Ip.
|
Protocol | String | No | HTTP |
The backend protocol. Valid values:
Note If the ServerGroupType parameter is set to Fc, you can set Protocol only to HTTP.
|
ResourceGroupId | String | No | rg-atstuj3rtop**** |
The ID of the resource group. |
HealthCheckConfig | Object | Yes |
The configuration of health checks. |
|
HealthCheckConnectPort | Integer | No | 80 |
The backend port that is used for health checks. Valid values: 0 to 65535. Default value: 0. If you set the value to 0, the port of the backend server is used for health checks. |
HealthCheckEnabled | Boolean | Yes | true |
Specifies whether to enable health checks. Valid values:
Note If the ServerGroupType parameter is set to Instance or Ip, health checks are enabled by default. If the ServerGroupType parameter is set to Fc, health checks are disabled by default.
|
HealthCheckHost | String | No | www.example.com |
The domain name that is used for health checks. The domain name must meet the following requirements:
Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckCodes | Array of String | No | http_2xx |
The HTTP status code for a successful health check. You can specify multiple HTTP status codes. Valid values: http_2xx (default), http_3xx, http_4xx, and http_5xx. Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckHttpVersion | String | No | HTTP1.1 |
The HTTP version. Valid values: HTTP1.0 and HTTP1.1. Default value: HTTP1.1. Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckInterval | Integer | No | 2 |
The interval between two consecutive health checks. Unit: seconds. Valid values: 1 to 50. Default value: 2. |
HealthCheckMethod | String | No | HEAD |
The HTTP method that is used for health checks. Valid values: GET and HEAD. Default value: HEAD. Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckPath | String | No | /test/index.html |
The path that is used for health checks. The path must be 1 to 80 characters in length, and can contain only letters, digits,
and the following special characters: Note This parameter takes effect only when the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckProtocol | String | No | HTTP |
The protocol that is used for health checks. Valid values: HTTP and HTTPS. |
HealthCheckTimeout | Integer | No | 5 |
The timeout period of a health check. If a backend server does not respond within the specified timeout period, the backend server fails the health check. Unit: seconds. Valid values: 1 to 300. Default value: 5. Note If the value of the HealthCheckTimeout parameter is smaller than that of the HealthCheckInterval parameter, the timeout period specified by the HealthCheckTimeout parameter is ignored and the value of the HealthCheckInterval parameter is used as the timeout period.
|
HealthyThreshold | Integer | No | 3 |
The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. In this case, the health status is changed from fail to success. Valid values: 2 to 10. Default value: 3. |
UnhealthyThreshold | Integer | No | 3 |
The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. In this case, the health status is changed from success to fail. Valid values: 2 to 10. Default value: 3. |
StickySessionConfig | Object | No |
The configuration of session persistence. Note This parameter takes effect when the ServerGroupType parameter is set to Instance or Ip.
|
|
Cookie | String | No | B490B5EBF6F3CD402E515D22BCDA**** |
The cookie to be configured on the server. The cookie must be 1 to 200 characters in length, and can contain only ASCII characters and digits. It cannot contain commas (,), semicolons (;), or space characters. It cannot start with a dollar sign ($). Note This parameter takes effect when the StickySessionEnabled parameter is set to true and the StickySessionType parameter is set to Server.
|
CookieTimeout | Integer | No | 1000 |
The timeout period of a cookie. Unit: seconds. Valid values: 1 to 86400. Default value: 1000. Note This parameter takes effect only when the StickySessionEnabled parameter is set to true and the StickySessionType parameter is set to Insert.
|
StickySessionEnabled | Boolean | No | false |
Specifies whether to enable session persistence. Valid values:
Note This parameter takes effect when the ServerGroupType parameter is set to Instance or Ip.
|
StickySessionType | String | No | Insert |
The method that is used to handle a cookie. Valid values:
Note This parameter takes effect when the StickySessionEnabled parameter is set to true.
|
ClientToken | String | No | 5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. Note If you do not set this parameter, the system uses RequestId as ClientToken. RequestId may be different for each API request.
|
DryRun | Boolean | No | false |
Specifies whether to only precheck this request. Valid values:
|
ServiceName | String | No | test |
This parameter is available only if the ALB Ingress controller is used. In this case,
set the parameter to the name of the |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
JobId | String | 72dcd26b-f12d-4c27-b3af-18f6aed5**** |
The ID of the asynchronous task. |
RequestId | String | 365F4154-92F6-4AE4-92F8-7FF34B540710 |
The ID of the request. |
ServerGroupId | String | sg-atstuj3rtoptyui**** |
The ID of the server group. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateServerGroup
&ServerGroupName=sg-atstuj3rtoptyui****
&ServerGroupType=Instance
&VpcId=vpc-bp15zckdt37pq72zv****
&Scheduler=Wrr
&Protocol=HTTP
&ResourceGroupId=rg-atstuj3rtop****
&HealthCheckConfig={"HealthCheckConnectPort":80,"HealthCheckEnabled":true,"HealthCheckHost":"www.example.com","HealthCheckCodes":["http_2xx"],"HealthCheckHttpVersion":"HTTP1.1","HealthCheckInterval":2,"HealthCheckMethod":"HEAD","HealthCheckPath":"/test/index.html","HealthCheckProtocol":"HTTP","HealthCheckTimeout":5,"HealthyThreshold":3,"UnhealthyThreshold":3}
&StickySessionConfig={"Cookie":"B490B5EBF6F3CD402E515D22BCDA****","CookieTimeout":1000,"StickySessionEnabled":false,"StickySessionType":"Insert"}
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&DryRun=false
&ServiceName=test
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateServerGroupResponse>
<JobId>72dcd26b-f12d-4c27-b3af-18f6aed5****</JobId>
<RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
<ServerGroupId>sg-atstuj3rtoptyui****</ServerGroupId>
</CreateServerGroupResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"JobId" : "72dcd26b-f12d-4c27-b3af-18f6aed5****",
"RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710",
"ServerGroupId" : "sg-atstuj3rtoptyui****"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | QuotaExceeded.ServerGroupsNum | The quota of %s is exceeded, usage %s/%s. | The error message returned because the usage %s has exceeded the quota %s. |
For a list of error codes, visit the API Error Center.