ALIYUN::ESS::LoadBalancerAttachment

ALIYUN::ESS::LoadBalancerAttachment类型用于添加一个或多个负载均衡实例。

语法

{
  "Type": "ALIYUN::ESS::LoadBalancerAttachment",
  "Properties": {
    "ScalingGroupId": String,
    "ForceAttach": Boolean,
    "LoadBalancers": List,
    "LoadBalancerConfigs": List
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

ScalingGroupId

String

伸缩组ID。

ForceAttach

Boolean

是否把当前伸缩组内的实例全部添加为负载均衡实例的后端服务器。

取值:

  • true:添加 。

  • false(默认值):不添加 。

LoadBalancers

List

需要绑定的负载均衡CLB(原SLB)实例的ID列表。

最多绑定5个负载均衡实例。

LoadBalancerConfigs

List

负载均衡配置列表。

更多信息,请参见LoadBalancerConfigs属性

LoadBalancerConfigs语法

"LoadBalancerConfigs": [
  {
    "LoadBalancerId": String,
    "Weight": Integer
  }
]

LoadBalancerConfigs属性

属性名称

类型

必须

允许更新

描述

约束

LoadBalancerId

String

负载均衡CLB(原SLB)实例ID。

Weight

Integer

弹性伸缩将ECS实例添加到SLB服务器组后,ECS实例作为后端服务器的权重。

权重越高,ECS实例将被分配到越多的访问请求。如果权重为0,则ECS实例不会收到访问请求。取值范围:0~100。

返回值

Fn::GetAtt

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ForceAttach:
        Description:
          en: 'Specifies whether to add all instances in the current scaling group to
            the backend server groups of the attached CLB instance. Valid values:
    
            true
    
            false
    
            Default value: false.'
        Type: Boolean
      LoadBalancerConfigs:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            AssociationPropertyMetadata:
              Parameters:
                LoadBalancerId:
                  Description:
                    en: The ID of the CLB instance.
                  Type: String
                Weight:
                  Description:
                    en: 'The weight of an Elastic Compute Service (ECS) instance as a
                      backend server in the backend server groups of the attached CLB
                      instance. If you increase the weight of an ECS instance, the number
                      of access requests that are forwarded to the ECS instance also increases.
                      If you set Weight to 0 for an ECS instance, no access requests are
                      forwarded to the ECS instance.
    
                      Valid values: 0 to 100.'
                  Type: Number
            Type: Json
        Description:
          en: Load balancer configuration list.
        MaxLength: 20
        Type: Json
      LoadBalancers:
        AssociationProperty: List[Parameter]
        AssociationPropertyMetadata:
          Parameter:
            Description:
              en: The ID of load balancer.
            Type: String
        Description:
          en: 'The ID of CLB instance N that you want to attach to the scaling group.
            Valid values of N: 1 to 5.'
        MaxLength: 5
        Type: Json
      ScalingGroupId:
        Description:
          en: The ID of the scaling group.
        Type: String
    Resources:
      LoadBalancerAttachment:
        Properties:
          ForceAttach:
            Ref: ForceAttach
          LoadBalancerConfigs:
            Ref: LoadBalancerConfigs
          LoadBalancers:
            Ref: LoadBalancers
          ScalingGroupId:
            Ref: ScalingGroupId
        Type: ALIYUN::ESS::LoadBalancerAttachment
                            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "ScalingGroupId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the scaling group."
          }
        },
        "ForceAttach": {
          "Type": "Boolean",
          "Description": {
            "en": "Specifies whether to add all instances in the current scaling group to the backend server groups of the attached CLB instance. Valid values:\ntrue\nfalse\nDefault value: false."
          }
        },
        "LoadBalancers": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "Type": "String",
              "Description": {
                "en": "The ID of load balancer."
              }
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "The ID of CLB instance N that you want to attach to the scaling group. Valid values of N: 1 to 5."
          },
          "MaxLength": 5
        },
        "LoadBalancerConfigs": {
          "AssociationPropertyMetadata": {
            "Parameter": {
              "AssociationPropertyMetadata": {
                "Parameters": {
                  "LoadBalancerId": {
                    "Type": "String",
                    "Description": {
                      "en": "The ID of the CLB instance."
                    }
                  },
                  "Weight": {
                    "Type": "Number",
                    "Description": {
                      "en": "The weight of an Elastic Compute Service (ECS) instance as a backend server in the backend server groups of the attached CLB instance. If you increase the weight of an ECS instance, the number of access requests that are forwarded to the ECS instance also increases. If you set Weight to 0 for an ECS instance, no access requests are forwarded to the ECS instance.\nValid values: 0 to 100."
                    }
                  }
                }
              },
              "Type": "Json"
            }
          },
          "AssociationProperty": "List[Parameter]",
          "Type": "Json",
          "Description": {
            "en": "Load balancer configuration list."
          },
          "MaxLength": 20
        }
      },
      "Resources": {
        "LoadBalancerAttachment": {
          "Type": "ALIYUN::ESS::LoadBalancerAttachment",
          "Properties": {
            "ScalingGroupId": {
              "Ref": "ScalingGroupId"
            },
            "ForceAttach": {
              "Ref": "ForceAttach"
            },
            "LoadBalancers": {
              "Ref": "LoadBalancers"
            },
            "LoadBalancerConfigs": {
              "Ref": "LoadBalancerConfigs"
            }
          }
        }
      }
    }