All Products
Search
Document Center

Resource Orchestration Service:ALIYUN::SLB::LoadBalancer

Last Updated:Apr 21, 2025

ALIYUN::SLB::LoadBalancer is used to create a Server Load Balancer (SLB) instance.

Syntax

{
  "Type": "ALIYUN::SLB::LoadBalancer",
  "Properties": {
    "DeletionProtection": Boolean,
    "AddressType": String,
    "Tags": List,
    "InternetChargeType": String,
    "Bandwidth": Integer,
    "SlaveZoneId": String,
    "ResourceGroupId": String,
    "VpcId": String,
    "LoadBalancerName": String,
    "VSwitchId": String,
    "LoadBalancerSpec": String,
    "MasterZoneId": String,
    "ModificationProtectionReason": String,
    "ModificationProtectionStatus": String,
    "AddressIPVersion": String,
    "InstanceChargeType": String
  }
}

Properties

Property

Type

Required

Editable

Description

Constraint

ResourceGroupId

String

No

Yes

The ID of the resource group.

None.

DeletionProtection

Boolean

No

Yes

Specifies whether to enable deletion protection.

Valid values:

  • true

  • false (default)

VpcId

String

No

No

The ID of the virtual private cloud (VPC).

None.

SlaveZoneId

String

No

No

The zone ID of the SLB instance.

None.

Bandwidth

Integer

No

Yes

The maximum bandwidth of the pay-by-bandwidth Internet-facing SLB instance.

Valid values: 1 to 10000.

Unit: Mbit/s.

Default value: 1.

If you use the pay-by-data-transfer metering method for an internal-facing SLB instance, the maximum bandwidth of the instance is specified by the system.

  • For a pay-by-bandwidth Internet-facing SLB instance, Bandwidth takes effect only when the value of Bandwidth is supported by the bandwidth of the listener.

  • For a pay-by-data-transfer Internet-facing SLB instance, the bandwidth of the listener determines the maximum bandwidth of the instance. In this case, the value of Bandwidth is ignored.

AddressType

String

No

No

The IP address type of the SLB instance.

Valid values:

  • internet (default): The SLB instance uses a public IP address. The domain name of the instance is resolved to the public IP address. Therefore, the SLB instance can be accessed over the Internet.

  • intranet: The SLB instance uses a private IP address. The domain name of the instance is resolved to the private IP address. Therefore, the SLB instance can be accessed only over the VPC of the instance.

VSwitchId

String

No

No

The ID of the vSwitch.

None.

LoadBalancerName

String

No

Yes

The name of the SLB 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.

InternetChargeType

String

No

Yes

The metering method of the Internet-facing SLB instance.

Valid values:

  • paybybandwidth

  • paybytraffic (default)

MasterZoneId

String

No

No

The primary zone ID of the SLB instance.

None.

Tags

List

No

Yes

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

You can add up to five tags.

For more information, see Tags properties.

LoadBalancerSpec

String

No

Yes

The specification of the SLB instance.

Valid values:

  • slb.s1.small (default)

  • slb.s2.small

  • slb.s2.medium

  • slb.s3.small

  • slb.s3.medium

  • slb.s3.large

  • slb.s3.xlarge

  • slb.s3.xxlarge

The supported specifications vary based on the region. For more information about each specification, see FAQs about CLB instances.

ModificationProtectionStatus

String

No

Yes

The status of the configuration read-only mode.

Valid values:

  • NonProtection (default): The configuration read-only mode is disabled.

  • ConsoleProtection: The configuration read-only mode is enabled. You can change the mode in the SLB console.

ModificationProtectionReason

String

No

Yes

The reason why you want to enable the configuration read-only mode.

The reason must be 1 to 80 characters in length, and must start with a letter. It can contain letters, digits, periods (.), and hyphens (-).

AddressIPVersion

String

No

No

The IP version.

Valid values:

  • ipv4

  • ipv6

    Note

    When you set this property to ipv6, you must take note of the supported regions and specifications.

InstanceChargeType

String

No

Yes

The metering method of the SLB instance.

Valid values:

  • PayBySpec (default): You are charged for the SLB instance based on the specification of the instance.

  • PayByCLCU: You are charged for the SLB instance based on the Load Balancer Capacity Unit (LCU) of the instance.

Tags syntax

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

Tags properties

Property

Type

Required

Editable

Description

Constraint

Key

String

Yes

No

The key of the tag.

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

Value

String

No

No

The value of the tag.

The 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

  • LoadBalancerId: the ID of the SLB instance.

  • NetworkType: the network type of the SLB instance.

  • AddressType: the IP address type of the SLB instance.

  • IpAddress: the IP address of the SLB instance.

  • OrderId: the ID of the order.

  • Bandwidth: the maximum bandwidth.

  • AddressIPVersion: the IP version of the SLB instance.

  • SlaveZoneId: the secondary zone ID of the SLB instance.

  • MasterZoneId: the primary zone ID of the SLB instance.

  • LoadBalancerName: the name of the SLB instance.

  • ResourceGroupId: the ID of the resource group.

  • LoadBalancerSpec: the specification of the SLB instance.

  • VpcId: the VPC ID of the SLB instance.

  • VSwitchId: the vSwitch ID of the SLB instance.

  • PayType: the billing method of the SLB instance.

Examples

ROSTemplateFormatVersion: '2015-09-01'
Description: Test SLB LoadBalancer
Parameters:
  MasterZoneId:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance:ZoneId
Resources:
  LoadBalance:
    Type: ALIYUN::SLB::LoadBalancer
    Properties:
      AddressType: internet
      LoadBalancerSpec: slb.s1.small
      MasterZoneId:
        Ref: MasterZoneId
      LoadBalancerName: mytest
Outputs: {}
{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Description": "Test SLB LoadBalancer",
  "Parameters": {
    "MasterZoneId": {
      "Type": "String",
      "AssociationProperty": "ALIYUN::ECS::Instance:ZoneId"
    }
  },
  "Resources": {
    "LoadBalance": {
      "Type": "ALIYUN::SLB::LoadBalancer",
      "Properties": {
        "AddressType": "internet",
        "LoadBalancerSpec": "slb.s1.small",
        "MasterZoneId": {
          "Ref": "MasterZoneId"
        },
        "LoadBalancerName": "mytest"
      }
    }
  },
  "Outputs": {
  }
}

For more examples, visit slb.