Creates a health check template.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateHealthCheckTemplate |
The operation that you want to perform. Set the value to CreateHealthCheckTemplate. |
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 it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. Note If you do not specify this parameter, the system automatically uses the request ID
as the client token. The ID of each request is unique.
|
HealthCheckTemplateName | String | Yes | HealthCheckTemplate1 |
The name of the health check template. 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. |
HealthCheckConnectPort | Integer | No | 80 |
The port that is used for health checks. Valid values: 0 to 65535. Default value: 0. This value indicates that the port on a backend server is used for health checks. |
HealthCheckHost | String | No | $_ip |
The domain name that is used for health checks. Default value: $SERVER_IP. The domain name must be 1 to 80 characters in length. Make sure that the domain name meets the following requirements:
This parameter is required only if the |
HealthCheckCodes | Array of String | No | http_2xx,http_3xx |
The HTTP status code that indicates a successful health check. Default value: http_2xx. Separate multiple HTTP status codes with commas (,). Valid values: http_2xx, http_3xx, http_4xx, and http_5xx. Note This parameter is required only if the HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckInterval | Integer | No | 2 |
The time interval between two consecutive health checks. Unit: seconds. Valid values: 1 to 50. Default value: 2. |
HealthCheckTimeout | Integer | No | 5 |
The timeout period of a health check. Unit: seconds. If a backend server does not respond within the specified timeout period, the backend server fails the health check. 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 period of time specified by the HealthCheckInterval parameter is used as the timeout period.
|
HealthCheckPath | String | No | /test/index.html |
The URL that is used for health checks. The URL must be 1 to 80 characters in length, and can contain letters, digits, and the following special characters: - / . % ? # &. The URL can also contain the following extended characters:
The URL must start with a forward slash (/). Note This parameter is required only if the
HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckMethod | String | No | HEAD |
The HTTP method that is used for health checks. Valid values: GET and HEAD. Default value: HEAD. Note This parameter is required only if the
HealthCheckProtocol parameter is set to HTTP.
|
HealthCheckProtocol | String | No | HTTP |
The protocol that is used for health checks. Valid values: HTTP and TCP. Default value: HTTP. |
HealthCheckHttpVersion | String | No | HTTP 1.0 |
The version of the HTTP protocol. Valid values: HTTP 1.0 and HTTP 1.1. Default value: HTTP 1.1. Note This parameter is required only if the
HealthCheckProtocol parameter is set to HTTP.
|
HealthyThreshold | Integer | No | 4 |
The number of health checks that an unhealthy backend server must consecutively pass 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 | 4 |
The number of health checks that a healthy backend server must consecutively fail 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. |
DryRun | Boolean | No | true |
Specifies whether only to precheck the request. Valid values: true: only prechecks the request and does not perform the requested operation. The system
checks the required parameters, request format, and service limits. If the request
fails the precheck, an error code is returned based on the cause of the failure. If
the request passes the precheck, the false: prechecks the request and performs the requested operation. After the request passes the precheck, an HTTP 2xx status code is returned and the system performs the operation. This is the default value. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
HealthCheckTemplateId | String | hct-1224334 |
The ID of the health check template. |
RequestId | String | 365F4154-92F6-4AE4-92F8-7FF34B540710 |
The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateHealthCheckTemplate
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&HealthCheckTemplateName=HealthCheckTemplate1
&HealthCheckConnectPort=80
&HealthCheckHost=$_ip
&HealthCheckCodes=["http_2xx,http_3xx"]
&HealthCheckInterval=2
&HealthCheckTimeout=5
&HealthCheckPath=/test/index.html
&HealthCheckMethod=HEAD
&HealthCheckProtocol=HTTP
&HealthCheckHttpVersion=HTTP 1.0
&HealthyThreshold=4
&UnhealthyThreshold=4
&DryRun=true
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateHealthCheckTemplateResponse>
<HealthCheckTemplateId>hct-1224334</HealthCheckTemplateId>
<RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
</CreateHealthCheckTemplateResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"HealthCheckTemplateId" : "hct-1224334",
"RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | QuotaExceeded.HealthCheckTemplatesNum | 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.