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 make sure that it is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length.

DryRun Boolean No true

Specifies whether only to precheck the request. Valid values:

true: only prechecks the request and does not perform the requested operation. The system checks the required parameters, request format, and service limits. If the request fails the precheck, an error code is returned based on the cause of the failure. If the request passes the precheck, the DryRunOperation error code is returned.

false: prechecks the request and performs the requested operation. After the request passes the precheck, an HTTP 2xx status code is returned and the system performs the operation. This is the default value.

VpcId String Yes vpc-2423****

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 over the VPC where the ALB instance is deployed.
LoadBalancerName String Yes 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 and false.

Default value: false.

ModificationProtectionConfig Object No

The configuration of modification protection.

Reason String No ManageInstance

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

This parameter is valid only if the ModificationProtectionStatus parameter is set to ConsoleProtection.

Status String No ConsoleProtection

Specifies whether to enable the configuration read-only mode for the ALB instance. 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 in the zones. You must specify at least two zones.

VSwitchId String Yes vsw-sersdf****

The ID of the vSwitch in the zone. Each zone can contain only one vSwitch and one subnet.

ZoneId String Yes cn-hangzhou-a

The ID of the zone to which the ALB instance belongs.

AddressAllocatedMode String No Fixed

The mode in which IP addresses are assigned. 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 enterprise resource group.

LoadBalancerEdition String Yes Standard

The edition of the ALB instance. Different editions have different limits and billing methods. Valid values:

  • Basic: Basic Edition
  • Standard: Standard Edition
LoadBalancerBillingConfig Object Yes

The configuration of the billing method.

PayType String Yes PostPay

The billing method of the ALB instance.

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

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=true
&VpcId=vpc-2423****
&AddressType=Internet
&LoadBalancerName=alb1
&DeletionProtectionEnabled=false
&ModificationProtectionConfig={"Reason":"ManageInstance","Status":"ConsoleProtection"}
&ZoneMappings=[{"VSwitchId":"vsw-sersdf****","ZoneId":"cn-hangzhou-a"}]
&AddressAllocatedMode=Fixed
&ResourceGroupId=rg-atstuj3rtop****
&LoadBalancerEdition=Standard
&LoadBalancerBillingConfig={"PayType":"PostPay"}
&<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

HTTP status code Error code Error message Description
400 ResourceNotEnough.VSwitchIp The specified resource %s is not enough. The error message returned because the specified %s resource 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 correspond to each other.
404 ResourceNotFound.VSwitch The specified resource %s is not found. The error message returned because the specified %s resource does not exist.
404 ResourceNotFound.Vpc The specified resource %s is not found. The error message returned because the specified %s resource does not exist.

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