Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::NLB::BackendServerAttachment

Última atualização: Jun 27, 2026

Adiciona servidores de backend a um grupo de servidores do Network Load Balancer (NLB).

Sintaxe

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

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ServerGroupId

String

Sim

Não

ID do grupo de servidores.

Nenhuma.

Servers

List

Sim

Sim

Servidores de backend.

Para mais informações, consulte Propriedades de Servers. É possível adicionar até 200 servidores de backend.

Sintaxe de Servers

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

Propriedades de Servers

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ServerType

String

Sim

Sim

Tipo do servidor de backend.

Valores válidos:

  • Ecs: instância do Elastic Compute Service (ECS).

  • Eni: interface de rede elástica (ENI).

  • Eci: instância de contêiner elástico.

  • Ip: endereço IP.

ServerId

String

Sim

Sim

ID do servidor de backend.

  • Se ServerType for Ecs, Eni ou Eci, defina ServerId como o ID da instância ECS, da ENI ou da instância de contêiner elástico.

  • Se ServerType for Ip, defina ServerId como um endereço IP.

Description

String

Não

Sim

Descrição do servidor.

Deve ter de 2 a 256 caracteres. Caracteres permitidos: letras, dígitos, vírgulas (,), pontos (.), ponto e vírgula (;), barras (/), arrobas (@), sublinhados (_) e hifens (-).

Port

Integer

Não

Sim

Porta usada pelo servidor de backend.

Valores válidos: 0 a 65535. Valor padrão: 0.

Com o encaminhamento de todas as portas ativado, não é necessário especificar uma porta. O NLB encaminha solicitações com base na porta de frontend. Chame a operação ListServerGroups e verifique AnyPortEnabled para confirmar se o encaminhamento de todas as portas está ativado.

ServerIp

String

Não

Sim

Endereço IP do servidor.

Obrigatório quando ServerType for Ip.

Weight

Integer

Não

Sim

Peso do servidor de backend.

Valores válidos: 0 a 100. Valor padrão: 100. O valor 0 interrompe todo o encaminhamento de solicitações para este servidor.

Valores de retorno

Fn::GetAtt

ServerGroupId: ID do grupo de servidores.

Exemplos

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