ALIYUN::ALB::LoadBalancer is used to create an Application Load Balancer (ALB) instance.

Syntax

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

Properties

PropertyTypeRequiredEditableDescriptionConstraint
LoadBalancerNameStringYesYesThe name of the ALB instance. The name must be 1 to 80 characters in length, and can contain letters, digits, hyphens (-), forward slashes (/), periods (.), and underscores (_).

If you do not specify this property, the system assigns a name as the value of this property.

BandwidthPackageIdStringNoYesThe ID of the Elastic IP Address (EIP) bandwidth plan. This property takes effect only when AddressType is set to Internet.
LoadBalancerEditionStringYesNoThe edition of the ALB instance. Valid values:
  • Basic: Basic Edition
  • Standard: Standard Edition
VpcIdStringYesNoThe ID of the virtual private cloud (VPC) in which you want to create the ALB instance. None.
ResourceGroupIdStringNoYesThe ID of the resource group. None.
LoadBalancerBillingConfigMapYesNoThe configurations of the billing method. For more information, see LoadBalancerBillingConfig property.
AddressTypeStringYesNoThe type of the 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 a 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 a private IP address. Therefore, the ALB instance can be accessed over the VPC in which the ALB instance is deployed.
AddressAllocatedModeStringNoNoThe allocation mode of the IP address. Valid values:
  • Fixed: A static IP address is assigned to the ALB instance.
  • Dynamic (default): An IP address is dynamically assigned to each zone of the ALB instance.
ZoneMappingsListYesNoThe mappings between zones and vSwitches. You must specify at least two zones. For more information, see ZoneMappings properties.
DeletionProtectionEnabledBooleanNoYesSpecifies whether to enable deletion protection. Valid values:
  • true
  • false (default)
AddressIpVersionStringNoNoThe IP version of the ALB instance. Valid values:
  • ipv4
  • ipv6
ModificationProtectionConfigMapNoYesThe configurations of the configuration read-only mode. For more information, see ModificationProtectionConfig properties.
TagsListNoYesThe tags that you want to add to the ALB instance. You can add up to 20 tags.

For more information, see Tags properties.

AccessLogConfigMapNoYesThe configurations of the access log feature. For more information, see AccessLogConfig properties.

AccessLogConfig syntax

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

AccessLogConfig properties

Property TypeRequiredEditableDescriptionConstraint
EnableBooleanNoYesSpecifies whether to enable the access log feature. Valid values:
  • true
  • false
LogStoreStringYesNoThe Logstore. None.
LogProjectStringYesNoThe log project. None.

LoadBalancerBillingConfig syntax

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig property

PropertyTypeRequiredEditableDescriptionConstraint
PayTypeStringYesNoThe billing method of the ALB instance. Set the value to PostPay. PostPay specifies the pay-as-you-go billing method.

ZoneMappings syntax

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

ZoneMappings properties

PropertyTypeRequiredEditableDescriptionConstraint
ZoneIdStringYesNoThe zone ID of the ALB instance. None.
VSwitchIdStringYesNoThe vSwitch ID of the ALB instance. Each zone can contain only one vSwitch.

ModificationProtectionConfig syntax

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

ModificationProtectionConfig properties

PropertyTypeRequiredEditableDescriptionConstraint
StatusStringYesYesThe state of the configuration read-only mode. Valid values:
  • NonProtection: disables the configuration read-only mode. In this case, you cannot specify the Reason property.
  • ConsoleProtection: enables the configuration read-only mode. In this case, you can specify the Reason property.
ReasonStringNoYesThe reason why you enable the configuration read-only mode. The reason must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The reason must start with a letter.
Note This property takes effect only when Status is set to ConsoleProtection.

Tags syntax

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

Tags properties

PropertyTypeRequiredEditableDescriptionConstraint
KeyStringYesNoThe key of the tag. The tag key must be 1 to 128 characters in length, and cannot contain http:// or https://. The tag key cannot start with aliyun or acs:.
ValueStringNoNoThe value of the tag. The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • LoadBalancerEdition: the edition of the ALB instance.
  • VpcId: the ID of the VPC in which the ALB instance is created.
  • LoadBalancerId: the ID of the ALB instance.
  • AddressType: the type of the IP address that the ALB instance uses to provide services.
  • DNSName: the domain name of the ALB instance.
  • ZoneMappings: the mappings between zones and vSwitches.

Examples

  • YAML format

    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                
  • JSON format

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