Creates an SLB instance.

Before you call this API, note the following:

  • After an SLB instance is created, fees are incurred.
  • If you do not specify the instance specification (LoadBalancerSpec), a shared-performance instance is created. Therefore, we recommend that you call the LoadBalancerSpec API to specify the instance specification when you create an SLB instance.

Debug

Use OpenAPI Explorer to perform debug operations and generate SDK code examples.

Request parameters

Parameter Type Required? Example value Description
Action String Yes CreateLoadBalancer

The name of this action.

Value: CreateLoadBalancer

RegionId String Yes cn-hangzhou-d

The region ID of the SLB instance to be created.

To query the region ID of an SLB instance, call DescribeRegions.

Address String No 192.168.0.1

Optional. The private IP address of the SLB instance, which must belong to the destination CIDR block of the corresponding switch.

AddressIPVersion String No ipv4

Optional. The IP version of the SLB instance to be created, which can be set to ipv4 or ipv6.

AddressType String No internet

Optional. The network type of the SLB instance. Valid values:

  • internet: After an Internet SLB instance is created, the system allocates a public IP address so that the instance can forward requests from the Internet.
  • intranet: After an intranet SLB instance is created, the system allocates an intranet IP address so that the instance can only forward intranet requests.
AutoPay Boolean No true

Optional. Indicates whether to automatically pay the bill for a Subscription Internet instance.

Valid values: true | false. Default value: false

Note This parameter applies only to the China site.
Bandwidth Integer No 10

Optional. The peak bandwidth of the listener. Unit: Mbit/s

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

Optional. Guarantees the idempotence of the request. The value of this parameter is generated by the client and is unique among different requests. It can contain up to 64 ASCII characters.

DeleteProtection String No on

Optional. Indicates whether to enable deletion protection to protect the SLB instance from being mistakenly deleted.

Duration Integer No 1

Optional. The subscription duration of a Subscription Internet instance. Valid values:

  • If the value of PricingCycle is month, the value range for this parameter is from 1 to 9.
  • If the value of PricingCycle is year, the value range for this parameter is from 1 to 3.
Note This parameter applies only to the China site.
InternetChargeType String No paybytraffic

Optional. The billing method of an Internet instance. Valid values:

  • paybytraffic: billed based on traffic (default value)
LoadBalancerName String No abc

Optional. The name of the SLB instance to be created.

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

If this parameter is not specified, an instance name is assigned by the system.

LoadBalancerSpec String No slb.s2.small

Optional. The specification of the SLB instance to be created. Valid values:

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

The available specifications vary by region.

Currently, guaranteed-performance instances are supported in the following regions: China (Qingdao), China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Zhangjiakou), China (Hohhot), 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 specify the specification of the SLB instance to be created, a shared-performance instance is created.
MasterZoneId String No cn-hangzhou-b

Optional. The primary zone ID of the SLB instance to be created.

To query the primary zone ID of the instance to be created, callDescribeZones.

PayType String No PayOnDemand

Optional. The billing method of the SLB instance to be created. Valid values:

  • PayOnDemand: Pay-As-You-Go
PricingCycle String No month

Optional. The billing cycle of a Subscription Internet instance. Valid values: month | year

Note This parameter applies only to the China site.
ResourceGroupId String No rg-atstuj3rtopt****

Optional. The ID of the enterprise resource group to which the SLB instance to be created belongs.

SlaveZoneId String No cn-hangzhou-d

Optional. The secondary zone ID of the SLB instance.

To query the primary and secondary zones in a region, callDescribeZones.

VSwitchId String No vsw-bp12mw1f8k3jgy*****

Optional. The ID of the VSwitch to which an SLB instance of the VPC network belongs.

This parameter must be specified if you want to create an SLB instance of the VPC network. If this parameter is specified, the value of AddessType is set to intranet by default.

VpcId String No vpc-bp1aevy8sofi8mh1*****

Optional. The ID of the VPC to which the SLB instance to be created belongs.

Response parameters

Parameter Type Example value Description
LoadBalancerId String 139a00604ad-cn-east-hangzhou-01

The ID of the SLB instance.

Address String 42.250.6.36

The IP address of the SLB instance.

VpcId String vpc-25dvzy9f8

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 abc

The name of the SLB instance.

AddressIPVersion String ipv4

The IP version of the SLB instance.

NetworkType String classic

The network type of the SLB instance.

OrderId Long 201429619788910

The order ID.

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

The request ID.

ResourceGroupId String rg-atstuj3rtoptyui

The ID of the enterprise resource group.

Examples

Request example


http(s)://[Endpoint]/? Action=CreateLoadBalancer
&RegionId=cn-hangzhou
&<CommonParameters>

Response examples

XML format

<CreateLoadBalancerResponse>
  <NetworkType>vpc</NetworkType>
  <LoadBalancerName>abc</LoadBalancerName>
  <Address>192.168.0.6</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":"abc",
	"RequestId":"AB197CF0-D9E9-4475-A89D-35DBCCF13BBE",
	"ResourceGroupId":"rg-acfmxazb4ph****",
	"Address":"192.168.0.6",
	"AddressIPVersion":"ipv4",
	"LoadBalancerId":"lb-bp1b6c719dfa08ex****",
	"VSwitchId":"vsw-bp12mw1f8k3jgygk9****",
	"VpcId":"vpc-bp1aevy8sofi8mh1****"
}

Error codes

See common error codes.