ALIYUN::ALB::LoadBalancer类型用于创建应用型负载均衡ALB实例。

语法

{
  "Type": "ALIYUN::ALB::LoadBalancer",
  "Properties": {
    "BandwidthPackageId": String,
    "LoadBalancerName": String,
    "LoadBalancerEdition": String,
    "VpcId": String,
    "ResourceGroupId": String,
    "LoadBalancerBillingConfig": Map,
    "AddressType": String,
    "AddressAllocatedMode": String,
    "ZoneMappings": List,
    "DeletionProtectionEnabled": Boolean,
    "AddressIpVersion": String,
    "ModificationProtectionConfig": Map,
    "Tags": List,
    "AccessLogConfig": Map
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
LoadBalancerName String ALB实例的名称。 长度为1~80个字符。可包含英文字母、数字、短划线(-)、正斜线(/)、半角句号(.)和下划线(_)。

不指定该参数时,默认由系统分配一个实例名称。

BandwidthPackageId String 绑定的共享带宽包ID。 当AddressType取值为Internet时该参数有效。
LoadBalancerEdition String ALB实例的版本。 取值:
  • Basic:基础版。
  • Standard:标准版。
VpcId String 专有网络ID。
ResourceGroupId String 资源组ID。
LoadBalancerBillingConfig Map 计费配置。 更多信息,请参见LoadBalancerBillingConfig属性
AddressType String ALB实例的地址类型。 取值:
  • Internet:公网IP地址。DNS域名被解析到公网IP地址,因此可以在公网环境访问。
  • Intranet:私网IP地址。DNS域名被解析到私网IP地址,因此只能被负载均衡所在VPC的内网环境访问。
AddressAllocatedMode String 地址模式。 取值:
  • Fixed:固定IP模式,表示使用固定的IP地址。
  • Dynamic(默认值):动态IP模式,表示每个可用区动态分配IP地址。
ZoneMappings List 可用区及交换机映射列表。 您必须至少指定两个可用区。更多信息,请参见ZoneMappings属性
DeletionProtectionEnabled Boolean 是否启用删除保护。 取值:
  • true:启用删除保护。
  • false(默认值):禁用删除保护。
AddressIpVersion String 负载均衡实例的IP版本。 取值:
  • ipv4:IPv4版本。
  • ipv6:IPv6版本。
ModificationProtectionConfig Map 修改保护的配置。 更多信息,请参见ModificationProtectionConfig属性
Tags List ALB实例的标签。 最多支持添加20个标签。

更多信息,请参见Tags属性

AccessLogConfig Map 访问日志配置。 更多信息,请参见AccessLogConfig属性

AccessLogConfig语法

"AccessLogConfig": {
  "Enable": Boolean,
  "LogStore": String,
  "LogProject": String 
}

AccessLogConfig属性

属性名称 类型 必须 允许更新 描述 约束
Enable Boolean 是否启用访问日志配置。 取值:
  • true:启用访问日志配置。
  • false:不启用访问日志配置。
LogStore String 日志存储。
LogProject String 日志项目。

LoadBalancerBillingConfig语法

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig属性

属性名称 类型 必须 允许更新 描述 约束
PayType String ALB实例的计费方式。 取值:PostPay,表示按量付费。

ZoneMappings语法

"ZoneMappings": [
  {
    "ZoneId": String,
    "VSwitchId": String
  }
]

ZoneMappings属性

属性名称 类型 必须 允许更新 描述 约束
ZoneId String 可用区ID。
VSwitchId String 交换机ID。 每个可用区只能包含一个交换机。

ModificationProtectionConfig语法

"ModificationProtectionConfig": {
  "Status": String,
  "Reason": String
}

ModificationProtectionConfig属性

属性名称 类型 必须 允许更新 描述 约束
Status String 修改保护的状态。 取值:
  • NonProtection:未启用修改保护。此时不允许指定Reason参数。
  • ConsoleProtection:已启用控制台修改保护。此时允许指定Reason参数。
Reason String 修改保护的原因。 长度为2~128个字符,必须以英文字母或汉字开头,可包含英文字母、汉字、数字、半角句号(.)、下划线(_)和短划线(-)。
说明 当Status取值为ConsoleProtection时该参数有效。

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]

Tags属性

属性名称 类型 必须 允许更新 描述 约束
Key String 标签键。 长度为1~128个字符,不能以aliyunacs:开头,不能包含http://https://
Value String 标签值。 长度为0~128个字符,不能以aliyunacs:开头,不能包含http://https://

返回值

Fn::GetAtt

  • LoadBalancerEdition:ALB实例的版本。
  • VpcId:专有网络ID。
  • LoadBalancerId:ALB实例的ID。
  • AddressType:ALB实例的地址类型。
  • DNSName:ALB实例的域名。
  • ZoneMappings:可用区及交换机映射列表。

示例

  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "LoadBalancerName": {
          "Type": "String",
          "Description": "The name of the ALB instance.\nThe name must be 2 to 128 characters in length, and can contain letters, digits, periods(.), underscores (_), and hyphens (-). The name must start with a letter.",
          "Default": "test_slb"
        },
        "LoadBalancerEdition": {
          "Type": "String",
          "Description": "The edition of the ALB instance. Different editions have different limits and billing methods. Valid values:\nBasic: Basic Edition\nStandard: Standard Edition",
          "Default": "Basic"
        },
        "VpcId": {
          "Type": "String",
          "Description": "The ID of the virtual private cloud (VPC) where the ALB instance is deployed.",
          "Default": "vpc-bp1bqklz6zm4fo4ir****"
        },
        "LoadBalancerBillingConfig": {
          "Type": "Json",
          "Description": "The configuration of the billing method.",
          "Default": {
            "PayType": "PostPay"
          }
        },
        "ZoneMappings": {
          "Type": "Json",
          "Description": "The zones and the vSwitches in the zones. You must specify at least two zones.",
          "Default": [
            {
              "ZoneId": "cn-hangzhou-h",
              "VSwitchId": "vsw-bp1jhj254nwc7i0ge****"
            },
            {
              "ZoneId": "cn-hangzhou-i",
              "VSwitchId": "vsw-bp1llps83qqb30znp****"
            }
          ]
        },
        "AddressType": {
          "Type": "String",
          "Description": "The type of IP address that the ALB instance uses to provide services. Valid values:\nInternet: The ALB instance uses a public IP address. The domain name of the ALB instance is resolved to the public IP address. Therefore, the ALB instance can be accessed over the Internet.\nIntranet: The ALB instance uses a private IP address. The domain name of the ALB instance is resolved to the private IP address. Therefore, the ALB instance can be accessed over the VPC where the ALB instance is deployed.",
          "AllowedValues": [
            "Internet",
            "Intranet"
          ],
          "Default": "Internet"
        }
      },
      "Resources": {
        "LoadBalancer": {
          "Type": "ALIYUN::ALB::LoadBalancer",
          "Properties": {
            "LoadBalancerName": {
              "Ref": "LoadBalancerName"
            },
            "LoadBalancerEdition": {
              "Ref": "LoadBalancerEdition"
            },
            "VpcId": {
              "Ref": "VpcId"
            },
            "LoadBalancerBillingConfig": {
              "Ref": "LoadBalancerBillingConfig"
            },
            "ZoneMappings": {
              "Ref": "ZoneMappings"
            },
            "AddressType": {
              "Ref": "AddressType"
            }
          }
        }
      },
      "Outputs": {
        "LoadBalancerEdition": {
          "Description": "The edition of the ALB instance.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "LoadBalancerEdition"
            ]
          }
        },
        "VpcId": {
          "Description": "The ID of the virtual private cloud (VPC) where the ALB instance is deployed.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "VpcId"
            ]
          }
        },
        "LoadBalancerId": {
          "Description": "The ID of the ALB instance.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "LoadBalancerId"
            ]
          }
        },
        "AddressType": {
          "Description": "The type of IP address that the ALB instance uses to provide services.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "AddressType"
            ]
          }
        },
        "DNSName": {
          "Description": "The domain name of the ALB instance.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "DNSName"
            ]
          }
        },
        "ZoneMappings": {
          "Description": "The zones, vSwitches and addresses which are mapped to the zones.",
          "Value": {
            "Fn::GetAtt": [
              "LoadBalancer",
              "ZoneMappings"
            ]
          }
        }
      }
    }
  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      LoadBalancerName:
        Type: String
        Description: |-
          The name of the ALB instance.
          The name must be 2 to 128 characters in length, and can contain letters, digits, periods(.), underscores (_), and hyphens (-). The name must start with a letter.
        Default: test_slb
      LoadBalancerEdition:
        Type: String
        Description: |-
          The edition of the ALB instance. Different editions have different limits and billing methods. Valid values:
          Basic: Basic Edition
          Standard: Standard Edition
        Default: Basic
      VpcId:
        Type: String
        Description: The ID of the virtual private cloud (VPC) where the ALB instance is deployed.
        Default: vpc-bp1bqklz6zm4fo4ir****
      LoadBalancerBillingConfig:
        Type: Json
        Description: The configuration of the billing method.
        Default:
          PayType: PostPay
      ZoneMappings:
        Type: Json
        Description: The zones and the vSwitches in the zones. You must specify at least two zones.
        Default:
          - ZoneId: cn-hangzhou-h
            VSwitchId: vsw-bp1jhj254nwc7i0ge****
          - ZoneId: cn-hangzhou-i
            VSwitchId: vsw-bp1llps83qqb30znp****
      AddressType:
        Type: String
        Description: |-
          The type of IP address that the ALB instance uses to provide services. Valid values:
          Internet: The ALB instance uses a public IP address. The domain name of the ALB instance is resolved to the public IP address. Therefore, the ALB instance can be accessed over the Internet.
          Intranet: The ALB instance uses a private IP address. The domain name of the ALB instance is resolved to the private IP address. Therefore, the ALB instance can be accessed over the VPC where the ALB instance is deployed.
        AllowedValues:
          - Internet
          - Intranet
        Default: Internet
    Resources:
      LoadBalancer:
        Type: ALIYUN::ALB::LoadBalancer
        Properties:
          LoadBalancerName:
            Ref: LoadBalancerName
          LoadBalancerEdition:
            Ref: LoadBalancerEdition
          VpcId:
            Ref: VpcId
          LoadBalancerBillingConfig:
            Ref: LoadBalancerBillingConfig
          ZoneMappings:
            Ref: ZoneMappings
          AddressType:
            Ref: AddressType
    Outputs:
      LoadBalancerEdition:
        Description: The edition of the ALB instance.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - LoadBalancerEdition
      VpcId:
        Description: The ID of the virtual private cloud (VPC) where the ALB instance is deployed.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - VpcId
      LoadBalancerId:
        Description: The ID of the ALB instance.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - LoadBalancerId
      AddressType:
        Description: The type of IP address that the ALB instance uses to provide services.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - AddressType
      DNSName:
        Description: The domain name of the ALB instance.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - DNSName
      ZoneMappings:
        Description: The zones, vSwitches and addresses which are mapped to the zones.
        Value:
          Fn::GetAtt:
            - LoadBalancer
            - ZoneMappings