Create an application load balancer in a specified region
Operation description
The CreateLoadBalancer operation is asynchronous. A successful call returns an instance ID, but the application load balancer instance is created in the background. Call GetLoadBalancerAttribute to check the creation status of the application load balancer instance:
If the instance is in the provisioning state, it is being created.
If the instance is in the active state, it has been created.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
alb:CreateLoadBalancer |
create |
*LoadBalancer
|
|
None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ClientToken |
string |
No |
A client token to ensure the idempotency of the request. You can generate a unique value from your client for each request. The Note
If you omit this parameter, the system uses the RequestId of the request as the ClientToken. |
5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
| DryRun |
boolean |
No |
Specifies whether to perform a dry run. Valid values:
|
false |
| VpcId |
string |
Yes |
The ID of the VPC for the Application Load Balancer instance. |
vpc-bp1b49rqrybk45nio**** |
| AddressType |
string |
Yes |
The address type of the Application Load Balancer. Valid values:
|
Internet |
| LoadBalancerName |
string |
No |
The name of the Application Load Balancer instance. The name must be 2 to 128 characters long. It must start with a letter, a Chinese character, or a digit, and can contain digits, periods (.), underscores (_), hyphens (-), and spaces. |
alb1 |
| DeletionProtectionEnabled |
boolean |
No |
Specifies whether to enable deletion protection. Valid values:
|
false |
| ModificationProtectionConfig |
object |
No |
The modification protection settings. |
|
| Reason |
string |
No |
The reason for enabling modification protection. The reason must be 2 to 128 characters long. It must start with a letter or a Chinese character, and can contain digits, periods (.), underscores (_), and hyphens (-). Note
This parameter is effective only when Status is set to ConsoleProtection. |
Managed Instance |
| Status |
string |
No |
The modification protection status of the Application Load Balancer instance. Valid values:
Note
If you set the value to ConsoleProtection, you cannot modify the instance in the Application Load Balancer console. However, you can still modify it by calling API operations. |
ConsoleProtection |
| ZoneMappings |
array<object> |
Yes |
The mappings between availability zones and subnets. You can specify up to 10 availability zones. If the region has two or more availability zones, you must specify at least two. |
|
|
object |
No |
The mappings between availability zones and subnets. You can specify up to 10 availability zones. If the region has two or more availability zones, you must specify at least two. |
||
| VSwitchId |
string |
Yes |
The ID of the subnet in the specified availability zone. Each availability zone can be mapped to only one subnet. |
vsw-sersdf**** |
| ZoneId |
string |
Yes |
The ID of the availability zone. You can call the DescribeZones operation to query for available zones. |
cn-hangzhou-a |
| AllocationId |
string |
No |
The ID of the Elastic IP address (EIP) to associate with the public-facing instance. |
eip-bp1aedxso6u80u0qf**** |
| EipType |
string |
No |
The type of the Elastic IP address. Valid values:
Note
For regions that support binding Anycast EIPs to an Application Load Balancer instance, see Limitations. |
Common |
| IntranetAddress |
string |
No |
The private IPv4 address. |
192.168.10.1 |
| AddressAllocatedMode |
string |
No |
The address allocation mode. Valid values:
Note
Starting from 00:00:00 on February 25, 2025 (Beijing time), all instances created by calling this API will be upgraded ALB instances regardless of the mode you specify. IP modes are no longer distinguished, and the allocated IP addresses scale automatically. Existing ALB instances created before the upgrade are not affected. |
Fixed |
| ResourceGroupId |
string |
No |
The ID of the resource group. |
rg-atstuj3rtop**** |
| LoadBalancerEdition |
string |
Yes |
The edition of the Application Load Balancer. Different editions have different features and billing policies. Valid values:
|
Standard |
| LoadBalancerBillingConfig |
object |
Yes |
The billing configuration of the Application Load Balancer instance. |
|
| PayType |
string |
Yes |
The billing method of the instance. Set the value to PostPay for pay-as-you-go. |
PostPay |
| BandwidthPackageId |
string |
No |
The ID of the shared bandwidth package that is associated with the public-facing instance. |
cbwp-bp1vevu8h3ieh**** |
| AddressIpVersion |
string |
No |
The protocol version. Valid values:
|
IPv4 |
| Tag |
array<object> |
No |
The tags to add to the instance. |
|
|
object |
No |
The tag structure. |
||
| Key |
string |
No |
The tag key. The key can be up to 128 characters long, cannot start with aliyun or acs:, and cannot contain http:// or https://. |
env |
| Value |
string |
No |
The tag value. The value can be up to 128 characters long, cannot start with aliyun or acs:, and cannot contain http:// or https://. |
product |
| SecurityGroupIds |
array<object> |
No |
The IDs of the security groups to associate with the instance. |
|
|
object |
No |
The IDs of the security groups to associate with the instance. |
||
| SecurityGroupId |
string |
No |
The ID of the security group. |
sg-gw82chzr7ru23iwbn9mu |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response from creating an Application Load Balancer instance. |
||
| LoadBalancerId |
string |
The Application Load Balancer instance ID. |
alb-o9ulmq5hqn68jk**** |
| RequestId |
string |
The request ID. |
CEF72CEB-54B6-4AE8-B225-F876FF7BA984 |
Examples
Success response
JSON format
{
"LoadBalancerId": "alb-o9ulmq5hqn68jk****",
"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 specified resource %s is not enough. |
| 400 | QuotaExceeded.LoadBalancersNum | The quota of %s is exceeded, usage %s/%s. | The quota of %s is exceeded, usage %s/%s. |
| 400 | Mismatch.ZoneIdAndVSwitchId | The %s and %s are mismatched. | The %s and %s are mismatched. |
| 400 | DuplicatedParam.ZoneId | The param of ZoneId is duplicated. | |
| 400 | OperationDenyed.ServiceLinkedRoleNotExist | The service linked role AliyunServiceRoleForAlb does not exist. | |
| 404 | ResourceNotFound.VSwitch | The specified resource %s is not found. | The specified resource %s is not found. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.