全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::ALB::LoadBalancer

更新時間:Jul 19, 2025

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,
    "SecurityGroupIds": List,
    "Ipv6AddressType": String
  }
}

屬性

屬性名稱

類型

必須

允許更新

描述

約束

AddressType

String

ALB執行個體的地址類型。

取值:

  • Internet:公網IP地址。

    DNS網域名稱被解析到公網IP地址,因此可以在公網環境訪問。

  • Intranet:私網IP地址。

    DNS網域名稱被解析到私網IP地址,因此只能被負載平衡所在的VPC內網環境訪問。

LoadBalancerBillingConfig

Map

計費配置。

更多資訊,請參見LoadBalancerBillingConfig屬性

LoadBalancerEdition

String

ALB執行個體的版本。

取值:

  • Basic:基礎版。

  • Standard:標準版。

  • StandardWithWaf:WAF 增強版。

VpcId

String

專用網路ID。

ZoneMappings

List

可用性區域及交換器映射列表。

您必須至少指定兩個可用性區域。更多資訊,請參見ZoneMappings屬性

AccessLogConfig

Map

訪問日誌配置。

更多資訊,請參見AccessLogConfig屬性

AddressAllocatedMode

String

地址模式。

取值:

  • Fixed:固定IP模式,表示使用固定的IP地址。

  • Dynamic(預設值):動態IP模式,表示每個可用性區域動態分配IP地址。

AddressIpVersion

String

Server Load Balancer執行個體的IP版本。

取值:

  • IPv4:IPv4版本。

  • DualStack:雙棧類型。

BandwidthPackageId

String

綁定的共用頻寬包ID。

當AddressType取值為Internet時,該參數有效。

DeletionProtectionEnabled

Boolean

是否啟用刪除保護。

取值:

  • true:啟用刪除保護。

  • false(預設值):禁用刪除保護。

Ipv6AddressType

String

ALB執行個體用於提供服務的IPv6地址類型。

取值: Internet:ALB執行個體使用公用IPv6地址。ALB執行個體的網域名稱被解析為公用IPv6地址。 Intranet:ALB執行個體使用私人IPv6地址。ALB執行個體的網域名稱被解析為私人IP地址。

LoadBalancerName

String

ALB執行個體的名稱。

長度為1~80個字元。可包含英文字母、數字、短劃線(-)、正斜線(/)、半形句號(.)和底線(_)。

不指定該參數時,預設由系統分配一個執行個體名稱。

ModificationProtectionConfig

Map

修改保護的配置。

更多資訊,請參見ModificationProtectionConfig屬性

ResourceGroupId

String

資源群組ID。

SecurityGroupIds

List

應用型Server Load Balancer執行個體需要綁定的安全性群組 ID 集合。

安全性群組功能預設不開放,如需使用,請向商務經理申請。

Tags

List

ALB執行個體的標籤。

最多支援添加20個標籤。

更多資訊,請參見Tags屬性

AccessLogConfig文法

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

AccessLogConfig屬性

屬性名稱

類型

必須

允許更新

描述

約束

LogProject

String

記錄項目。

LogStore

String

日誌儲存。

Enable

Boolean

是否啟用訪問日誌配置。

取值:

  • true:啟用訪問日誌配置。

  • false:不啟用訪問日誌配置。

LoadBalancerBillingConfig文法

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig屬性

屬性名稱

類型

必須

允許更新

描述

約束

PayType

String

ALB執行個體的計費方式。

取值:PostPay,表示隨用隨付。

ZoneMappings文法

"ZoneMappings": [
  {
    "ZoneId": String,
    "VSwitchId": String,
    "AllocationId": String,
    "LoadBalancerAddresses": List,
    "IntranetAddress": String,
    "EipType": String
  }
]

ZoneMappings屬性

屬性名稱

類型

必須

允許更新

描述

約束

VSwitchId

String

交換器ID。

每個可用性區域只能包含一個交換器。

ZoneId

String

可用性區域ID。

AllocationId

String

與ALB執行個體關聯的EIP (elastic IP address) ID。 

EipType

String

公網 EIP 的類型。

取值:

  • Common:彈性公網 IP,簡稱 EIP。

  • Anycast:任播彈性公網 IP,簡稱 Anycast EIP。

說明

ALB 支援綁定 Anycast EIP 的地區,請參見ALB綁定Anycast EIP實現多地區業務就近接入

LoadBalancerAddresses

List

執行個體地址。

更多資訊,請參見LoadBalancerAddresses屬性

IntranetAddress

String

IPv4 私網地址。

LoadBalancerAddresses文法

"ModificationProtectionConfig": {
  "AllocationId": String,
  "IntranetAddress": String,
  "EipType": String
}

LoadBalancerAddresses屬性

屬性名稱

類型

必須

允許更新

描述

約束

AllocationId

String

與ALB執行個體關聯的EIP (elastic IP address) ID。

EipType

String

公網 EIP 的類型。

取值:

  • Common:彈性公網 IP,簡稱 EIP。

  • Anycast:任播彈性公網 IP,簡稱 Anycast EIP。

說明

ALB 支援綁定 Anycast EIP 的地區,請參見ALB綁定Anycast EIP實現多地區業務就近接入

IntranetAddress

String

IPv4 私網地址。

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:可用性區域及交換器映射列表。

  • Arn:阿里雲資源名稱。

樣本

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  VpcId:
    Type: String
    AssociationProperty: ALIYUN::ECS::VPC::VPCId
  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****
Resources:
  LoadBalancer:
    Type: ALIYUN::ALB::LoadBalancer
    Properties:
      LoadBalancerName: TestLoadBalancer
      LoadBalancerEdition: Basic
      VpcId:
        Ref: VpcId
      LoadBalancerBillingConfig:
        PayType: PostPay
      ZoneMappings:
        Ref: ZoneMappings
      AddressType: Internet
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                
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "VpcId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
    },
    "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****"
        }
      ]
    }
  },
  "Resources": {
    "LoadBalancer": {
      "Type": "ALIYUN::ALB::LoadBalancer",
      "Properties": {
        "LoadBalancerName": "TestLoadBalancer",
        "LoadBalancerEdition": "Basic",
        "VpcId": {
          "Ref": "VpcId"
        },
        "LoadBalancerBillingConfig": {
          "PayType": "PostPay"
        },
        "ZoneMappings": {
          "Ref": "ZoneMappings"
        },
        "AddressType": "Internet"
      }
    }
  },
  "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"
        ]
      }
    }
  }
}