Creates a Classic Load Balancer (CLB) instance.

Description

  • 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 the most recent region list.

AddressType String No internet

The network type of the CLB instance. 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 (default): pay-by-data-transfer
Bandwidth Integer No 10

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

  • -1: For a pay-by-data-transfer Internet-facing CLB instance, you can set this parameter to -1. In this case, the bandwidth of the listener is unlimited.

ClientToken String No 593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3

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

Note If you do not set this parameter, the system automatically uses the request ID as the client token. The ID of each request may be unique.
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.

If you want to deploy the CLB instance in a VPC, you must specify this parameter. If this parameter is set, AddessType 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.s1.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
    Note If you do not specify this parameter, a shared-resource CLB instance is created. Shared-resource CLB instances are no longer available for purchase. Therefore, you must specify this parameter.
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: pay-as-you-go
PricingCycle String No month

The billing cycle of the subscription CLB instance. Valid values:

  • month
  • 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 PricingCycle is set to month, valid values are 1 to 9.
  • If PricingCycle is set to year, valid values are 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.
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.
AddressIPVersion String No ipv4

The IP protocol used by the CLB instance. Valid values: ipv4 and ipv6.

Address String No 192.168.XX.XX

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. Valid values:

  • on: yes
  • off: no
ModificationProtectionStatus String No ConsoleProtection

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

  • 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 Managed instance

The 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.XX.XX.6

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 is attached.

LoadBalancerName String lb-bp1o94dp5i6ea****

The name of the CLB instance.

AddressIPVersion String ipv4

The IP protocol 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: a VPC
  • classic: a classic network
OrderId Long 202129619788910

The order ID of the subscription CLB instance.

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>
<LoadBalancerName>lb-bp1o94dp5i6ea****</LoadBalancerName>
<VpcId>vpc-25dvzy9****</VpcId>
<Address>42.XX.XX.6</Address>
<ResourceGroupId>rg-atstuj3rto****</ResourceGroupId>
<RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
<NetworkType>classic</NetworkType>
<AddressIPVersion>ipv4</AddressIPVersion>
<VSwitchId>vsw-255ecr****</VSwitchId>
<LoadBalancerId>lb-hddhfjg****</LoadBalancerId>
<OrderId>202129619788910</OrderId>
</reateLoadBalancerResponse>

JSON format

{
    "LoadBalancerName": "lb-bp1o94dp5i6ea****",
    "VpcId": "vpc-25dvzy9****",
    "Address": "42.XX.XX.6",
    "ResourceGroupId": "rg-atstuj3rto****",
    "RequestId": "365F4154-92F6-4AE4-92F8-7FF34B540710",
    "NetworkType": "classic",
    "AddressIPVersion": "ipv4",
    "VSwitchId": "vsw-255ecr****",
    "LoadBalancerId": "lb-hddhfjg****",
    "OrderId": 202129619788910
}

Error codes

HttpCode Error code Error message Description
400 InvalidVSwitchId.NotFound The specified vSwitch instance is invalid. The error message returned because the specified vSwitch is invalid.

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