ALIYUN::ALB::BackendServerAttachment is used to add backend servers to a server group.

Syntax

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

Properties

Property Type Required Editable Description Constraint
ServerGroupId String Yes No The ID of the server group. None.
Servers List Yes Yes The backend servers. You can add up to 40 backend servers.

For more information, see Servers properties.

Servers syntax

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

Servers properties

Property Type Required Editable Description Constraint
ServerType String Yes Yes The type of the backend server. Valid values:
  • Ecs: Elastic Compute Service (ECS) instance
  • Eni: elastic network interface (ENI)
  • Eci: elastic container instance
  • Ip: IP address
Description String No Yes The description of the backend server. The description must be 2 to 256 characters in length.
ServerId String Yes Yes The resource ID or IP address. Valid values:
  • Valid value if you set the ServerType property to Ecs: the ID of the ECS instance
  • Valid value if you set the ServerType property to Eni: the ID of the ENI
  • Valid value if you set the ServerType property to Eci: the ID of the elastic container instance
  • Valid value if you set the ServerType property to Ip: the IP address
ServerIp String No Yes The IP address in inclusive ENI mode. None.
Port Integer No Yes The port that is used by the backend server. Valid values: 1 to 65535.
Weight Integer No Yes The weight of the backend server. Valid values: 0 to 100.

Default value: 100.

Note If you set this property to 0, no requests are forwarded to the backend server.

Return values

Fn::GetAtt

ServerGroupId: the ID of the server group.

Examples

  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ServerGroupId": {
          "Type": "String",
          "Description": "The ID of the server group.",
          "Default": "sgp-46ndzg2wz4v5mp1****"
        },
        "Servers": {
          "Type": "Json",
          "Description": "The backend servers that you want to add to the server group. You can specify up to\n40 servers in each call.",
          "Default": [
            {
              "Description": "test",
              "Port": 80,
              "ServerId": "ecs-bp67acfmxazb4p****",
              "ServerIp": "192.168.1.1",
              "ServerType": "Ecs",
              "Weight": 100
            }
          ]
        }
      },
      "Resources": {
        "BackendServerAttachment": {
          "Type": "ALIYUN::ALB::BackendServerAttachment",
          "Properties": {
            "ServerGroupId": {
              "Ref": "ServerGroupId"
            },
            "Servers": {
              "Ref": "Servers"
            }
          }
        }
      },
      "Outputs": {
        "ServerGroupId": {
          "Description": "The ID of the server group.",
          "Value": {
            "Fn::GetAtt": [
              "BackendServerAttachment",
              "ServerGroupId"
            ]
          }
        }
      }
    }
  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ServerGroupId:
        Type: String
        Description: The ID of the server group.
        Default: sgp-46ndzg2wz4v5mp1****
      Servers:
        Type: Json
        Description: |-
          The backend servers that you want to add to the server group. You can specify up to
          40 servers in each call.
        Default:
          - Description: test
            Port: 80
            ServerId: ecs-bp67acfmxazb4p****
            ServerIp: 192.168.1.1
            ServerType: Ecs
            Weight: 100
    Resources:
      BackendServerAttachment:
        Type: ALIYUN::ALB::BackendServerAttachment
        Properties:
          ServerGroupId:
            Ref: ServerGroupId
          Servers:
            Ref: Servers
    Outputs:
      ServerGroupId:
        Description: The ID of the server group.
        Value:
          Fn::GetAtt:
            - BackendServerAttachment
            - ServerGroupId