All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Aug 11, 2025

Creates a Classic Load Balancer (CLB) instance.

Operation description

Note

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that support authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

slb:CreateLoadBalancer

create

*LoadBalancer

acs:slb:{#regionId}:{#accountId}:loadbalancer/*

slb:AddressType
None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region for the CLB instance.

You can call the DescribeRegions operation to query available regions.

cn-hangzhou

AddressType

string

No

The network type of the CLB instance. Valid values:

  • internet: The system assigns a public IP address to the CLB instance. The CLB instance can forward requests over the Internet.

  • intranet: The system assigns a private IP address to the CLB instance. The CLB instance can forward requests only within the VPC.

internet

InternetChargeType

string

No

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

  • paybytraffic (default): pay-by-traffic.

  • paybybandwidth: pay-by-bandwidth.

Note
  • If PayType is set to PayOnDemand and InstanceChargeType is set to PayByCLCU, you must set this parameter to paybytraffic.

  • If you set this parameter to paybytraffic, you do not need to specify the Bandwidth parameter. The value of Bandwidth does not take effect even if you specify one.

paybytraffic

Bandwidth

integer

No

The peak bandwidth of the CLB instance. Unit: Mbit/s.

Valid values: 1 to 5000.

Note

This parameter is required only if AddressType is set to internet and InternetChargeType is set to paybybandwidth.

10

ClientToken

string

No

A client token. It 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 RequestId as the ClientToken. The RequestId may be different for each request.

593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3

LoadBalancerName

string

No

The name of the CLB instance.

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

If you do not specify this parameter, the system automatically assigns a name to the instance.

lb-bp1o94dp5i6ea****

VpcId

string

No

The ID of the VPC where the CLB instance is deployed.

vpc-bp1aevy8sofi8mh1****

VSwitchId

string

No

The ID of the vSwitch for the CLB instance.

If you want to create a CLB instance in a VPC, this parameter is required. If you specify this parameter, the AddressType parameter is set to intranet by default.

Note

Make sure that the vSwitch is in the same zone as the primary zone.

vsw-bp12mw1f8k3jgy****

MasterZoneId

string

No

The ID of the primary zone of the CLB instance.

You can call the DescribeZone operation to query the primary and secondary zones in the specified region.

Note

Make sure that the primary zone is the same zone as the vSwitch.

cn-hangzhou-b

SlaveZoneId

string

No

The ID of the secondary zone of the CLB instance.

You can call the DescribeZone operation to query the primary and secondary zones in the specified region.

cn-hangzhou-d

LoadBalancerSpec

string

No

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

slb.s1.small

ResourceGroupId

string

No

The ID of the resource group.

rg-atstuj3rtopt****

PayType deprecated

string

No

The billing method of the instance. Valid value:

  • PayOnDemand: pay-as-you-go.

PayOnDemand

PricingCycle deprecated

string

No

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

  • month

  • year

Note

This parameter is valid only for subscription instances that are created on the Alibaba Cloud China site (aliyun.com).

month

Duration deprecated

integer

No

The subscription duration of the subscription Internet-facing 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 5.

Note

This parameter is valid only for subscription instances that are created on the Alibaba Cloud China site (aliyun.com).

1

AutoPay deprecated

boolean

No

Specifies whether to enable automatic payment for the subscription Internet-facing instance. Valid values:

  • true: enables automatic payment. After you call the operation, the SLB instance is immediately created.

  • false (default): After you call the operation, an order is created but is not paid. You can view the unpaid order in the console. The SLB instance is not created until the order is paid.

Note

This parameter is valid only for subscription instances that are created on the Alibaba Cloud China site (aliyun.com).

true

AddressIPVersion

string

No

The IP version of the CLB instance. Valid values: ipv4 and ipv6.

ipv4

Address

string

No

The private IP address of the internal-facing CLB instance. The IP address must be within the CIDR block of the vSwitch.

192.168.XX.XX

Tag

array<object>

No

The tags of the instance.

object

No

The tags.

Key

string

No

The tag key. You can specify up to 20 tag keys. The tag key cannot be an empty string.

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

test

Value

string

No

The tag value. You can specify up to 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with aliyun or acs:. It cannot contain http:// or https://.

value

DeleteProtection

string

No

Specifies whether to enable deletion protection. Valid values:

  • on: yes.

  • off: no.

on

ModificationProtectionStatus

string

No

The configuration read-only mode of the CLB instance. Valid values:

  • NonProtection: disables the configuration read-only mode. In this case, the value of ModificationProtectionReason is cleared.

  • ConsoleProtection: enables the configuration read-only mode in the console.

Note

If you set this parameter to ConsoleProtection, you cannot modify the instance configuration in the CLB console. However, you can modify the instance configuration by calling API operations.

ConsoleProtection

ModificationProtectionReason

string

No

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 or a Chinese character, and can contain digits, periods (.), underscores (_), and hyphens (-).

Note

This parameter is required only if ModificationProtectionStatus is set to ConsoleProtection.

Managed instance

InstanceChargeType

string

No

The billing method for the instance.

Valid value: PayByCLCU (pay-by-LCU).

Note

PayBySpec

Response parameters

Parameter

Type

Description

Example

object

VpcId

string

The ID of the VPC where the CLB instance is deployed.

vpc-25dvzy9****

AddressIPVersion

string

The IP version of the CLB instance.

ipv4

VSwitchId

string

The ID of the vSwitch for the CLB instance.

vsw-255ecr****

RequestId

string

The ID of the request.

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

LoadBalancerName

string

The name of the CLB instance.

lb-bp1o94dp5i6ea****

LoadBalancerId

string

The ID of the CLB instance.

lb-hddhfjg****

ResourceGroupId

string

The ID of the resource group.

rg-atstuj3rto****

Address

string

The service IP address of the CLB instance.

42.XX.XX.6

NetworkType

string

The network type of the CLB instance. Valid values:

  • vpc: VPC.

  • classic: classic network.

classic

OrderId

integer

The ID of the order for the subscription instance.

20212961978****

Examples

Success response

JSON format

{
  "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 code

Error code

Error message

Description

400 OperationFailed.ZoneResourceLimit The operation failed because of resource limit of the specified zone.
400 CloudBoxNotSupportIpv6 The cloudBox instance does not support ipv6.
400 CloudBoxNotSupportInternet The cloudBox instance does not support internet.
400 OperationFailed.RegionResourceLimit The operation failed because of resource limit of the specified region.
400 Operation.NotAllowed Operation Denied. The charge type of internet prepay instance can only be paybybandwidth.
400 OperationFailed.UnpaidBillsExist The account has unpaid bills. Please pay your overdue bill first.
400 RegionOrZonesNotSupportIpv6 The specified region or master/slave zones does not support ipv6.
400 InvalidParameter.Mismatch AddressType and IpVersion is conflict, IPv6 does not support intranet instance.
400 PAYFOR.CREDIT_PAY_INSUFFICIENT_BALANCE Your account does not have enough balance.
400 HighRiskOperationDenied The operation is denied because of high risk.
400 VSwitchAvailableIpNotExist The specified VSwitch has no availabe ip.
400 VSwitchNotExist The specified VSwitch does not exist.
400 InvalidParameter Illegal parameter. The IP address is not in subnet.
400 Instance.ShareSlbNotSupportPay95 Illegal parameter. The share instance not support PayBy95 or PayByOld95.
400 Instance.Pay95RateInvalid Illegal parameter. The rate is illegal.
400 Instance.Pay95BandwidthIllegal Illegal parameter. The bandwidth is illegal.
400 Instance.InternetChargeTypeNotAllowed Illegal parameter. The specified InternetChargeType not allowed.
400 OperationFailed.TokenIsProcessing The operation is failed, because the Client Token is processing.
400 InsufficientBalance Your account does not have enough balance. Your account balance is insufficient. Top up your account and try again.
400 MissingParam.VSwitchId The parameter VSwitchId is required.
400 InvalidVpcId.NotExist The specified VPC not exist.
400 PAY.MAYI_WITHHOLDING_AGREEMENT_ILLEGAL Your account did not sign a withholding agreement or no coupons in Alipay.
400 InvalidParameter.CloudType The specified CloudType is invalid.
400 OperationFailed.InvalidAccount The account information is incomplete.
400 RegionOrZonesNotSupportCEN The specified region or master/slave zones does not support cloudType of hybrid_cen.
400 MissingParam.LoadBalancerSpec The param LoadBalancerSpec is required.
400 InvalidParameter.Bandwidth The param Bandwidth is invalid.
400 OperationForbidden.AccountRiskReject The operation failed because of account risk reject.
400 OperationForbidden.QuotaLimit The operation failed because of quota limit of shared loadbalancers.
400 InvalidParam.ModificationProtectionStatus The param ModificationProtectionStatus is invalid.
400 InvalidParam.ModificationProtectionReason The param ModificationProtectionReason is invalid.
400 ShareSlbHaltSales The share instance has been discontinued.
400 OperationFailed.CashBookInsufficient No payment method is specified for your account, We recommend that you add a payment method or maintain a prepayment balance.
400 OperationFailed.OnlyInnerCommoditySupportToPurchase AliCroup2Cloud user only can buy inner commodity.
400 OperationFailed.InvokeLingXiaoFailed Failed to invoke lingxiao service.
400 AllocateVpcInstanceFailed Failed to allocate vpc instance.
400 QueryCreditCtrlInfoFailed Failed to query credit ctrl info.
400 QueryCommodityCenterFailed Failed to query commodity center.
400 RegionNotSupportParameter Current region does not support the param of %s.
400 QueryAccountBookInfoFailed Failed to invoke account book info.
400 RateAccountFailed Failed to rate account for pricing.
400 TradeWaitDistributorAudit The trade needs distributor to audit.
400 OperationFailed.InvokeProxyFailed Failed to invoke proxy.
400 QueryAccountCompleteProgressFailed Failed to query account progress.
400 QueryVoucherInfoFailed Failed to query voucher info.
400 InvalidVSwitchId.NotFound The specified vSwitch instance is invalid. The current specified vswitch instance is illegal.
400 IllegalParam.SpecType The param of SpecType is illegal.
400 MissingParam.SpecType The param of SpecType is missing.
400 UnsupportedRegion The feature is not supported in current region.
400 PayInsufficientBalance Your account balance is insufficient.
400 IllegalParam.InstanceChargeType The parameter InstanceChargeType is illegal.
400 SystemBusy The system is busy. System Busy
400 PRODUCT.NOT_AVAILABLE_IZ The Instance zone id doesn t support
400 PRICE.INQUIRY_FAILED The instance pricing inquiry is failed.
400 AssociateIpFail The instance associating ip is failed.
400 SDK.ServerUnreachable Service is unreachable.
400 OverQuota The Total is over the quota Total amount has reach the limit. Reduce the quantity and try again.
400 InvalidParam.TagValue %s.
400 InvalidParam.TagKey %s.
400 SizeLimitExceeded.Tag %s.
400 MissingParam.TagKey The param MissingParam.TagKey is missing.
400 SubnetIpExhaust No subnet IP addresses are available. No subnet IP address is available.
400 BeforePayRuleBatchValidateError The pre-payment rule center instance rule validation failed. Please check if the instance limit has been reached.
400 TradeSyncCreateSubError Subscription transfer failed.
400 QueryOrderError Failed to query the order. Please try again later.
400 CreateOrderTimeout Order creation timed out. Please try again later.
400 MultiGrayKeyResourceInconsist The identifier for the gray resource is set incorrectly.
400 InsufficientAvailableQuota Your account available balance is less than 0. Please recharge before attempting to make a purchase.
400 Forbidden.AliGroupForbiddenRegion Thre region is forbidden for aligroup user.
403 SecurityRisk.AuthVerification We have detected a security risk with your payment method. Please proceed with verification via the link in your email or console message and re-submit your order after verification. We have detected a security risk with your payment method. Please proceed with verification via the link in your email or console message and re-submit your order after verification.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.