ALIYUN::NLB::BackendServerAttachment

Updated at: 2025-03-25 08:54

ALIYUN::NLB::BackendServerAttachment is used to add backend servers to a Network Load Balancer (NLB) server group.

Syntax

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

Properties

Property

Type

Required

Editable

Description

Constraint

Property

Type

Required

Editable

Description

Constraint

ServerGroupId

String

Yes

No

The ID of the server group.

None.

Servers

List

Yes

Yes

The backend servers.

For more information, see Servers properties. You can add up to 200 backend servers.

Servers syntax

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

Servers properties

Property

Type

Required

Editable

Description

Constraint

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.

ServerId

String

Yes

Yes

The ID of the backend server.

  • If ServerType is set to Ecs, Eni, or Eci, the value of ServerId is the ID of the ECS instance, ENI, or elastic container instance.

  • If ServerType is set to Ip, the value of ServerId is an IP address.

Description

String

No

Yes

The description of the server.

The description must be 2 to 256 characters in length, and can contain letters, digits, commas (,), periods (.), semicolons (;), forward slashes (/), at signs (@), underscores (_), and hyphens (-).

Port

Integer

No

Yes

The port used by the backend server.

Valid values: 0 to 65535. If you leave this property empty, port 0 is used by default.

If you enable all-port forwarding for the server group, you do not need to specify a port when you add a backend server. By default, port 0 is used for the backend server. NLB forwards requests to the backend server based on the frontend port. You can call the ListServerGroups operation and query the AnyPortEnabled value to check whether all-port forwarding is enabled.

ServerIp

String

No

Yes

The IP address of the server.

This property must be specified when ServerType is set to Ip.

Weight

Integer

No

Yes

The weight of the backend server.

Valid values: 0 to 100. Default value: 100. If you specify 0 as the value of this property, no requests are forwarded to the backend server.

Return values

Fn::GetAtt

ServerGroupId: the ID of the server group.

Examples

YAML
JSON
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  ServerGroupId:
    Type: String
    Description:
      en: The ID of the server group.
    Required: true
  Servers:
    AssociationPropertyMetadata:
      Parameters:
        ServerType:
          Type: String
          Description:
            en: |-
              The type of the backend server. Valid values:
              Ecs: an ECS instance
              Eni: an ENI
              Eci: an elastic container instance
              Ip: an IP address
          AllowedValues:
            - Eci
            - Ecs
            - Eni
            - Ip
          Required: true
        Description:
          AssociationProperty: TextArea
          Type: String
          Description:
            en: ' The description of the servers. The description must be 2 to 256 characters in length, and can contain letters, digits, commas (,), periods (.), semicolons (;), forward slashes (/), at signs (@), underscores (_), and hyphens (-).'
          Required: false
          MinLength: 2
          MaxLength: 256
        ServerId:
          Type: String
          Description:
            en: The ID of the server.
          Required: true
        ServerIp:
          Type: String
          Description:
            en: The IP address of the server. If the server group type is Ip, set the ServerId parameter to an IP address.
          Required: false
        Port:
          Type: Number
          Description:
            en: 'The port used by the backend server. Valid values: 0 to 65535.'
          Required: false
          MinValue: 0
          MaxValue: 65535
        Weight:
          Type: Number
          Description:
            en: 'The weight of the backend server. Valid values: 0 to 100. Default value: 100. If the weight of a backend server is set to 0, no requests are forwarded to the backend server.'
          Required: false
          MinValue: 0
          MaxValue: 100
    AssociationProperty: List[Parameters]
    Type: Json
    Description:
      en: |-
        The backend servers that you want to add to the server group. You can specify up to
        200 servers in each call.
    Required: true
    MinLength: 1
    MaxLength: 200
Resources:
  BackendServerAttachment:
    Type: ALIYUN::NLB::BackendServerAttachment
    Properties:
      ServerGroupId:
        Ref: ServerGroupId
      Servers:
        Ref: Servers
Outputs:
  ServerGroupId:
    Description: The ID of the server group.
    Value:
      Fn::GetAtt:
        - BackendServerAttachment
        - ServerGroupId
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "ServerGroupId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the server group."
      },
      "Required": true
    },
    "Servers": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "ServerType": {
            "Type": "String",
            "Description": {
              "en": "The type of the backend server. Valid values:\nEcs: an ECS instance\nEni: an ENI\nEci: an elastic container instance\nIp: an IP address"
            },
            "AllowedValues": [
              "Eci",
              "Ecs",
              "Eni",
              "Ip"
            ],
            "Required": true
          },
          "Description": {
            "AssociationProperty": "TextArea",
            "Type": "String",
            "Description": {
              "en": " The description of the servers. The description must be 2 to 256 characters in length, and can contain letters, digits, commas (,), periods (.), semicolons (;), forward slashes (/), at signs (@), underscores (_), and hyphens (-)."
            },
            "Required": false,
            "MinLength": 2,
            "MaxLength": 256
          },
          "ServerId": {
            "Type": "String",
            "Description": {
              "en": "The ID of the server."
            },
            "Required": true
          },
          "ServerIp": {
            "Type": "String",
            "Description": {
              "en": "The IP address of the server. If the server group type is Ip, set the ServerId parameter to an IP address."
            },
            "Required": false
          },
          "Port": {
            "Type": "Number",
            "Description": {
              "en": "The port used by the backend server. Valid values: 0 to 65535."
            },
            "Required": false,
            "MinValue": 0,
            "MaxValue": 65535
          },
          "Weight": {
            "Type": "Number",
            "Description": {
              "en": "The weight of the backend server. Valid values: 0 to 100. Default value: 100. If the weight of a backend server is set to 0, no requests are forwarded to the backend server."
            },
            "Required": false,
            "MinValue": 0,
            "MaxValue": 100
          }
        }
      },
      "AssociationProperty": "List[Parameters]",
      "Type": "Json",
      "Description": {
        "en": "The backend servers that you want to add to the server group. You can specify up to\n200 servers in each call."
      },
      "Required": true,
      "MinLength": 1,
      "MaxLength": 200
    }
  },
  "Resources": {
    "BackendServerAttachment": {
      "Type": "ALIYUN::NLB::BackendServerAttachment",
      "Properties": {
        "ServerGroupId": {
          "Ref": "ServerGroupId"
        },
        "Servers": {
          "Ref": "Servers"
        }
      }
    }
  },
  "Outputs": {
    "ServerGroupId": {
      "Description": "The ID of the server group.",
      "Value": {
        "Fn::GetAtt": [
          "BackendServerAttachment",
          "ServerGroupId"
        ]
      }
    }
  }
}
                        
  • On this page (1)
  • Syntax
  • Properties
  • Servers syntax
  • Servers properties
  • Return values
  • Examples
Feedback