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.

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 deploy 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 over 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 requests within the internal networks.
InternetChargeType String No paybytraffic

The metering method of the Internet-facing CLB instance. Valid values:

  • paybytraffic (default): pay-by-data-transfer
    Note If you set the value to paybytraffic, you do not need to set Bandwidth. Even if you set Bandwidth, the value does not take effect.
  • paybybandwidth: pay-by-bandwidth
Note If you set PayType to PayOnDemand and set InstanceChargeType to PayByCLCU, you must set the InternetChargeType parameter to paybytraffic.
Bandwidth Integer No 10

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

Valid values: 1 to 5120. For a pay-by-bandwidth Internet-facing CLB instance, you can specify the maximum bandwidth of each listener. The sum of maximum bandwidth of all listeners cannot exceed the maximum bandwidth of the CLB instance.

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

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.

Note If you do not set this parameter, the system automatically uses RequestId as ClientToken. RequestId may be different for each API request.
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.

By default, if you do not set this parameter, the system automatically assigns a name to 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 belongs.

If you want to deploy the CLB instance in a VPC, this parameter is required. 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 set this parameter, a shared-resource CLB instance is created. Shared-resource CLB instances are no longer available for purchase. Therefore, you must set this parameter.
Note If InstanceChargeType is set to PayByCLCU, the LoadBalancerSpec parameter is invalid and you do not need to set this parameter.
ResourceGroupId String No rg-atstuj3rtopt****

The ID of the 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 Internet-facing CLB instance. Valid values:

  • month
  • year
Note This parameter takes effect 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 takes effect 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 CLB instance. After you call the operation, the system automatically completes the payment and creates the CLB instance.
  • false (default): After you call the operation, the order is created but the payment is not completed. You can view the pending order in the console. The CLB instance will not be created until you complete the payment.
Note This parameter takes effect 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 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.

  • 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 takes effect only when ModificationProtectionStatus is set to ConsoleProtection.

Response parameters

Parameter Type Example Description
VpcId String vpc-25dvzy9****

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

AddressIPVersion String ipv4

The IP version that is used by the CLB instance.

VSwitchId String vsw-255ecr****

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

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

The ID of the request.

LoadBalancerName String lb-bp1o94dp5i6ea****

The name of the CLB instance.

LoadBalancerId String lb-hddhfjg****

The ID of the CLB instance.

ResourceGroupId String rg-atstuj3rto****

The ID of the resource group.

Address String 42.XX.XX.6

The IP address that is allocated to 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.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateLoadBalancer
&RegionId=cn-hangzhou
&AddressType=internet
&InternetChargeType=paybytraffic
&Bandwidth=10
&ClientToken=593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3
&LoadBalancerName=lb-bp1o94dp5i6ea****
&VpcId=vpc-bp1aevy8sofi8mh1****
&VSwitchId=vsw-bp12mw1f8k3jgy****
&MasterZoneId=cn-hangzhou-b
&SlaveZoneId=cn-hangzhou-d
&LoadBalancerSpec=slb.s1.small
&ResourceGroupId=rg-atstuj3rtopt****
&PayType=PayOnDemand
&PricingCycle=month
&Duration=1
&AutoPay=true
&AddressIPVersion=ipv4
&Address=192.168.XX.XX
&DeleteProtection=on
&ModificationProtectionStatus=ConsoleProtection
&ModificationProtectionReason=Managed instance
&InstanceChargeType=PayBySpec
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

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

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HttpCode Error code Error message Description
400 OperationFailed.ZoneResourceLimit The operation failed because of resource limit of the specified zone. The error message returned because the resources in the current zone are insufficient.
400 CloudBoxNotSupportIpv6 The cloudBox instance does not support ipv6. The error message returned because cloud boxes do not support IPv6.
400 CloudBoxNotSupportInternet The cloudBox instance does not support internet. The error message returned because cloud boxes do not support Internet-facing services.
400 OperationFailed.RegionResourceLimit The operation failed because of resource limit of the specified region. The error message returned because the resources in the specified region are insufficient.
400 Operation.NotAllowed Operation Denied. The charge type of internet prepay instance can only be paybybandwidth. The error message returned because a subscription Internet-facing CLB instance supports only the pay-by-bandwidth metering method.
400 Operation.NotAllowed Operation Denied. The charge type of intranet prepay instance can only be paybytraffic. The error message returned because a subscription internal-facing CLB instance supports only the pay-by-data-transfer metering method.
400 OperationFailed.UnpaidBillsExist The account has unpaid bills. Please pay your overdue bill first. The error message returned because you cannot perform the operation when an existing payment within your account is unsettled. Settle the overdue payment and try again.
400 RegionOrZonesNotSupportIpv6 The specified region or master/slave zones does not support ipv6. The error message returned because the specified region, primary zone, or secondary zone does not support IPv6.
400 InvalidParameter.Mismatch AddressType and IpVersion is conflict, IPv6 does not support intranet instance. The error message returned because an internal-facing CLB instance does not support IPv6.
400 HighRiskOperationDenied The operation is denied because of high risk. The error message returned because the operation is risky.
400 VSwitchAvailableIpNotExist The specified VSwitch has no availabe ip. The error message returned because the IP addresses of the vSwitch are unavailable.
400 VSwitchNotExist The specified VSwitch does not exist. The error message returned because the specified vSwitch does not exist.
400 InvalidParameter Illegal parameter. The IP address is not in subnet. The error message returned because the IP address does not belong to the specified subnet.
400 Instance.ShareSlbNotSupportPay95 Illegal parameter. The share instance not support PayBy95 or PayByOld95. The error message returned because a shared-resource CLB instance does not support PayBy95 or PayByOld95.
400 Instance.Pay95RateInvalid Illegal parameter. The rate is illegal. The error message returned because the specified rate is invalid. Specify a valid value and try again.
400 Instance.Pay95BandwidthIllegal Illegal parameter. The bandwidth is illegal. The error message returned because the specified bandwidth is invalid. Specify a valid value and try again.
400 Instance.InternetChargeTypeNotAllowed Illegal parameter. The specified InternetChargeType not allowed. The error message returned because InternetChargeType is set to an invalid value.
400 OperationFailed.TokenIsProcessing The operation is failed, because the Client Token is processing. The error message returned because the current request is being processed.
400 MissingParam.VSwitchId The parameter VSwitchId is required. The error message returned because VSwitchId is not specified.
400 InvalidVpcId.NotExist The specified VPC not exist. The error message returned because the specified VPC does not exist.
400 InvalidParameter.CloudType The specified CloudType is invalid. The error message returned because CloudType is set to an invalid value. Specify a valid value and try again.
400 OperationFailed.InvalidAccount The account information is incomplete. The error message returned because the account information is incomplete.
400 RegionOrZonesNotSupportCEN The specified region or master/slave zones does not support cloudType of hybrid_cen. The error message returned because the specified region, primary zone, or secondary zone does not support Cloud Enterprise Network (CEN).
400 MissingParam.LoadBalancerSpec The param LoadBalancerSpec is required. The error message returned because LoadBalancerSpec is not specified.
400 InvalidParameter.Bandwidth The param Bandwidth is invalid. The error message returned because the specified bandwidth is invalid. Specify a valid value and try again.
400 OperationForbidden.AccountRiskReject The operation failed because of account risk reject. The error message returned because the current account is locked.
400 OperationForbidden.QuotaLimit The operation failed because of quota limit of shared loadbalancers. The error message returned because the number of shared-resource instances has reached the upper limit.
400 InvalidParam.ModificationProtectionStatus The param ModificationProtectionStatus is invalid. The error message returned because ModificationProtectionStatus is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.ModificationProtectionReason The param ModificationProtectionReason is invalid. The error message returned because ModificationProtectionReason is set to an invalid value. Specify a valid value and try again.
400 InvalidParam.ModificationProtectionReason %s. The error message returned because ModificationProtectionReason is set to an invalid value. Specify a valid value and try again.
400 ShareSlbHaltSales The share instance has been discontinued. The error message returned because shared-resource CLB instances are no longer available for purchase.
400 OperationFailed.CashBookInsufficient No payment method is specified for your account, We recommend that you add a payment method or maintain a prepayment balance. The error message returned because you did not specify a payment method. We recommend that you add a payment method or keep a sufficient account balance.
400 OperationFailed.OnlyInnerCommoditySupportToPurchase AliCroup2Cloud user only can buy inner commodity. The error message returned because you can purchase only internal products.
400 OperationFailed.InvokeLingXiaoFailed Failed to invoke lingxiao service. The error message returned because the system failed to call the Lingxiao service.
400 AllocateVpcInstanceFailed Failed to allocate vpc instance. The error message returned because the system failed to deploy the CLB instance in the VPC.
400 QueryCreditCtrlInfoFailed Failed to query credit ctrl info. The error message returned because the system failed to obtain the user information.
400 QueryCommodityCenterFailed Failed to query commodity center. The error message returned because the system failed to obtain information from the transaction center.
400 RegionNotSupportParameter Current region does not support the param of %s. The error message returned because the parameter is not supported in the current region.
400 QueryAccountBookInfoFailed Failed to invoke account book info. The error message returned because the system failed to obtain the ledger information.
400 RateAccountFailed Failed to rate account for pricing. The error message returned because the system failed to call the pricing service.
400 TradeWaitDistributorAudit The trade needs distributor to audit. The error message returned because the transaction is pending for review by the service provider.
400 OperationFailed.InvokeProxyFailed Failed to invoke proxy. The error message returned because the system failed to call the proxy.
400 QueryAccountCompleteProgressFailed Failed to query account progress. The error message returned because the system failed to query the account progress.
400 QueryVoucherInfoFailed Failed to query voucher info. The error message returned because the system failed to obtain the credentials.
400 InvalidVSwitchId.NotFound The specified vSwitch instance is invalid. The error message returned because the specified vSwitch is invalid.
400 IllegalParam.SpecType The param of SpecType is illegal. The error message returned because SpecType is set to an invalid value. Specify a valid value and try again.
400 MissingParam.SpecType The param of SpecType is missing. The error message returned because SpecType is not specified.
400 UnsupportedRegion The feature is not supported in current region. The error message returned because the feature is not supported in the current region.
400 PayInsufficientBalance Your account balance is insufficient. The error message returned because the balance in your account is insufficient.
400 IllegalParam.InstanceChargeType The parameter InstanceChargeType is illegal. The error message returned because InstanceChargeType is set to an invalid value.
503 SDK.ServerUnreachable Service is unreachable. The error message returned because the system failed to access the service. Try again later.

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