All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Mar 14, 2024

Creates a Classic Load Balancer (CLB) instance.

Operation 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.
  • The pay-as-you-go billing method supports the pay-by-specification and pay-by-LCU metering methods.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
slb:CreateLoadBalancerWRITE
  • loadbalancer
    acs:slb:{#regionId}:{#accountId}:loadbalancer/*
  • slb:AddressType
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the CLB instance.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
AddressTypestringNo

The network type of the CLB instance. Valid values:

  • internet: After an Internet-facing CLB instance is created, the system assigns 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 assigns a private IP address to the CLB instance. Then, the CLB instance can forward requests only over the internal networks.
internet
InternetChargeTypestringNo

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

  • paybytraffic (default)
Note If you set the value to paybytraffic, you do not need to specify Bandwidth. Even if you specify 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 InternetChargeType to paybytraffic.
paybytraffic
BandwidthintegerNo

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 the maximum bandwidth of all listeners cannot exceed the maximum bandwidth of the CLB instance.

10
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests.

Note If you do not specify this parameter, the system uses the request ID as the client token. The request ID may be different for each request.
593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3
LoadBalancerNamestringNo

The CLB instance name.

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 you do not specify this parameter, the system automatically assigns a name to the CLB instance.

lb-bp1o94dp5i6ea****
VpcIdstringNo

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

vpc-bp1aevy8sofi8mh1****
VSwitchIdstringNo

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 specified, AddessType is set to intranet by default.

vsw-bp12mw1f8k3jgy****
MasterZoneIdstringNo

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.

cn-hangzhou-b
SlaveZoneIdstringNo

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.

cn-hangzhou-d
LoadBalancerSpecstringNo

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.

If InstanceChargeType is set to PayByCLCU, this parameter is invalid and you do not need to specify this parameter.

slb.s1.small
ResourceGroupIdstringNo

The ID of the resource group.

rg-atstuj3rtopt****
PayTypestringNo

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

PayOnDemand, which specifies the pay-as-you-go billing method.

PayOnDemand
PricingCyclestringNo

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

  • month
  • year
Note This parameter is supported only by subscription instances created on the Alibaba Cloud China site.
month
DurationintegerNo

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

  • If PricingCycle is set to month, the valid values are 1 to 9.
  • If PricingCycle is set to year, the valid values are 1 to 5.
Note This parameter is supported only by subscription instances created on the Alibaba Cloud China site.
1
AutoPaybooleanNo

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

  • true: automatically pays for the CLB instance. After you call this 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 is supported only by subscription instances created on the Alibaba Cloud China site.
true
AddressIPVersionstringNo

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

ipv4
AddressstringNo

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

192.168.XX.XX
Tagobject []No

The tags.

KeystringNo

The tag key of the bastion host. Valid values of N: 1 to 20. The tag key cannot be an empty string.

The tag key can be at most 64 characters in length, and cannot contain http:// or https://. It must not start with aliyun or acs:.

test
ValuestringNo

The tag value. Valid values of N: 1 to 20. The tag value can be an empty string.

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

value
DeleteProtectionstringNo

Specifies whether to enable deletion protection for the CLB instance. Valid values:

  • on
  • off
on
ModificationProtectionStatusstringNo

Specifies whether to enable the configuration read-only mode. 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.
Note If you set this parameter to ConsoleProtection, you cannot modify instance configurations in the CLB console. However, you can modify instance configurations by calling API operations.
ConsoleProtection
ModificationProtectionReasonstringNo

The reason for enabling the configuration read-only mode. The reason must be 1 to 80 characters in length. It must start with a letter and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

Note This parameter takes effect only when ModificationProtectionStatus is set to ConsoleProtection.
Managed instance
InstanceChargeTypestringNo

The metering method of the CLB instance. Valid values:

  • PayBySpec (default)
  • PayByCLCU
Note This parameter is supported only by instances created on the Alibaba Cloud China site and only when PayType is set to PayOnDemand.
PayBySpec

Response parameters

ParameterTypeDescriptionExample
object
VpcIdstring

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

vpc-25dvzy9****
AddressIPVersionstring

The IP version that is used by the CLB instance.

ipv4
VSwitchIdstring

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

vsw-255ecr****
RequestIdstring

The request ID.

365F4154-92F6-4AE4-92F8-7FF34B540710
LoadBalancerNamestring

The CLB instance name.

lb-bp1o94dp5i6ea****
LoadBalancerIdstring

The CLB instance ID.

lb-hddhfjg****
ResourceGroupIdstring

The ID of the resource group to which the CLB instance belongs.

rg-atstuj3rto****
Addressstring

The IP address that is allocated to the CLB instance.

42.XX.XX.6
NetworkTypestring

The network type of the CLB instance. Valid values:

  • vpc
  • classic
classic
OrderIdlong

The order ID of the subscription CLB instance.

20212961978****

Examples

Sample success responses

JSONformat

{
  "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": 0
}

Error codes

HTTP status codeError codeError messageDescription
400OperationFailed.ZoneResourceLimitThe operation failed because of resource limit of the specified zone.-
400CloudBoxNotSupportIpv6The cloudBox instance does not support ipv6.-
400CloudBoxNotSupportInternetThe cloudBox instance does not support internet.-
400OperationFailed.RegionResourceLimitThe operation failed because of resource limit of the specified region.-
400Operation.NotAllowedOperation Denied. The charge type of internet prepay instance can only be paybybandwidth.-
400Operation.NotAllowedOperation Denied. The charge type of intranet prepay instance can only be paybytraffic.-
400OperationFailed.UnpaidBillsExistThe account has unpaid bills. Please pay your overdue bill first.-
400RegionOrZonesNotSupportIpv6The specified region or master/slave zones does not support ipv6.-
400InvalidParameter.MismatchAddressType and IpVersion is conflict, IPv6 does not support intranet instance.-
400PAYFOR.CREDIT_PAY_INSUFFICIENT_BALANCEYour account does not have enough balance.-
400HighRiskOperationDeniedThe operation is denied because of high risk.-
400VSwitchAvailableIpNotExistThe specified VSwitch has no availabe ip.-
400VSwitchNotExistThe specified VSwitch does not exist.-
400InvalidParameterIllegal parameter. The IP address is not in subnet.-
400Instance.ShareSlbNotSupportPay95Illegal parameter. The share instance not support PayBy95 or PayByOld95.-
400Instance.Pay95RateInvalidIllegal parameter. The rate is illegal.-
400Instance.Pay95BandwidthIllegalIllegal parameter. The bandwidth is illegal.-
400Instance.InternetChargeTypeNotAllowedIllegal parameter. The specified InternetChargeType not allowed.-
400OperationFailed.TokenIsProcessingThe operation is failed, because the Client Token is processing.-
400InsufficientBalanceYour account does not have enough balance.Your account balance is insufficient. Top up your account and try again.
400MissingParam.VSwitchIdThe parameter VSwitchId is required.-
400InvalidVpcId.NotExistThe specified VPC not exist.-
400PAY.MAYI_WITHHOLDING_AGREEMENT_ILLEGALYour account did not sign a withholding agreement or no coupons in Alipay.-
400InvalidParameter.CloudTypeThe specified CloudType is invalid.-
400OperationFailed.InvalidAccountThe account information is incomplete.-
400RegionOrZonesNotSupportCENThe specified region or master/slave zones does not support cloudType of hybrid_cen.-
400MissingParam.LoadBalancerSpecThe param LoadBalancerSpec is required.-
400InvalidParameter.BandwidthThe param Bandwidth is invalid.-
400OperationForbidden.AccountRiskRejectThe operation failed because of account risk reject.-
400OperationForbidden.QuotaLimitThe operation failed because of quota limit of shared loadbalancers.-
400InvalidParam.ModificationProtectionStatusThe param ModificationProtectionStatus is invalid.-
400InvalidParam.ModificationProtectionReasonThe param ModificationProtectionReason is invalid.-
400InvalidParam.ModificationProtectionReason%s.-
400ShareSlbHaltSalesThe share instance has been discontinued.-
400OperationFailed.CashBookInsufficientNo payment method is specified for your account, We recommend that you add a payment method or maintain a prepayment balance.-
400OperationFailed.OnlyInnerCommoditySupportToPurchaseAliCroup2Cloud user only can buy inner commodity.-
400OperationFailed.InvokeLingXiaoFailedFailed to invoke lingxiao service.-
400AllocateVpcInstanceFailedFailed to allocate vpc instance.-
400QueryCreditCtrlInfoFailedFailed to query credit ctrl info.-
400QueryCommodityCenterFailedFailed to query commodity center.-
400RegionNotSupportParameterCurrent region does not support the param of %s.-
400QueryAccountBookInfoFailedFailed to invoke account book info.-
400RateAccountFailedFailed to rate account for pricing.-
400TradeWaitDistributorAuditThe trade needs distributor to audit.-
400OperationFailed.InvokeProxyFailedFailed to invoke proxy.-
400QueryAccountCompleteProgressFailedFailed to query account progress.-
400QueryVoucherInfoFailedFailed to query voucher info.-
400InvalidVSwitchId.NotFoundThe specified vSwitch instance is invalid.The current specified vswitch instance is illegal.
400IllegalParam.SpecTypeThe param of SpecType is illegal.-
400MissingParam.SpecTypeThe param of SpecType is missing.-
400UnsupportedRegionThe feature is not supported in current region.-
400PayInsufficientBalanceYour account balance is insufficient.-
400IllegalParam.InstanceChargeTypeThe parameter InstanceChargeType is illegal.-
400SystemBusyThe system is busy.The service is unavailable. Please try again later.
400PRODUCT.NOT_AVAILABLE_IZThe Instance zone id doesn t support-
400PRICE.INQUIRY_FAILEDThe instance pricing inquiry is failed.-
400AssociateIpFailThe instance associating ip is failed.-
400SDK.ServerUnreachableService is unreachable.-
400OverQuotaThe Total is over the quotaTotal amount has reach the limit. Reduce the quantity and try again.
400InvalidParam.TagValue %s.-
400InvalidParam.TagKey%s.-
400SizeLimitExceeded.Tag%s.-
400MissingParam.TagKeyThe param MissingParam.TagKey is missing.-
400SubnetIpExhaustNo subnet IP addresses are available.No subnet IP address is available.
400BeforePayRuleBatchValidateErrorThe pre-payment rule center instance rule validation failed. Please check if the instance limit has been reached.-
400TradeSyncCreateSubErrorSubscription transfer failed.-
400QueryOrderErrorFailed to query the order. Please try again later.-
400CreateOrderTimeoutOrder creation timed out. Please try again later.-
400MultiGrayKeyResourceInconsistThe identifier for the gray resource is set incorrectly.-
400InsufficientAvailableQuotaYour account available balance is less than 0. Please recharge before attempting to make a purchase.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-01-26The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-09-26The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-09-08The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-06-06The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-06-06The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
2023-06-02The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400