Creates a Classic Load Balancer (CLB) instance.

Before you call this operation, take note of the following information:

  • Before you create a CLB instance, call the DescribeAvailableResource operation to query the resources available for purchase in the region where you want to create the CLB instance.
  • After a CLB instance is created, you are charged for using the CLB instance.
  • If you do not set LoadBalancerSpec, a shared-resource CLB instance is created. We recommend that you set LoadBalancerSpec to specify the specification of the CLB instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateLoadBalancer

The operation that you want to perform.

Set the value to CreateLoadBalancer.

RegionId String Yes cn-hangzhou

The ID of the region where you want to create the CLB instance.

You can call the DescribeRegions operation to query region IDs.

AddressType String No internet

The type of IP address that the CLB instance uses to provide services. Valid values:

  • internet: After an Internet-facing CLB instance is created, the system allocates a public IP address to the CLB instance. Then, the CLB instance can forward requests from the Internet.
  • intranet: After an internal-facing CLB instance is created, the system allocates a private IP address to the CLB instance. Then, the CLB instance can forward only internal requests.
InternetChargeType String No paybytraffic

The billing method of the Internet-facing CLB instance. Set the value to

  • paybytraffic: pay-by-data-transfer. This is the default value.
Bandwidth Integer No 10

The bandwidth limit of the listener. Unit: Mbit/s.

Valid values: 1 to 5120 and -1.

  • -1: For a pay-by-data-transfer Internet-facing CLB instance, you can set the value to -1. This indicates that the bandwidth is unlimited.
  • 1 to 5120: For a pay-by-bandwidth Internet-facing CLB instance, you can specify the bandwidth limit of each listener. The sum of bandwidth limit values of all listeners cannot exceed the bandwidth limit of the CLB instance. For more information, see Bandwidth of a shared-resource instance.
ClientToken String No 5A2CFF0E-5718-*******45B5-9D4D-70B3FF3898

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

LoadBalancerName String No lb-bp1o94dp5i6ea*******

The name of the CLB instance.

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

If this parameter is not set, the system automatically creates a name for the CLB instance.

VpcId String No vpc-bp1aevy8sofi8mh1*****

The ID of the virtual private cloud (VPC) to which the CLB instance belongs.

VSwitchId String No vsw-bp12mw1f8k3jgy*****

The ID of the vSwitch to which the CLB instance is attached.

To create a CLB instance that is deployed in a VPC, you must set this parameter. If you specify this parameter, the value of the AddessType parameter is set to intranet by default.

MasterZoneId String No cn-hangzhou-b

The ID of the primary zone to which the CLB instance belongs.

You can call the DescribeZone operation to query the primary and secondary zones in the region where you want to create the CLB instance.

SlaveZoneId String No cn-hangzhou-d

The ID of the secondary zone to which the CLB instance belongs.

You can call the DescribeZone operation to query the primary and secondary zones in the region where you want to create the CLB instance.

LoadBalancerSpec String No slb.s2.small

The specification of the CLB instance. Valid values:

  • slb.s1.small
  • slb.s2.small
  • slb.s2.medium
  • slb.s3.small
  • slb.s3.medium
  • slb.s3.large

The types of CLB instance that you can create vary by region.

You can create high-performance CLB instances in the following regions: China (Qingdao), China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Zhangjiakou), China (Hohhot), Singapore (Singapore), UK (London), Germany (Frankfurt), Australia (Sydney), Malaysia (Kuala Lumpur), UAE (Dubai), Indonesia (Jakarta), US (Silicon Valley), India (Mumbai), Japan (Tokyo), China (Hong Kong), and US (Virginia). For more information about the specifications, see High-performance CLB instance~~85931~~.

Note If you do not specify this parameter, a shared-resource CLB instance is created.
ResourceGroupId String No rg-atstuj3rtopt****

The ID of the enterprise resource group.

PayType String No PayOnDemand

The billing method of the CLB instance. Set the value to

  • PayOnDemand: You are charged on a pay-as-you-go basis.
PricingCycle String No month

The billing cycle of the Internet-facing CLB instance. Valid values: month and year.

Note This parameter is valid only when you create a subscription CLB instance on the Alibaba Cloud China site. In this case, the PayType parameter must be set to PrePay.
Duration Integer No 1

The subscription duration of the Internet-facing CLB instance. Valid values:

  • If you set PricingCycle to month: Valid values: 1 to 9.
  • If you set PricingCycle to year: Valid values: 1 to 3.
Note This parameter is valid only when you create a subscription CLB instance on the Alibaba Cloud China site. In this case, the PayType parameter must be set to PrePay.
AutoPay Boolean No true

Specifies whether to automatically pay for the subscription Internet-facing CLB instance. Valid values:

  • true: automatically pays for the subscription Internet-facing CLB instance. After you call the operation, the system automatically completes the payment and creates the CLB instance.
  • false: This is the default value. After you call the operation, the order is placed but the payment is not completed. You can view the order in the console. The CLB instance will not be created until you complete the payment.

This parameter is valid only when you create a subscription CLB instance on the Alibaba Cloud China site. In this case, the PayType parameter must be set to PrePay.

AddressIPVersion String No ipv4

The IP version that is used by the CLB instance. Valid values: ipv4 and ipv6.

Address String No 192.168.0.**

The private IP address of the CLB instance. The private IP address must belong to the destination CIDR block of the vSwitch.

DeleteProtection String No on

Specifies whether to enable deletion protection for the CLB instance.

ModificationProtectionStatus String No ConsoleProtection

Specifies whether to enable the configuration read-only mode for the CLB instance:

  • NonProtection: disables the configuration read-only mode. After you disable the configuration read-only mode, the value of ModificationProtectionReason is cleared.
  • ConsoleProtection: enables the configuration read-only mode.
ModificationProtectionReason String No ManageInstance

Enter a reason why you want to enable the configuration read-only mode. The value must be 1 to 80 characters in length. It must start with a letter and can contain digits, periods (.), underscores (_), and hyphens (-).

Note This parameter is required only when ModificationProtectionStatus is set to ConsoleProtection.

Response parameters

Parameter Type Example Description
LoadBalancerId String lb-hddhfjg*******

The ID of the CLB instance.

Address String 42.250.**. **

The IP address that is allocated to the CLB instance.

VpcId String vpc-25dvzy9*****

The ID of the VPC to which the CLB instance belongs.

VSwitchId String vsw-255ecr***

The ID of the vSwitch to which the CLB instance belongs.

LoadBalancerName String lb-bp1o94dp5i6ea*******

The name of the CLB instance.

AddressIPVersion String ipv4

The IP version that is used by the CLB instance.

NetworkType String classic

The type of network where the CLB instance is deployed. Valid values: vpc and classic.

  • vpc: indicates that the CLB instance is deployed in a VPC.
  • classic: indicates that the CLB instance is deployed in a classic network.
OrderId Long 201429619788910

The ID of the order.

RequestId String 365F4154-92F6-4AE4-92F8-7FF34B540710

The ID of the request.

ResourceGroupId String rg-atstuj3rto******

The ID of the enterprise resource group.

Examples

Sample requests

http(s)://[Endpoint]/? Action=CreateLoadBalancer
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<CreateLoadBalancerResponse>
    <NetworkType>vpc</NetworkType>
	  <LoadBalancerName>lb-bp1o94dp5i6ea*******</LoadBalancerName>
	  <Address>192.168.0. **</Address>
	  <ResourceGroupId>rg-acfmxazb***</ResourceGroupId>
	  <RequestId>AB197CF0-D9E9-4475-A89D-35DBCCF13BBE</RequestId>
	  <AddressIPVersion>ipv4</AddressIPVersion>
	  <LoadBalancerId>lb-bp1b6c719dfa0***</LoadBalancerId>
	  <VSwitchId>vsw-bp12mw1f8k3jgygk9****</VSwitchId>
	  <VpcId>vpc-bp1aevy8sofi8mh1q***</VpcId>
</CreateLoadBalancerResponse>

JSON format

{
    "NetworkType": "vpc",
    "LoadBalancerName": "lb-bp1o94dp5i6ea*******",
    "Address": "192.168.0. **",
    "ResourceGroupId": "rg-acfmxazb4ph****",
    "RequestId": "AB197CF0-D9E9-4475-A89D-35DBCCF13BBE",
    "AddressIPVersion": "ipv4",
    "LoadBalancerId": "lb-bp1b6c719dfa08ex****",
    "VSwitchId": "vsw-bp12mw1f8k3jgygk9****",
    "VpcId": "vpc-bp1aevy8sofi8mh1****"
}

Error codes

For a list of error codes, visit the API Error Center.