All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::ALB::LoadBalancer

Last Updated:Dec 13, 2024

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

Properties

Property

Type

Required

Editable

Description

Constraint

AddressType

String

Yes

No

The address type of the ALB instance.

Valid values:

  • Internet: public IP address.

    The domain name of the ALB instance is resolved to a public IP address. The ALB instance can be accessed over the Internet.

  • Intranet: private IP address.

    The domain name of the ALB instance is resolved to a private IP address. The ALB instance can be accessed only over the virtual private cloud (VPC) in which the ALB instance resides.

LoadBalancerBillingConfig

Map

Yes

No

The billing method.

For more information, see LoadBalancerBillingConfig property.

LoadBalancerEdition

String

Yes

No

The edition of the ALB instance.

Valid values:

  • Basic: Basic Edition

  • Standard: Standard Edition

  • StandardWithWaf: Web Application Firewall (WAF)-enabled Edition

LoadBalancerName

String

Yes

Yes

The 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 to the instance.

VpcId

String

Yes

No

The VPC ID.

None.

ZoneMappings

List

Yes

No

The mappings between zones and vSwitches.

You must specify at least two zones. For more information, see ZoneMappings properties.

AccessLogConfig

Map

No

Yes

The access log configurations.

For more information, see AccessLogConfig properties.

AddressAllocatedMode

String

No

No

The mode in which an IP address is allocated to the ALB instance.

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.

AddressIpVersion

String

No

No

The IP version of the ALB instance.

Valid values:

  • IPv4

  • DualStack

BandwidthPackageId

String

No

Yes

The ID of the Internet Shared Bandwidth instance.

This property takes effect when AddressType is set to Internet.

DeletionProtectionEnabled

Boolean

No

Yes

Specifies whether to enable deletion protection.

Valid values:

  • true

  • false (default)

ModificationProtectionConfig

Map

No

Yes

Details of the configuration read-only mode.

For more information, see ModificationProtectionConfig properties.

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

Tags

List

No

Yes

The tags that you want to add to the ALB instance.

You can add up to 20 tags.

For more information, see Tags properties.

SecurityGroupIds

List

No

Yes

The IDs of the security groups that you want to associate with the ALB instance.

By default, security groups are unavailable. To use security groups, contact your account manager.

AccessLogConfig syntax

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

AccessLogConfig properties

Property

Type

Required

Editable

Description

Constraint

LogProject

String

Yes

No

The project of Simple Log Service (SLS).

None.

LogStore

String

Yes

No

The Logstore.

None.

Enable

Boolean

No

Yes

Specifies whether to enable the access log feature.

Valid values:

  • true

  • false

LoadBalancerBillingConfig syntax

"LoadBalancerBillingConfig": {
  "PayType": String
}

LoadBalancerBillingConfig property

Property

Type

Required

Editable

Description

Constraint

PayType

String

Yes

No

The billing method of the ALB instance.

Set the value to PostPay, which specifies the pay-as-you-go billing method.

ZoneMappings syntax

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

ZoneMappings properties

Property

Type

Required

Editable

Description

Constraint

VSwitchId

String

Yes

No

The vSwitch ID.

Each zone can contain only one vSwitch.

ZoneId

String

Yes

No

The zone ID.

None.

AllocationId

String

No

No

The ID of the elastic IP address (EIP) that you want to associate with the ALB instance.  

None.

LoadBalancerAddresses

List

No

No

The addresses of the ALB instance.

For more information, see LoadBalancerAddresses properties.

IntranetAddress

String

No

No

The private IPv4 address.

None.

EipType

String

No

No

The EIP type.

Valid values:

  • Common: EIP

  • Anycast: Anycast EIP

Note

For more information about the regions in which you can associate Anycast EIPs with ALB instances, see Associate Anycast EIPs with an ALB instance to enable access through the nearest access point.

LoadBalancerAddresses syntax

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

LoadBalancerAddresses properties

Property

Type

Required

Editable

Description

Constraint

AllocationId

String

Yes

No

The ID of the EIP that you want to associate with the ALB instance.

None.

IntranetAddress

String

No

No

The private IPv4 address.

None.

EipType

String

No

No

The EIP type.

Valid values:

  • Common: EIP

  • Anycast: Anycast EIP

Note

For more information about the regions in which you can associate Anycast EIPs with ALB instances, see Associate Anycast EIPs with an ALB instance to enable access through the nearest access point.

ModificationProtectionConfig syntax

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

ModificationProtectionConfig properties

Property

Type

Required

Editable

Description

Constraint

Status

String

Yes

Yes

The status of the configuration read-only mode.

Valid values:

  • NonProtection: disables the configuration read-only mode. In this case, you cannot specify Reason.

  • ConsoleProtection: enables the configuration read-only mode. In this case, you can specify Reason.

Reason

String

No

Yes

The reason why you want to 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 (-). It must start with a letter.

Note

This property takes effect when Status is set to ConsoleProtection.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The tag key.

The tag key must be 1 to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Value

String

No

No

The tag value.

The tag value can be up to 128 characters in length and cannot contain http:// or https://. It cannot start with aliyun or acs:.

Return values

Fn::GetAtt

  • LoadBalancerEdition: the edition of the ALB instance.

  • VpcId: the VPC ID.

  • LoadBalancerId: the ID of the ALB instance.

  • AddressType: the address type of the ALB instance.

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