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 precheck, 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, the 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 ManagedInstance

The reason why you want to enable the configuration read-only mode. The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value 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 you set the ModificationProtectionReason parameter, the value of the parameter 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. You can specify only one vSwitch (subnet) in each zone of an ALB instance.

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 IP address allocation mode. Valid values:

  • Fixed: allocates a static IP address to the ALB instance.
  • Dynamic: dynamically allocates an IP address to each zone of the ALB instance.
ResourceGroupId String No rg-atstuj3rtop****

The ID of the resource group.

LoadBalancerEdition String Yes Standard

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

  • Basic: basic
  • Standard: standard
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 specifies the pay-as-you-go billing method.

AddressIpVersion String No IPv4

The IP version. Valid values:

  • IPv4: IPv4
  • DualStack: dual stack

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":"ManagedInstance","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 API Error Center.