Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::ESS::ServerGroupAttachment

Última atualização: Jun 27, 2026

O recurso ALIYUN::ESS::ServerGroupAttachment adiciona um ou mais grupos de servidores do Server Load Balancer (SLB) a um grupo de dimensionamento. Os grupos compatíveis incluem os do Application Load Balancer (ALB) e do Network Load Balancer (NLB).

Sintaxe

{
  "Type": "ALIYUN::ESS::ServerGroupAttachment",
  "Properties": {
    "ServerGroups": List,
    "ScalingGroupId": String,
    "ForceAttach": Boolean
  }
}

Propriedades

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrição

ServerGroups

List

Sim

Não

Grupos de servidores.

Limite de 100 grupos de servidores por grupo de dimensionamento. Para mais informações, consulte Propriedades de ServerGroups.

ScalingGroupId

String

Sim

Não

ID do grupo de dimensionamento.

Nenhuma.

ForceAttach

Boolean

Não

Não

Defina se todas as instâncias do Elastic Compute Service (ECS) do grupo de dimensionamento atual serão adicionadas ao novo grupo de servidores.

Valores válidos:

  • true

  • false (padrão)

Sintaxe de ServerGroups

"ServerGroups": [
  {
    "Type": String,
    "Port": Integer,
    "ServerGroupId": String,
    "Weight": Integer
  }
]

Propriedades de ServerGroups

Propriedade

Tipo

Obrigatório

Editável

Descrição

Restrição

Type

String

Sim

Não

Tipo do grupo de servidores.

Valores válidos:

  • ALB

  • NLB

Port

Integer

Sim

Não

Número da porta usada pela instância ECS após a adição ao grupo de servidores.

Valores válidos: 0 a 65535.

ServerGroupId

String

Sim

Não

ID do grupo de servidores.

Nenhuma.

Weight

Integer

Sim

Não

Peso da instância ECS como servidor backend no grupo de servidores associado.

Quanto maior o peso, mais requisições são encaminhadas à instância ECS. Se Weight for definido como 0, nenhuma requisição será encaminhada. Valores válidos: 0 a 100.

Valores de retorno

Fn::GetAtt

ScalingActivityId: ID da atividade de dimensionamento em que o grupo de servidores é adicionado e as instâncias ECS do grupo de dimensionamento são incluídas nesse grupo de servidores.

Nota

Este parâmetro retorna apenas quando a propriedade ForceAttach é definida como true.

Exemplos

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ServerGroups:
        AssociationPropertyMetadata:
          Parameter:
            AssociationPropertyMetadata:
              Parameters:
                Type:
                  Type: String
                  Description:
                    en: |-
                      The type of backend server group.
                      Valid values:
                      ALB
                      NLB
                  AllowedValues:
                    - ALB
                    - NLB
                Port:
                  Type: Number
                  Description:
                    en: |-
                      The port number used by an ECS instance in the scaling group after Auto Scaling adds the ECS instance to backend server group.
                      ALB server group port range [1,65535], NLB server group port range [0,65535].
                  MinValue: 0
                  MaxValue: 65535
                ServerGroupId:
                  Type: String
                  Description:
                    en: The ID of backend server group.
                Weight:
                  Type: Number
                  Description:
                    en: |-
                      The weight of an ECS instance in the scaling group as a backend server after Auto Scaling adds the ECS instance to backend server group. Valid values: 0 to 100.
                      If you increase the weight of an ECS instance in a backend server group, the number of access requests that are forwarded to the ECS instance increases. If you set the Weight parameter for an ECS instance in a backend server group to 0, no access requests are forwarded to the ECS instance.
                  MinValue: 0
                  MaxValue: 100
            Type: Json
        AssociationProperty: List[Parameter]
        Type: Json
        Description:
          en: A collection of information about server groups.
        MinLength: 1
        MaxLength: 100
        Default:
          - Type: ALB
            Port: 80
            ServerGroupId: sgp-5yc3bd9lfyh*****
            Weight: 100
      ScalingGroupId:
        Type: String
        Description:
          en: The ID of the scaling group.
        Default: asg-bp1fo0dbtsbmqa9h****
      ForceAttach:
        Type: Boolean
        Description:
          en: |-
            Specifies whether to add the Elastic Compute Service (ECS) instances in the scaling group to the backend server group of the newly attached SLB instance. Valid values:
            true
            false
            Default value: false.
        Default: true
    Resources:
      ServerGroupAttachment:
        Type: ALIYUN::ESS::ServerGroupAttachment
        Properties:
          ServerGroups:
            Ref: ServerGroups
          ScalingGroupId:
            Ref: ScalingGroupId
          ForceAttach:
            Ref: ForceAttach
    Outputs:
      ScalingActivityId:
        Description: |-
          The ID of the scaling activity during which one or more SLB instances are attached to the scaling group and the ECS instances in the scaling group are added to the backend server groups of the SLB instances.
          Note This parameter is returned only after you set the ForceAttach parameter to true.
        Value:
          Fn::GetAtt:
            - ServerGroupAttachment
            - ScalingActivityId
    
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ServerGroups": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "AssociationPropertyMetadata": {
                "Parameters": {
                  "Type": {
                    "Type": "String",
                    "Description": {
                      "en": "The type of backend server group.\nValid values:\nALB\nNLB"
                    },
                    "AllowedValues": [
                      "ALB",
                      "NLB"
                    ]
                  },
                  "Port": {
                    "Type": "Number",
                    "Description": {
                      "en": "The port number used by an ECS instance in the scaling group after Auto Scaling adds the ECS instance to backend server group.\nALB server group port range [1,65535], NLB server group port range [0,65535]."
                    },
                    "MinValue": 0,
                    "MaxValue": 65535
                  },
                  "ServerGroupId": {
                    "Type": "String",
                    "Description": {
                      "en": "The ID of backend server group."
                    }
                  },
                  "Weight": {
                    "Type": "Number",
                    "Description": {
                      "en": "The weight of an ECS instance in the scaling group as a backend server after Auto Scaling adds the ECS instance to backend server group. Valid values: 0 to 100.\nIf you increase the weight of an ECS instance in a backend server group, the number of access requests that are forwarded to the ECS instance increases. If you set the Weight parameter for an ECS instance in a backend server group to 0, no access requests are forwarded to the ECS instance."
                    },
                    "MinValue": 0,
                    "MaxValue": 100
                  }
                }
              },
              "Type": "Json"
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "A collection of information about server groups."
          },
          "MinLength": 1,
          "MaxLength": 100,
          "Default": [
            {
              "Type": "ALB",
              "Port": 80,
              "ServerGroupId": "sgp-5yc3bd9lfyh*****",
              "Weight": 100
            }
          ]
        },
        "ScalingGroupId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the scaling group."
          },
          "Default": "asg-bp1fo0dbtsbmqa9h****"
        },
        "ForceAttach": {
          "Type": "Boolean",
          "Description": {
            "en": "Specifies whether to add the Elastic Compute Service (ECS) instances in the scaling group to the backend server group of the newly attached SLB instance. Valid values:\ntrue\nfalse\nDefault value: false."
          },
          "Default": true
        }
      },
      "Resources": {
        "ServerGroupAttachment": {
          "Type": "ALIYUN::ESS::ServerGroupAttachment",
          "Properties": {
            "ServerGroups": {
              "Ref": "ServerGroups"
            },
            "ScalingGroupId": {
              "Ref": "ScalingGroupId"
            },
            "ForceAttach": {
              "Ref": "ForceAttach"
            }
          }
        }
      },
      "Outputs": {
        "ScalingActivityId": {
          "Description": "The ID of the scaling activity during which one or more SLB instances are attached to the scaling group and the ECS instances in the scaling group are added to the backend server groups of the SLB instances.\nNote This parameter is returned only after you set the ForceAttach parameter to true.",
          "Value": {
            "Fn::GetAtt": [
              "ServerGroupAttachment",
              "ScalingActivityId"
            ]
          }
        }
      }
    }