Creates an Application Load Balancer (ALB) instance.
Usage notes
CreateLoadBalancer is an asynchronous operation. After you send a request, the system returns a request ID and runs the task in the background. You can call the GetLoadBalancerAttribute operation to query the status of an ALB instance.
- If an ALB instance is in the Provisioning state, it indicates that the ALB instance is being created.
- If an ALB instance is in the Active state, it indicates that the ALB instance is created.
Debugging
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. The token can only contain ASCII characters. Note If you do not specify this parameter, the system uses the value of RequestId as the value of ClientToken. The value of the RequestId parameter may be different for each API request. |
DryRun | Boolean | No | false | Specifies whether to perform a dry run. Default value: false. Valid values:
|
VpcId | String | Yes | vpc-bp1b49rqrybk45nio**** | The ID of the virtual private cloud (VPC) in which you want to create the ALB instance. |
AddressType | String | Yes | Internet | The type of the address of the ALB instance. Valid values:
|
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. Default value: false. Valid values:
|
ModificationProtectionConfig.Reason | String | No | ManagedInstance | The reason why the configuration read-only mode is enabled. 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. Note This parameter takes effect only when you set the Status parameter to ConsoleProtection. |
ModificationProtectionConfig.Status | String | No | ConsoleProtection | Specifies whether to enable the configuration read-only mode for the ALB instance. Valid values:
Note If you set this parameter to ConsoleProtection, you cannot modify the configurations of the ALB instance in the ALB console. However, you can call API operations to modify the configurations of the ALB instance. |
ZoneMappings.N.VSwitchId | String | Yes | vsw-sersdf**** | The ID of the vSwitch in the zone. You can specify only one vSwitch (subnet) in each zone of an ALB instance. You can specify up to 10 vSwitch IDs. |
ZoneMappings.N.ZoneId | String | Yes | cn-hangzhou-a | The ID of the zone where the ALB instance is deployed. You can specify up to 10 zone IDs. You can call the DescribeZones operation to query the zones of the ALB instance. |
AddressAllocatedMode | String | No | Dynamic | The mode used to assign IP addresses to zones of the ALB instance. Default value: Dynamic. Valid values:
|
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 of the ALB instance. Valid values:
|
LoadBalancerBillingConfig.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. |
LoadBalancerBillingConfig.BandwidthPackageId | String | No | cbwp-bp1vevu8h3ieh**** | The ID of the Elastic IP Address (EIP) bandwidth plan that is associated with the ALB instance if the ALB instance uses a public IP address. |
AddressIpVersion | String | No | IPv4 | The protocol version. Valid values:
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
LoadBalancerId | String | alb-o9ulmq5hgn68jk**** | 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","BandwidthPackageId":"cbwp-bp1vevu8h3ieh****"}
&AddressIpVersion=IPv4
&Common request parameters
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateLoadBalancerResponse>
<LoadBalancerId>alb-o9ulmq5hgn68jk****</LoadBalancerId>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</CreateLoadBalancerResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"LoadBalancerId" : "alb-o9ulmq5hgn68jk****",
"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 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 already exist. |
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, see Service error codes..