ALIYUN::ALB::BackendServerAttachment类型用于向服务器组中添加后端服务器。

语法

{
  "Type": "ALIYUN::ALB::BackendServerAttachment",
  "Properties": {
    "ServerGroupId": String,
    "Servers": List
  }
}

属性

属性名称类型必须允许更新描述约束
ServerGroupIdString服务器组ID。
ServersList后端服务器列表。最多支持指定40个服务器。

更多信息,请参见Servers属性

Servers语法

"Servers": [
  {
    "ServerType": String,
    "Description": String,
    "ServerId": String,
    "ServerIp": String,
    "Port": Integer,
    "Weight": Integer
  }
]

Servers属性

属性名称类型必须允许更新描述约束
ServerTypeString后端服务器类型。取值:
  • Ecs:ECS实例。
  • Eni:弹性网卡。
  • Eci:弹性容器实例。
  • Ip:IP地址。
DescriptionString后端服务器描述。长度为2~256个字符。
ServerIdString资源ID或IP地址。取值:
  • 当ServerType取值为Ecs时:ECS实例ID。
  • 当ServerType取值为Eni时:弹性网卡ID。
  • 当ServerType取值为Eci时:弹性容器实例ID。
  • 当ServerType取值为Ip时:IP地址。
ServerIpStringENI多IP模式时指定的IP地址。
PortInteger后端服务器使用的端口。取值范围:1~65,535。
WeightInteger后端服务器的权重。取值范围:0~100。

默认值:100。

说明 取值为0时,不会将请求转发给后端服务器。

返回值

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"
            ]
          }
        }
      }
    }