ALIYUN::ALB::BackendServerAttachment类型用于向服务器组中添加后端服务器。
语法
{
  "Type": "ALIYUN::ALB::BackendServerAttachment",
  "Properties": {
    "ServerGroupId": String,
    "Servers": List
  }
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| ServerGroupId | String | 是 | 否 | 服务器组ID。 | 无 | 
| Servers | List | 是 | 是 | 后端服务器列表。 | 最多支持指定40个服务器。 更多信息,请参见Servers属性。 | 
Servers语法
"Servers": [
  {
    "ServerType": String,
    "Description": String,
    "ServerId": String,
    "ServerIp": String,
    "Port": Integer,
    "Weight": Integer,
    "RemoteIpEnabled": Boolean
  }
]Servers属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 | 
| Description | String | 否 | 是 | 后端服务器描述。 | 长度为2~256个字符。 | 
| Port | Integer | 否 | 是 | 后端服务器使用的端口。 | 取值范围:1~65,535。 说明  当ServerType取值为Ecs、Eni、Eci、Ip时,该参数必传。当ServerType取值为Fc时,无需配置该参数。 | 
| RemoteIpEnabled | Boolean | 否 | 是 | 是否开启远端 IP 功能。 | 单次调用最多支持添加 200 个服务器。取值: 
 说明  当ServerType取值为Ip时,该参数有效。 | 
| ServerId | String | 是 | 是 | 资源ID或IP地址。 | 取值: 
 | 
| ServerIp | String | 否 | 是 | ENI多IP模式时指定的IP地址。 | 说明  ServerType取值为Fc时,无需配置该参数。 | 
| ServerType | String | 是 | 是 | 后端服务器类型。 | 取值: 
 | 
| Weight | Integer | 否 | 是 | 后端服务器的权重。 | 取值范围:0~100。 默认值:100。 说明  取值为0时,不会将请求转发给后端服务器。 ServerType取值为Fc时,无需配置该参数 | 
返回值
Fn::GetAtt
ServerGroupId:服务器组ID。
示例
YAML格式
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ServerGroupId:
    Type: String
    Description: The ID of the server group.
    Default: sgp-46ndzg2wz4v5mp1****
Resources:
  BackendServerAttachment:
    Type: ALIYUN::ALB::BackendServerAttachment
    Properties:
      ServerGroupId:
        Ref: ServerGroupId
      Servers:
        - Description: test
          Port: 80
          ServerId: ecs-bp67acfmxazb4p****
          ServerIp: 192.168.1.1
          ServerType: Ecs
          Weight: 100
Outputs:
  ServerGroupId:
    Description: The ID of the server group.
    Value:
      Fn::GetAtt:
        - BackendServerAttachment
        - ServerGroupId                JSON格式
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ServerGroupId": {
      "Type": "String",
      "Description": "The ID of the server group.",
      "Default": "sgp-46ndzg2wz4v5mp1****"
    }
  },
  "Resources": {
    "BackendServerAttachment": {
      "Type": "ALIYUN::ALB::BackendServerAttachment",
      "Properties": {
        "ServerGroupId": {
          "Ref": "ServerGroupId"
        },
        "Servers": [
          {
            "Description": "test",
            "Port": 80,
            "ServerId": "ecs-bp67acfmxazb4p****",
            "ServerIp": "192.168.1.1",
            "ServerType": "Ecs",
            "Weight": 100
          }
        ]
      }
    }
  },
  "Outputs": {
    "ServerGroupId": {
      "Description": "The ID of the server group.",
      "Value": {
        "Fn::GetAtt": [
          "BackendServerAttachment",
          "ServerGroupId"
        ]
      }
    }
  }
}