ALIYUN::ALB::ServerGroup is used to create a server group.
Syntax
{
"Type": "ALIYUN::ALB::ServerGroup",
"Properties": {
"VpcId": String,
"ResourceGroupId": String,
"Scheduler": String,
"StickySessionConfig": Map,
"HealthCheckConfig": Map,
"Protocol": String,
"ServerGroupType": String,
"ServerGroupName": String,
"Tags": List,
"ServiceName": String,
"UpstreamKeepaliveEnabled": Boolean,
"SlowStartConfig": Map,
"ConnectionDrainConfig": Map,
"UchConfig": Map,
"CrossZoneEnabled": Boolean,
"Ipv6Enabled": Boolean
}
}Properties
Property | Type | Required | Editable | Description | Constraint |
HealthCheckConfig | Map | Yes | Yes | The configurations of health checks. | For more information, see HealthCheckConfig properties. |
ServerGroupName | String | Yes | Yes | 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 (-). It must start with a letter. |
VpcId | String | No | No | The ID of the virtual private cloud (VPC). | You can add only servers that are deployed in the VPC to the server group. |
Protocol | String | No | No | The backend protocol. | Valid values:
Note You must set Protocol to HTTP when ServerGroupType is set to Fc. |
ResourceGroupId | String | No | Yes | The ID of the resource group. | None. |
Scheduler | String | No | Yes | The scheduling algorithm. | Valid values:
|
ServerGroupType | String | No | No | The type of the server group. | Valid values:
|
ServiceName | String | No | Yes | The name of the Kubernetes service that corresponds to the server group. | Note This property is applicable only to scenarios in which Application Load Balancer (ALB) Ingresses are used. |
StickySessionConfig | Map | No | Yes | The configurations of session persistence. | For more information, see StickySessionConfig properties. |
Tags | List | No | Yes | The tags. | You can add up to 20 tags. For more information, see Tags properties. |
UpstreamKeepaliveEnabled | Boolean | No | Yes | Specifies whether to enable persistent TCP connections. |
|
SlowStartConfig | Map | No | Yes | The configurations of slow starts. | After slow starts are enabled, ALB prefetches data to newly added backend servers. Requests distributed to the backend servers gradually increase. For more information, see the "SlowStartConfig properties" section of this topic. Note
|
ConnectionDrainConfig | Map | No | Yes | The configurations of connection draining. | After connection draining is enabled, ALB maintains data transmission for a period of time after the backend server is removed or declared unhealthy. Note You can enable connection draining for Standard and WAF-enabled ALB instances but not for Basic ALB instances. Connection draining is supported by server groups of the Instance and Ip types but not by server groups of the Fc type. |
UchConfig | Map | No | Yes | The parameter configurations of consistent hashing based on URLs. | For more information, see the "UchConfig properties" section of this topic. |
CrossZoneEnabled | Boolean | No | Yes | Specifies whether to enable cross-zone load balancing for the server group. | Valid values:
Note
|
Ipv6Enabled | Boolean | No | No | Specifies whether to enable Ipv6. | None. |
UchConfig syntax
"UchConfig": {
"Type": String,
"Value": String
}UchConfig properties
Property | Type | Required | Editable | Description | Constraint |
Type | String | Yes | No | The parameter type. | Set the value to QueryString. |
Value | String | Yes | No | The value of the parameter used for consistent hashing. | None. |
ConnectionDrainConfig syntax
"ConnectionDrainConfig": {
"ConnectionDrainTimeout": Integer,
"ConnectionDrainEnabled": Boolean
}ConnectionDrainConfig properties
Property | Type | Required | Editable | Description | Constraint |
ConnectionDrainTimeout | Integer | Yes | Yes | The timeout period of connection draining. | Valid values: 0 to 900. Default value: 300. |
ConnectionDrainEnabled | Boolean | Yes | Yes | Specifies whether to enable connection draining. | Valid values:
|
SlowStartConfig syntax
"SlowStartConfig": {
"SlowStartDuration": Integer,
"SlowStartEnabled": Boolean
}SlowStartConfig properties
Property | Type | Required | Editable | Description | Constraint |
SlowStartDuration | Integer | Yes | Yes | The duration of a slow start. | Valid values: 30 to 900. Default value: 30. |
SlowStartEnabled | Boolean | Yes | Yes | Specifies whether to enable slow starts. | Valid values:
|
StickySessionConfig syntax
"StickySessionConfig": {
"Cookie": String,
"CookieTimeout": Integer,
"StickySessionType": String,
"StickySessionEnabled": Boolean
}StickySessionConfig properties
Property | Type | Required | Editable | Description | Constraint |
Cookie | String | No | Yes | The cookie that you want to configure for the server. | The cookie must be 1 to 200 characters in length, and cannot start with a dollar sign ($). It can contain letters and digits and cannot contain commas (,), semicolons (;), or spaces. Note This property must be specified when StickySessionEnabled is set to true and StickySessionType is set to Server. |
CookieTimeout | Integer | No | Yes | The timeout period of the cookie. | Valid values: 1 to 86400. Default value: 1000. Unit: seconds. Note This property must be specified when StickySessionEnabled is set to true and StickySessionType is set to Insert. |
StickySessionEnabled | Boolean | No | Yes | Specifies whether to enable session persistence. | Valid values:
Note This property must be specified when ServerGroupType is set to |
StickySessionType | String | No | Yes | The method of handling the cookie. | Valid values:
Note This property must be specified when StickySessionEnabled is set to true. |
HealthCheckConfig syntax
"HealthCheckConfig": {
"HealthCheckInterval": Integer,
"HealthCheckConnectPort": Integer,
"HealthCheckCodes": List,
"UnhealthyThreshold": Integer,
"HealthCheckMethod": String,
"HealthCheckPath": String,
"HealthCheckHost": String,
"HealthyThreshold": Integer,
"HealthCheckProtocol": String,
"HealthCheckHttpVersion": String,
"HealthCheckEnabled": Boolean,
"HealthCheckTimeout": Integer
}HealthCheckConfig properties
Property | Type | Required | Editable | Description | Constraint |
HealthCheckEnabled | Boolean | Yes | Yes | Specifies whether to enable health checks. | Valid values:
|
HealthCheckCodes | List | No | Yes | The status codes for health checks. | Valid values:
Note HealthCheckCodes takes effect when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. |
HealthCheckConnectPort | Integer | No | Yes | The port that you want to use for health checks on backend servers. | Valid values: 0 to 65535. Default value: 0. A value of 0 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. | The domain name must be 1 to 80 characters in length, and can contain lowercase letters, digits, hyphens (-), and periods (.). Example: Note This property takes effect when HealthCheckProtocol is set to HTTP. |
HealthCheckHttpVersion | String | No | Yes | The HTTP version that you want to use for health checks. | Valid values:
Note This property takes effect when HealthCheckProtocol is set to HTTP. |
HealthCheckInterval | Integer | No | Yes | The interval between two consecutive health checks. | Valid values: 1 to 50. Default value: 2. Unit: seconds. |
HealthCheckMethod | String | No | Yes | The health check method. | Valid values:
Note HealthCheckMethod takes effect only when HealthCheckProtocol is set to HTTP, HTTPS, or gRPC. |
HealthCheckPath | String | No | Yes | The path that you want to use for health checks. | The path must be 1 to 80 characters in length, and must start with a forward slash (/). It can contain letters, digits, and the following special characters: Note This property takes effect when HealthCheckProtocol is set to HTTP. |
HealthCheckProtocol | String | No | Yes | The protocol that you want to use for health checks. | Valid values:
|
HealthCheckTimeout | Integer | No | Yes | The timeout period for a health check response. | If a backend Elastic Compute Service (ECS) instance does not return a health check response within the specified timeout period, the instance 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 value of HealthCheckTimeout is ignored, 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. | 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. | Valid values: 2 to 10. Default value: 3. |
Tags syntax
"Tags": [
{
"Key": String,
"Value": String
}
] Tags properties
Property | Type | Required | Editable | Description | Constraint |
Key | String | Yes | No | The key of the tag. | The key must be 1 to 128 characters in length, and cannot contain http:// or https://. It cannot start with |
Value | String | No | No | The value of the tag. | The value can be up to 128 characters in length, and cannot contain http:// or https://. It cannot start with |
Return values
Fn::GetAtt
ServerGroupId: the ID of the server group.
Arn: the Alibaba Cloud Resource Name (ARN).
Examples
Change the values of masked parameters based on your business requirements.
YAML format
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
Label:
en: Existing VPC Instance ID
Resources:
ServerGroup:
Type: ALIYUN::ALB::ServerGroup
Properties:
VpcId:
Ref: VpcId
StickySessionConfig:
Cookie: B490B5EBF6F3CD402E515D22****
CookieTimeout: 1000
StickySessionEnabled: true
StickySessionType: Insert
HealthCheckConfig:
HealthCheckConnectPort: 80
HealthCheckEnabled: true
HealthCheckHost: www.example.com
HealthCheckCodes:
- http_2xx
HealthCheckHttpVersion: HTTP1.0
HealthCheckInterval: 5
HealthCheckMethod: HEAD
HealthCheckPath: /test/index.html
HealthCheckProtocol: HTTP
HealthCheckTimeout: 3
HealthyThreshold: 4
UnhealthyThreshold: 4
ServerGroupName: TestServerGroup
Outputs:
ServerGroupId:
Description: The ID of the server group.
Value:
Fn::GetAtt:
- ServerGroup
- ServerGroupId JSON format
{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"VpcId": {
"AssociationProperty": "ALIYUN::ECS::VPC::VPCId",
"Type": "String",
"Label": {
"en": "Existing VPC Instance ID"
}
}
},
"Resources": {
"ServerGroup": {
"Type": "ALIYUN::ALB::ServerGroup",
"Properties": {
"VpcId": {
"Ref": "VpcId"
},
"StickySessionConfig": {
"Cookie": "B490B5EBF6F3CD402E515D22****",
"CookieTimeout": 1000,
"StickySessionEnabled": true,
"StickySessionType": "Insert"
},
"HealthCheckConfig": {
"HealthCheckConnectPort": 80,
"HealthCheckEnabled": true,
"HealthCheckHost": "www.example.com",
"HealthCheckCodes": [
"http_2xx"
],
"HealthCheckHttpVersion": "HTTP1.0",
"HealthCheckInterval": 5,
"HealthCheckMethod": "HEAD",
"HealthCheckPath": "/test/index.html",
"HealthCheckProtocol": "HTTP",
"HealthCheckTimeout": 3,
"HealthyThreshold": 4,
"UnhealthyThreshold": 4
},
"ServerGroupName": "TestServerGroup"
}
}
},
"Outputs": {
"ServerGroupId": {
"Description": "The ID of the server group.",
"Value": {
"Fn::GetAtt": [
"ServerGroup",
"ServerGroupId"
]
}
}
}
}