ALIYUN::NLB::ServerGroup类型用于为网络型负载均衡创建服务器组。
语法
{
  "Type": "ALIYUN::NLB::ServerGroup",
  "Properties": {
    "ResourceGroupId": String,
    "Scheduler": String,
    "AddressIPVersion": String,
    "Servers": List,
    "PreserveClientIpEnabled": Boolean,
    "ServerGroupType": String,
    "PersistenceEnabled": Boolean,
    "ConnectionDrainEnabled": Boolean,
    "ConnectionDrainTimeout": Integer,
    "PersistenceTimeout": Integer,
    "VpcId": String,
    "HealthCheckConfig": Map,
    "Protocol": String,
    "ServerGroupName": String,
    "Tags": List,
    "AnyPortEnabled": Boolean
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| ResourceGroupId | String | 否 | 否 | 资源组ID。 | 无 | 
| Scheduler | String | 否 | 否 | 调度算法。 | 取值: 
 | 
| AddressIPVersion | String | 否 | 否 | 协议版本。 | 取值: 
 | 
| Servers | List | 否 | 否 | 服务器列表。 | 更多信息,请参见Servers属性。 | 
| PreserveClientIpEnabled | Boolean | 否 | 否 | 是否开启客户端地址保持功能。 | 取值: 
 | 
| ServerGroupType | String | 否 | 否 | 服务器组类型。 | 取值: 
 | 
| PersistenceEnabled | Boolean | 否 | 否 | 是否开启会话保持。 | 取值: 
 | 
| ConnectionDrainEnabled | Boolean | 否 | 否 | 是否开启连接优雅中断。 | 取值: 
 | 
| ConnectionDrainTimeout | Integer | 否 | 否 | 设置连接优雅中断超时时间。 | 单位:秒。 取值范围:10~900。 | 
| PersistenceTimeout | Integer | 否 | 否 | 会话保持超时时间。 | 单位:秒。 取值范围:0~3600。 | 
| VpcId | String | 是 | 否 | 服务器组所在VPC的ID。 | 说明  当ServerGroupType参数取值为Instance时,只有Instance类型服务器组所在VPC下的服务器,才可以加入到该服务器组中。 | 
| HealthCheckConfig | Map | 否 | 否 | 健康检查相关配置。 | 更多信息,请参见HealthCheckConfig属性。 | 
| Protocol | String | 否 | 否 | 后端转发协议。 | 取值: 
 | 
| ServerGroupName | String | 是 | 否 | 服务器组名称。 | 长度为2~128个字符,必须以大小写字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。 | 
| AnyPortEnabled | Boolean | 否 | 否 | 是否开启全端口转发。 | 取值: 
 | 
| Tags | List | 否 | 是 | 标签列表 | 更多信息,请参见Tags属性。 | 
Servers语法
"Servers": [
  {
    "ServerType": String,
    "Description": String,
    "ServerId": String,
    "ServerIp": String,
    "Port": Integer,
    "Weight": Integer
  }
]Servers属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| ServerType | String | 是 | 否 | 后端服务器类型。 | 取值: 
 | 
| Description | String | 否 | 否 | 后端服务器描述。 | 无 | 
| ServerId | String | 是 | 否 | 后端服务器的实例ID。 | 取值: 
 说明  当ServerId参数值为ENI实例ID或ECI实例ID时,ServerType参数必选。 | 
| ServerIp | String | 否 | 否 | ECS、ENI或者ECI的实例IP。 | 无 | 
| Port | Integer | 否 | 否 | 接收请求的端口。 | 无 | 
| Weight | Integer | 否 | 否 | 后端服务器的权重。 | 取值:0~100。 默认值:100。 | 
HealthCheckConfig语法
"HealthCheckConfig": {
  "HealthCheckInterval": Integer,
  "HealthCheckUrl": String,
  "HealthCheckConnectPort": Integer,
  "UnhealthyThreshold": Integer,
  "HttpCheckMethod": String,
  "HealthyThreshold": Integer,
  "HealthCheckConnectTimeout": Integer,
  "HealthCheckDomain": String,
  "HealthCheckEnabled": Boolean,
  "HealthCheckHttpCode": List,
  "HealthCheckType": String
}HealthCheckConfig属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| HealthCheckInterval | Integer | 否 | 否 | 健康检查的时间间隔。 | 单位:秒。 取值范围:5~50。 默认值:10。 | 
| HealthCheckUrl | String | 否 | 否 | 健康检查路径。 | 长度为1~80个字符,只能使用字母、数字、字符(-/.%?#&=)以及扩展字符(_;~!()*[]@$^:',+),且必须以正斜线(/)开头。 说明  当HealthCheckType参数值为HTTP时,该参数生效。 | 
| HealthCheckConnectPort | Integer | 否 | 否 | 健康检查的后端服务器的端口。 | 取值范围: 0~65535。 默认值:0,表示使用后端服务器的端口进行健康检查。 | 
| UnhealthyThreshold | Integer | 否 | 否 | 健康检查连续失败多少次后,将后端服务器的健康检查状态由成功判定为失败。 | 取值范围:2~10。 默认值:2。 | 
| HttpCheckMethod | String | 否 | 否 | 健康检查方法。 | 取值: 
 说明  当HealthCheckType参数值为HTTP时,该参数生效。 | 
| HealthyThreshold | Integer | 否 | 否 | 健康检查连续成功多少次后,将后端服务器的健康检查状态由失败判定为成功。 | 取值范围:2~10。 默认值:2。 | 
| HealthCheckConnectTimeout | Integer | 否 | 否 | 健康检查响应的最大超时时间。 | 单位:秒。 取值范围:1~300。 默认值:5。 | 
| HealthCheckDomain | String | 否 | 否 | 用于健康检查的域名。 | 取值: 
 说明  当HealthCheckType参数值为HTTP时,该参数生效。 | 
| HealthCheckEnabled | Boolean | 否 | 否 | 是否开启健康检查。 | 取值: 
 | 
| HealthCheckHttpCode | List | 否 | 否 | 健康状态返回码。 | 多个状态码用半角逗号(,)分隔。 取值: 
 说明  当HealthCheckType参数值为HTTP时,该参数生效。 | 
| HealthCheckType | String | 否 | 否 | 健康检查协议。 | 取值: 
 | 
Tags语法
"Tags": [
  {
    "Key": String,
    "Value": String
  }
]Tags属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Key | String | 是 | 否 | 标签键。 | 无 | 
| Value | String | 否 | 否 | 标签值。 | 无 | 
返回值
Fn::GetAtt
ServerGroupId:服务器组ID。
示例
创建绑定了服务IP的服务器组。
ROSTemplateFormatVersion: '2015-09-01'
Description: ''
Parameters:
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
Resources:
  NlbServerGroup:
    Type: ALIYUN::NLB::ServerGroup
    Properties:
      Servers:
        - ServerId: 10.1.1.102
          ServerIp: 10.1.1.102
          Port: 80
          Weight: 100
          ServerType: Ip
      ServerGroupType: Ip
      ServerGroupName: Test
      VpcId:
        Ref: VpcId
      HealthCheckConfig:
        HttpCheckMethod: Get
        HealthCheckEnabled: true
        HealthCheckConnectTimeout: Null
      Protocol: TCP
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    }
  },
  "Resources": {
    "NlbServerGroup": {
      "Type": "ALIYUN::NLB::ServerGroup",
      "Properties": {
        "Servers": [
          {
            "ServerId": "10.1.1.102",
            "ServerIp": "10.1.1.102",
            "Port": 80,
            "Weight": 100,
            "ServerType": "Ip"
          }
        ],
        "ServerGroupType": "Ip",
        "ServerGroupName": "Test",
        "VpcId": {
          "Ref": "VpcId"
        },
        "HealthCheckConfig": {
          "HttpCheckMethod": "Get",
          "HealthCheckEnabled": true,
          "HealthCheckConnectTimeout": null
        },
        "Protocol": "TCP"
      }
    }
  },
  "Outputs": {
  }
}