Creates an SLB instance.

Before you call this API, note the following:

  • After the instance is created, fees are incurred. For more information, see Billing method.
  • 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 creating 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

The region ID 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. Specify the IP address of the private network for the SLB instance, which must be in 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 the Subscription-billed Internet instance to be created.

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

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.

Duration Integer No 1

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

  • If the value of PricingCycle is month, the valid range for this parameter is from 1 to 9.
  • If the value of PricingCycle is year, the valid 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 value:

  • paybytraffic: billed by 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 can 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), Hong Kong, and US (Virginia). For more information, see Guaranteed-performance instance.

Note If you do not configure 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, call DescribeZone.

PayType String No PayOnDemand

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

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

Optional. The duration of the Subscription-billed Internet instance to be created. Valid values: month | year

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

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, call DescribeZone.

VSwitchId String No vsw-bp12mw1f8k3jgygk9bmlj

Optional. The ID of the VSwitch of the SLB instance to be created.

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

VpcId String No vpc-bp1aevy8sofi8mh1qc5cm

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

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

VSwitchId String vsw-255ecrwq5

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 address type of the SLB instance.

NetworkType String classic

The network type of the SLB instance to be created.

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
&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-acfmxazb4ph6aiy</ResourceGroupId>
  <RequestId>AB197CF0-D9E9-4475-A89D-35DBCCF13BBE</RequestId> 
  <AddressIPVersion>ipv4</AddressIPVersion>
  <LoadBalancerId>lb-bp1b6c719dfa08exfuca5</LoadBalancerId>
  <VSwitchId>vsw-bp12mw1f8k3jgygk9bmlj</VSwitchId>
  <VpcId>vpc-bp1aevy8sofi8mh1qc5cm</VpcId>
</CreateLoadBalancerResponse>

JSON format

{
	"NetworkType":"vpc",
	"LoadBalancerName":"abc",
	"RequestId":"AB197CF0-D9E9-4475-A89D-35DBCCF13BBE",
	"ResourceGroupId":"rg-acfmxazb4ph6aiy",
	"Address":"192.168.0.6",
	"AddressIPVersion":"ipv4",
	"LoadBalancerId":"lb-bp1b6c719dfa08exfuca5",
	"VSwitchId":"vsw-bp12mw1f8k3jgygk9bmlj",
	"VpcId":"vpc-bp1aevy8sofi8mh1qc5cm"
}

Error codes

See common error codes.