Creates an Application Load Balancing (ALB) instance in a specified region.
Operation description
The CreateLoadBalancer operation is asynchronous. The system returns an instance ID, but the Application Load Balancing (ALB) instance is not yet created and the creation task is still running in the background. You can invoke the GetLoadBalancerAttribute operation to query the creation status of the Application Load Balancing (ALB) instance:
When the Application Load Balancing (ALB) instance is in the Provisioning state, the instance is being created.
When the Application Load Balancing (ALB) instance is in the Active state, the instance is 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 |
The client token that is used to ensure the idempotence of the request. You can generate a parameter value from your client to ensure that the value is unique among different requests. The ClientToken parameter supports only ASCII characters. Note
If you do not specify this parameter, the system automatically uses the RequestId of the API request as the ClientToken. The RequestId of each API request is different. |
5A2CFF0E-5718-45B5-9D4D-70B3FF3898 |
| DryRun |
boolean |
No |
Specifies whether to perform only a dry run on the request. Valid values:
|
false |
| VpcId |
string |
Yes |
The ID of the virtual private cloud (VPC) where the Application Load Balancing (ALB) instance is deployed. |
vpc-bp1b49rqrybk45nio**** |
| AddressType |
string |
Yes |
The network type of the Application Load Balancing (ALB) instance. Valid values:
|
Internet |
| LoadBalancerName |
string |
No |
The name of the Application Load Balancing (ALB) instance. The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), hyphens (-), and spaces. It must start with a letter or digit. |
alb1 |
| DeletionProtectionEnabled |
boolean |
No |
Specifies whether to enable deletion protection. Valid values:
|
false |
| ModificationProtectionConfig |
object |
No |
The modification protection configuration. |
|
| Reason |
string |
No |
The reason for enabling modification protection. The value must be 2 to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). It must start with a letter or a Chinese character. Note
This parameter is valid only when Status is set to ConsoleProtection. |
Managed Instance |
| Status |
string |
No |
The modification protection status of the Application Load Balancing (ALB) instance. Valid values:
Note
When this parameter is set to ConsoleProtection, users cannot modify the instance configurations in the load balancing console, but can invoke API operations to modify the instance configurations. |
ConsoleProtection |
| ZoneMappings |
array<object> |
Yes |
The list of zone and vSwitch mappings. You can specify up to 10 zones. If the current region supports two or more zones, you must specify at least two zones. |
|
|
object |
No |
The list of zone and vSwitch mappings. You can add up to 10 zones. If the current region supports two or more zones, you must add at least two zones. |
||
| VSwitchId |
string |
Yes |
The ID of the vSwitch in the zone. You can use only one vSwitch and one subnet in each zone. You can add up to 10 zones. If the current region supports two or more zones, you must add at least two zones. |
vsw-sersdf**** |
| ZoneId |
string |
Yes |
The zone ID. You can add up to 10 zones. If the current region supports two or more zones, you must add at least two zones. You can call the DescribeZones operation to query the information about the zones. |
cn-hangzhou-a |
| AllocationId |
string |
No |
The instance ID of the elastic IP address (EIP) that is attached to the Internet-facing instance. |
eip-bp1aedxso6u80u0qf**** |
| EipType |
string |
No |
The type of the EIP. Valid values:
Note
For more information about the regions where ALB supports Anycast EIPs, see Limits. |
Common |
| IntranetAddress |
string |
No |
The IPv4 private IP address. |
192.168.10.1 |
| AddressAllocatedMode |
string |
No |
The IP address allocation mode. Valid values:
Note
Starting from 00:00:00 on February 25, 2025 (UTC+8), when you create an instance by calling this operation, an upgraded ALB instance is created regardless of the mode you specify. The IP address allocation mode is no longer distinguished, and the allocated IP addresses are automatically scalable. 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 Balancing (ALB) instance. Different editions have different feature limits and billing policy. Valid values:
|
Standard |
| LoadBalancerBillingConfig |
object |
Yes |
The billing configuration of the Application Load Balancing (ALB) instance. |
|
| PayType |
string |
Yes |
The billing method of the instance. Set the value to PostPay, which specifies the pay-as-you-go billing method. |
PostPay |
| BandwidthPackageId |
string |
No |
The ID of the Internet Shared Bandwidth instance that is associated with the Internet-facing ALB instance. |
cbwp-bp1vevu8h3ieh**** |
| AddressIpVersion |
string |
No |
The IP version. Valid values:
|
IPv4 |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tag structure. |
||
| Key |
string |
No |
The tag key. It can be up to 128 characters in length, and cannot start with aliyun or acs:, or contain http:// or https://. |
env |
| Value |
string |
No |
The tag key. It can be up to 128 characters in length, and cannot start with aliyun or acs:, or contain http:// or https://. |
product |
| SecurityGroupIds |
array<object> |
No |
The IDs of the security groups. |
|
|
object |
No |
The IDs of the security groups. |
||
| SecurityGroupId |
string |
No |
The ID of the security group. |
sg-gw82chzr7ru23iwbn9mu |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response for creating a load balancing instance. |
||
| LoadBalancerId |
string |
The instance ID of the Application Load Balancing (ALB) instance. |
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. | The parameter ZoneId is duplicate. |
| 400 | OperationDenyed.ServiceLinkedRoleNotExist | The service linked role AliyunServiceRoleForAlb does not exist. | The user account is not associated with the Alibaba Cloud service-linked role AliyunServiceRoleForAlb. |
| 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.