All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ALB::HealthCheckTemplate

Last Updated:Jul 29, 2024

ALIYUN::ALB::HealthCheckTemplate is used to create a health check template.

Syntax

{
  "Type": "ALIYUN::ALB::HealthCheckTemplate",
  "Properties": {
    "HealthCheckInterval": Integer,
    "HealthCheckConnectPort": Integer,
    "HealthCheckCodes": List,
    "UnhealthyThreshold": Integer,
    "HealthCheckMethod": String,
    "HealthCheckPath": String,
    "HealthCheckTemplateName": String,
    "HealthCheckHost": String,
    "HealthyThreshold": Integer,
    "HealthCheckProtocol": String,
    "HealthCheckTimeout": Integer
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

HealthCheckTemplateName

String

Yes

Yes

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.

HealthCheckCodes

List

No

Yes

The HTTP status codes for a successful health check.

Valid values:

  • Valid values if you set HealthCheckProtocol to HTTP: http_2xx, http_3xx, http_4xx, and http_5xx. Default value: http_2xx. Separate multiple HTTP status codes with commas (,).

  • Valid values if you set HealthCheckProtocol to gRPC: 0 to 99. Default value: 0. Value ranges are supported. You can specify up to 20 value ranges. Separate multiple value ranges with commas (,).

Note

This property takes effect only if you set HealthCheckProtocol to HTTP or gRPC.

HealthCheckConnectPort

Integer

No

Yes

The port that you want to use for health checks.

Valid values: 0 to 65535. Default value: 0. This value specifies that the port of a backend server is used for health checks.

HealthCheckHost

String

No

Yes

The domain name that you want to use for health checks.

Default value: $SERVER_IP.

The domain name must be 1 to 80 characters in length. The domain name must meet the following requirements:

  • The domain name can contain lowercase letters, digits, hyphens (-), and periods (.).

  • The domain name can contain at least one period (.) but cannot start or end with a period (.).

  • The rightmost domain label can contain only letters, and cannot contain digits or hyphens (-).

  • Other domain labels cannot start or end with a hyphen (-).

Note

This property takes effect only if you set HealthCheckProtocol to HTTP.

HealthCheckInterval

Integer

No

Yes

The interval at which the system performs health checks.

Valid values: 1 to 50.

Default value: 2.

Unit: seconds.

HealthCheckMethod

String

No

Yes

The method that you want to use for health checks.

Valid values:

  • HEAD: By default, HTTP health checks use the HEAD method.

  • POST: By default, gRPC health checks use the POST method.

  • GET: If the length of a response packet exceeds 8 KB, the response is truncated. This does not affect the health check result.

Note

This property takes effect only if you set HealthCheckProtocol to HTTP or gRPC.

HealthCheckPath

String

No

Yes

The URL that you want to use for health checks.

The URL must be 1 to 80 characters in length and can contain letters, digits, the - / . % ? # & special characters, and the _ ; ~ ! ( ) * [ ] @ $ ^ : ' , + extended characters. The URL must start with a forward slash (/).

Note

This property takes effect only if you set HealthCheckProtocol to HTTP.

HealthCheckProtocol

String

No

Yes

The protocol that you want to use for health checks.

Valid values:

  • HTTP: The system sends HEAD or GET requests to a backend server to simulate access from a browser and check whether the backend server is healthy.

  • TCP: The system sends SYN packets to a backend server to check whether the port of the backend server is available to receive requests.

  • gRPC: The system sends POST or GET requests to a backend server to check whether the backend server is healthy.

HealthCheckTimeout

Integer

No

Yes

The timeout period of a health check response.

If a backend server does not return a health check response within the specified timeout period, the server fails the health check.

Valid values: 1 to 300.

Default value: 5.

Unit: seconds.

Note

If the value of HealthCheckTimeout is smaller than the value of HealthCheckInterval, the timeout period specified by HealthCheckTimeout becomes invalid, and the value of HealthCheckInterval is used as the timeout period.

HealthyThreshold

Integer

No

Yes

The number of times that an unhealthy backend server must consecutively pass health checks before it is declared healthy. When this number is reached, the health check status is changed from failed to successful.

Valid values: 2 to 10.

Default value: 3.

UnhealthyThreshold

Integer

No

Yes

The number of times that a healthy backend server must consecutively fail health checks before it is declared unhealthy. When this number is reached, the health check status is changed from successful to failed.

Valid values: 2 to 10.

Default value: 3.

Return values

Fn::GetAtt

HealthCheckTemplateId: the ID of the health check template.

Examples

YAML format

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  HealthCheckTemplateName:
    Type: String
    Description: |-
      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.
Resources:
  HealthCheckTemplate:
    Type: ALIYUN::ALB::HealthCheckTemplate
    Properties:
      HealthCheckTemplateName:
        Ref: HealthCheckTemplateName
Outputs:
  HealthCheckTemplateId:
    Description: The ID of the health check template.
    Value:
      Fn::GetAtt:
        - HealthCheckTemplate
        - HealthCheckTemplateId

JSON format

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "HealthCheckTemplateName": {
      "Type": "String",
      "Description": "The name of the health check template.\nThe name must be 2 to 128 characters in length, and can contain letters, digits, periods\n(.), underscores (_), and hyphens (-). The name must start with a letter."
    }
  },
  "Resources": {
    "HealthCheckTemplate": {
      "Type": "ALIYUN::ALB::HealthCheckTemplate",
      "Properties": {
        "HealthCheckTemplateName": {
          "Ref": "HealthCheckTemplateName"
        }
      }
    }
  },
  "Outputs": {
    "HealthCheckTemplateId": {
      "Description": "The ID of the health check template.",
      "Value": {
        "Fn::GetAtt": [
          "HealthCheckTemplate",
          "HealthCheckTemplateId"
        ]
      }
    }
  }
}