All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Jun 27, 2025

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.

  • Pay-as-you-go CLB instances only support the pay-by-LCU instance resource metering method. As of 00:00:00 (UTC+8) on June 1, 2025, pay-by-specification CLB instances are no longer available for purchase. For more details, see End-of-sale for pay-by-specification CLB instances.

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 region ID of the CLB instance.

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

cn-hangzhou

AddressType

string

No

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 instance. 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. The CLB instance can forward requests only within the VPC.

internet

InternetChargeType

string

No

The Internet data transfer metering method for the Internet-facing CLB instance. Valid values:

  • paybytraffic (default): pay-by-data-transfer

  • paybybandwidth: pay-by-bandwidth

Note
  • If you set PayType to PayOnDemand and InstanceChargeType to PayByCLCU, the only valid value for InternetChargeType is paybytraffic.

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

paybytraffic

Bandwidth

integer

No

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 a maximum bandwidth for each listener. The sum of the maximum bandwidth of all listeners cannot exceed the maximum bandwidth of the CLB instance.

10

ClientToken

string

No

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

LoadBalancerName

string

No

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****

VpcId

string

No

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

vpc-bp1aevy8sofi8mh1****

VSwitchId

string

No

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.

Note

The vSwitch must be in the primary zone.

vsw-bp12mw1f8k3jgy****

MasterZoneId

string

No

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

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

Note

The primary zone must be the zone where the vSwitch resides.

cn-hangzhou-b

SlaveZoneId

string

No

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

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

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
  • If InstanceChargeType is set to PayByCLCU, this parameter is invalid and you do not need to specify this parameter.

  • As of 00:00:00 (UTC+8) on June 1, 2025, pay-by-specification CLB instances are no longer available for purchase. For more details, see End-of-sale for pay-by-specification CLB instances.

slb.s1.small

ResourceGroupId

string

No

The ID of the resource group.

rg-atstuj3rtopt****

PayTypedeprecated

string

No

The billing method of the CLB instance. Valid value:

PayOnDemand: pay-as-you-go.

PayOnDemand

PricingCycledeprecated

string

No

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

Durationdeprecated

integer

No

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

AutoPaydeprecated

boolean

No

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

  • true: yes. The CLB instance is created after you call the API operation.

  • false (default): After you call the operation, the order is created but the payment is not completed. You can view pending orders in the console. The CLB instance will not be created until you complete the payment.

Note

This parameter takes effect only for subscription CLB instances created on the Alibaba Cloud China site.

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 CLB instance. The private IP address must belong to the destination CIDR block of the vSwitch.

192.168.XX.XX

Tag

array

No

The tags.

object

No

The tags.

Key

string

No

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

Value

string

No

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

DeleteProtection

string

No

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

  • on

  • off

on

ModificationProtectionStatus

string

No

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

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

Note

This parameter takes effect only when ModificationProtectionStatus is set to ConsoleProtection.

Managed instance

InstanceChargeType

string

No

The resource metering method for the CLB instance. Valid value:

  • PayByCLCU: pay-by-data-transfer

Note

As of 00:00:00 (UTC+8) on June 1, 2025, pay-by-specification CLB instances are no longer available for purchase. For more details, see End-of-sale for pay-by-specification CLB instances.

PayBySpec

Response parameters

Parameter

Type

Description

Example

object

VpcId

string

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

vpc-25dvzy9****

AddressIPVersion

string

The IP version that is used by the CLB instance.

ipv4

VSwitchId

string

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

vsw-255ecr****

RequestId

string

The request ID.

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

LoadBalancerName

string

The CLB instance name.

lb-bp1o94dp5i6ea****

LoadBalancerId

string

The CLB instance ID.

lb-hddhfjg****

ResourceGroupId

string

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

rg-atstuj3rto****

Address

string

The IP address that is allocated to 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 order ID of the subscription CLB 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.