All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ALB::BackendServerAttachment

Last Updated:Jul 29, 2024

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 that you want to add to the server group.

You can add up to 40 backend servers to a server group.

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

ServerId

String

Yes

Yes

The resource ID or IP address.

Valid values:

  • Valid value if you set ServerType to Ecs: the ID of the ECS instance

  • Valid value if you set ServerType to Eni: the ID of the ENI

  • Valid value if you set ServerType to Eci: the ID of the elastic container instance

  • Valid value if you set ServerType to Ip: the IP address

ServerType

String

Yes

Yes

The type of the backend server.

Valid values:

  • Ecs: ECS instance

  • eni: elastic network interface (ENI)

  • eci: Elastic Container Instance (ECI)

  • Ip: IP address

Description

String

No

Yes

The description of the backend server.

The description must be 2 to 256 characters in length.

Port

Integer

No

Yes

The port of the backend server.

Valid values: 1 to 65535.

ServerIp

String

No

Yes

The IP address in inclusive ENI mode.

None.

Weight

Integer

No

Yes

The weight of a 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

YAML format

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 format

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