Creates a Server Load Balancer (SLB) instance.

Before you call this operation, take note of the following limits:

  • Before you create an SLB instance, call the DescribeAvailableResource operation to query the resources available for purchase in the region where you want to create the SLB instance.
  • After an SLB instance is created, you are charged for using the SLB instance.
  • If you do not set LoadBalancerSpec, a shared-resource SLB instance is created. We recommend that you set LoadBalancerSpec to specify the specification of the SLB 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 SLB instance.

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

AddressType String No internet

The type of IP address that the SLB instance uses to provide services. Valid values:

  • internet: After an Internet-facing SLB instance is created, the system assigns a public IP address to the SLB instance. Then, the SLB instance can forward requests from the Internet.
  • intranet: After an internal-facing SLB instance is created, the system assigns a private IP address to the SLB instance. Then, the SLB instance can forward only internal requests.
InternetChargeType String No paybytraffic

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

  • paybytraffic (default): pay-by-data-transfer
Bandwidth Integer No 10

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

Valid values: -1 and 1 to 5120.

  • -1: For a pay-by-data-transfer Internet-facing SLB instance, you can set the value to -1. This indicates that the bandwidth is unlimited.
  • 1 to 5120: For a pay-by-bandwidth Internet-facing SLB instance, you can specify a bandwidth cap for each listener. The sum of bandwidth limit values of all listeners cannot exceed the maximum bandwidth value of the SLB instance.

ClientToken String No 5A2CFF0E-5718-*******45B5-9D4D-70B3FF3898

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. The token can contain only ASCII characters and cannot exceed 64 characters in length.

LoadBalancerName String No lb-bp1o94dp5i6ea****

The name of the SLB 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 SLB instance.

VpcId String No vpc-bp1aevy8sofi8mh1****

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

VSwitchId String No vsw-bp12mw1f8k3jgy****

The ID of the vSwitch to which the SLB instance is attached.

To create an SLB instance that is deployed in a VPC, you must set this parameter. If you specify this parameter, the value of the AddessType parameter is set to intranet by default.

MasterZoneId String No cn-hangzhou-b

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

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

SlaveZoneId String No cn-hangzhou-d

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

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

LoadBalancerSpec String No slb.s2.small

The specification of the SLB instance. Valid values:

  • slb.s1.small
  • slb.s2.small
  • slb.s2.medium
  • slb.s3.small
  • slb.s3.medium
  • slb.s3.large

The types of SLB instance that you can create vary by region.

The following regions support high-performance SLB instances: China (Qingdao), China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Zhangjiakou), China (Hohhot), Singapore (Singapore), UK (London), Germany (Frankfurt), Australia (Sydney), Malaysia (Kuala Lumpur), UAE (Dubai), Indonesia (Jakarta), US (Silicon Valley), India (Mumbai), Japan (Tokyo), China (Hong Kong), and US (Virginia).

Note If you do not set this parameter, a shared-resource SLB instance is created.
ResourceGroupId String No rg-atstuj3rtopt****

The ID of the enterprise resource group.

PayType String No PayOnDemand

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

  • PayOnDemand: You are charged on a pay-as-you-go basis.
PricingCycle String No month

The billing cycle of the Internet-facing SLB instance. Valid values: month and year.

Note This parameter is valid only when you create a subscription SLB 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 SLB instance. Valid values:

  • If you set PricingCycle to month: Valid values: 1 to 9.
  • If you set PricingCycle to year: Valid values: 1 to 3.
Note This parameter is valid only when you create a subscription SLB 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 SLB instance. Valid values:

  • true: automatically pays for the subscription Internet-facing SLB instance. After you call the operation, the system automatically completes the payment and creates the SLB 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 SLB instance will not be created until you complete the payment.

This parameter is valid only when you create a subscription SLB 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 that is used by the SLB instance. Valid values: ipv4 and ipv6.

Address String No 192.XX.XX.06

The private IP address of the SLB 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 SLB instance.

ModificationProtectionStatus String No ConsoleProtection

Specifies whether to enable the configuration read-only mode for the SLB 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 ManageInstance

Enter a 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 SLB instance.

Address String 42.XX.XX.06

The IP address that is allocated to the SLB instance.

VpcId String vpc-25dvzy9****

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

VSwitchId String vsw-255ecr****

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

LoadBalancerName String lb-bp1o94dp5i6ea****

The name of the SLB instance.

AddressIPVersion String ipv4

The IP version that is used by the SLB instance.

NetworkType String classic

The type of network where the SLB instance is deployed. Valid values: vpc and classic.

  • vpc: indicates that the SLB instance is deployed in a VPC.
  • classic: indicates that the SLB instance is deployed in a classic network.
OrderId Long 201429619788910

The ID of the order.

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>
    <NetworkType>vpc</NetworkType>
	  <LoadBalancerName>lb-bp1o94dp5i6ea*******</LoadBalancerName>
	  <Address>192.168.0.**</Address>
	  <ResourceGroupId>rg-acfmxazb***</ResourceGroupId>
	  <RequestId>AB197CF0-D9E9-4475-A89D-35DBCCF13BBE</RequestId>
	  <AddressIPVersion>ipv4</AddressIPVersion>
	  <LoadBalancerId>lb-bp1b6c719dfa0***</LoadBalancerId>
	  <VSwitchId>vsw-bp12mw1f8k3jgygk9****</VSwitchId>
	  <VpcId>vpc-bp1aevy8sofi8mh1q***</VpcId>
</CreateLoadBalancerResponse>

JSON format

{
    "NetworkType": "vpc",
    "LoadBalancerName": "lb-bp1o94dp5i6ea*******",
    "Address": "192.168.0.**",
    "ResourceGroupId": "rg-acfmxazb4ph****",
    "RequestId": "AB197CF0-D9E9-4475-A89D-35DBCCF13BBE",
    "AddressIPVersion": "ipv4",
    "LoadBalancerId": "lb-bp1b6c719dfa08ex****",
    "VSwitchId": "vsw-bp12mw1f8k3jgygk9****",
    "VpcId": "vpc-bp1aevy8sofi8mh1****"
}

Error codes

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