Creates an Application Load Balancer (ALB) 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.

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. ClientToken can contain only ASCII characters.

Note If you do not set this parameter, the system automatically uses RequestId as ClientToken. RequestId may be different for each API request.
DryRun Boolean No false

Specifies whether to only precheck this request. Valid values:

  • true: prechecks the request without creating the resource. The system checks the required parameters, request format, and service limits. If the request fails to pass the check, an error message is returned. If the request passes the precheck, the DryRunOperation error code is returned.
  • false: sends the API request. This is the default value. If the request passes the precheck, a HTTP_2xx status code is returned and the operation is performed.
VpcId String Yes vpc-bp1b49rqrybk45nio****

The ID of the virtual private cloud (VPC) where the ALB instance is deployed.

AddressType String Yes Internet

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

  • Internet: The ALB instance uses a public IP address. The domain name of the ALB instance is resolved to the public IP address. Therefore, the ALB instance can be accessed over the Internet.
  • Intranet: The ALB instance uses a private IP address. The domain name of the ALB instance is resolved to the private IP address. Therefore, the ALB instance can be accessed within the VPC where the ALB instance is deployed.
LoadBalancerName String No alb1

The name of the ALB instance.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

DeletionProtectionEnabled Boolean No false

Specifies whether to enable deletion protection. Valid values:

  • true: enables deletion protection.
  • false (default): disables deletion protection.
ModificationProtectionConfig Object No

The configuration read-only mode.

Reason String No ManageInstance

The reason why you want to enable the configuration read-only mode. The value be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The name must start with a letter.

Note This parameter takes effect only when Status is set to ConsoleProtection.
Status String No ConsoleProtection

Specifies whether to enable the configuration read-only mode. Valid values:

  • NonProtection: disables the configuration read-only mode. In this case, you cannot set the ModificationProtectionReason parameter. If the ModificationProtectionReason parameter is set, the value is cleared.
  • ConsoleProtection: enables the configuration read-only mode. In this case, you can set the ModificationProtectionReason parameter.
ZoneMappings Array Yes

The zones and the vSwitches. You must specify at least two zones.

VSwitchId String Yes vsw-sersdf****

The vSwitch in the zone. Each zone can contain only one vSwitch (subnet).

ZoneId String Yes cn-hangzhou-a

The ID of the zone where the ALB instance is deployed.

You can call the DescribeZones operation to query zones.

AddressAllocatedMode String No Dynamic

The type of IP address assigned to the ALB instance. Valid values:

  • Fixed: The ALB instance uses a static IP address.
  • Dynamic: An IP address is dynamically assigned to the ALB instance in each zone. This is the default value.
ResourceGroupId String No rg-atstuj3rtop****

The ID of the resource group.

LoadBalancerEdition String Yes Standard

The edition of the ALB instance. The features and billing rules vary based on the edition. Valid values:

  • Basic
  • Standard
LoadBalancerBillingConfig Object Yes

The billing information.

PayType String Yes PostPay

The billing method of the ALB instance.

Set the value to PostPay, which specifies the pay-as-you-go billing method.

AddressIpVersion String No Ipv4

The IP version of the private IP address. Set the value to Ipv4. This is the default value.

Response parameters

Parameter Type Example Description
LoadBalancerId String lb-bp1o94dp5i6ea****

The ID of the ALB instance.

RequestId String CEF72CEB-54B6-4AE8-B225-F876FF7BA984

The ID of the request.

Examples

Sample requests

http(s)://[Endpoint]/?Action=CreateLoadBalancer
&ClientToken=5A2CFF0E-5718-45B5-9D4D-70B3FF3898
&DryRun=false
&VpcId=vpc-bp1b49rqrybk45nio****
&AddressType=Internet
&LoadBalancerName=alb1
&DeletionProtectionEnabled=false
&ModificationProtectionConfig={"Reason":"ManageInstance","Status":"ConsoleProtection"}
&ZoneMappings=[{"VSwitchId":"vsw-sersdf****","ZoneId":"cn-hangzhou-a"}]
&AddressAllocatedMode=Dynamic
&ResourceGroupId=rg-atstuj3rtop****
&LoadBalancerEdition=Standard
&LoadBalancerBillingConfig={"PayType":"PostPay"}
&AddressIpVersion=Ipv4
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateLoadBalancerResponse>
    <LoadBalancerId>lb-bp1o94dp5i6ea****</LoadBalancerId>
    <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</CreateLoadBalancerResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "LoadBalancerId" : "lb-bp1o94dp5i6ea****",
  "RequestId" : "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Error codes

HttpCode Error code Error message Description
400 ResourceNotEnough.VSwitchIp The specified resource %s is not enough. The error message returned because the specified resource %s is insufficient.
400 QuotaExceeded.LoadBalancersNum The quota of %s is exceeded, usage %s/%s. The error message returned because the usage %s has exceeded the quota %s.
400 Mismatch.ZoneIdAndVSwitchId The %s and %s are mismatched. The error message returned because the specified %s and %s do not match.
400 DuplicatedParam.ZoneId The param of ZoneId is duplicated. The error message returned because the zone IDs are duplicate.
404 ResourceNotFound.VSwitch The specified resource %s is not found. The error message returned because the specified resource %s does not exist.

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