All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Oct 15, 2024

Creates an Application Load Balancer (ALB) instance in a region.

Operation description

CreateLoadBalancer is an asynchronous operation. After a request is sent, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
alb:CreateLoadBalancercreate
  • LoadBalancer
    acs:alb:{#regionId}:{#accountId}:loadbalancer/*
  • alb:AddressType
none

Request parameters

ParameterTypeRequiredDescriptionExample
ClientTokenstringNo

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.
5A2CFF0E-5718-45B5-9D4D-70B3FF3898
DryRunbooleanNo

Specifies whether to perform a dry run. Default value: false. Valid values:

  • true: performs a dry run. The system checks the required parameters, request format, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false: performs a dry run and sends the request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
false
VpcIdstringYes

The ID of the virtual private cloud (VPC) in which you want to create the ALB instance.

vpc-bp1b49rqrybk45nio****
AddressTypestringYes

The type of the address of the ALB instance. 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. In this case, 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. In this case, the ALB instance can be accessed over the VPC in which the ALB instance is deployed.
Internet
LoadBalancerNamestringNo

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.

alb1
DeletionProtectionEnabledbooleanNo

Specifies whether to enable deletion protection. Default value: false. Valid values:

  • true: enables deletion protection.
  • false: disables deletion protection.
false
ModificationProtectionConfigobjectNo

The configuration of the configuration read-only mode.

ReasonstringNo

The reason for enabling the configuration read-only mode. 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 if Status is set to ConsoleProtection.
test
StatusstringNo

Specifies whether to enable the configuration read-only mode. Valid values:

  • NonProtection: disables the configuration read-only mode. In this case, you cannot specify ModificationProtectionReason. If you specify ModificationProtectionReason, the value of the parameter is cleared.
  • ConsoleProtection: enables the configuration read-only mode. In this case, you can specify ModificationProtectionReason.
Note If you set this parameter to ConsoleProtection, you cannot use the ALB console to modify instance configurations. However, you can call API operations to modify instance configurations.
ConsoleProtection
ZoneMappingsarray<object>Yes

The mappings between zones an vSwitches. You can specify at most 10 zones. If the selected region supports two or more zones, select at least two zones to ensure the high availability of your service.

objectYes

The mappings between zones an vSwitches. You can specify at most 10 zones. If the selected region supports two or more zones, select at least two zones to ensure the high availability of your service.

VSwitchIdstringYes

The vSwitch in the zone. You can specify only one vSwitch (subnet) in each zone. You can specify at most 10 zones. If the region supports two or more zones, specify at least two zones.

vsw-sersdf****
ZoneIdstringYes

The zone ID of the cluster. You can specify at most 10 zones. If the region supports two or more zones, specify at least two zones. You can call the DescribeZones operation to query the most recent zone list.

cn-hangzhou-a
AllocationIdstringNo

The ID of the EIP to be associated with the Internet-facing ALB instance.

eip-bp1aedxso6u80u0qf****
EipTypestringNo

The type of EIP. Valid values:

  • Common: an EIP.
  • Anycast: an Anycast EIP.
Note For more information about the regions in which ALB supports Anycast EIPs, see Limits .
Common
IntranetAddressstringNo

The private IPv4 address.

192.168.10.1
AddressAllocatedModestringNo

The mode in which IP addresses are allocated. Default value: Dynamic. Valid values:

  • Fixed: The ALB instance uses a static IP address.
  • Dynamic (default): The system dynamically allocates an IP address to each zone of the ALB instance.
Dynamic
ResourceGroupIdstringNo

The ID of the resource group.

rg-atstuj3rtop****
LoadBalancerEditionstringYes

The edition of the ALB instance. The features and billing rules vary based on the edition of the ALB instance. Valid values:

  • Basic: basic.
  • Standard: standard.
  • StandardWithWaf: WAF-enabled.
Standard
LoadBalancerBillingConfigobjectYes

The billing method of the ALB instance.

PayTypestringYes

The billing method of the ALB instance.

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

PostPay
BandwidthPackageIdstringNo

The ID of the Internet Shared Bandwidth instance that is associated with the Internet-facing ALB instance.

cbwp-bp1vevu8h3ieh****
AddressIpVersionstringNo

The protocol version. Valid values:

  • IPv4: IPv4.
  • DualStack: dual stack.
IPv4
Tagarray<object>No

The tags.

objectNo
KeystringNo

The tag key can be up to 128 characters in length, and cannot start with acs: or aliyun. It cannot contain http:// or https://.

env
ValuestringNo

The tag value can be up to 128 characters in length, and cannot start with acs: or aliyun. It cannot contain http:// or https://.

product

Response parameters

ParameterTypeDescriptionExample
object

The operation to create an ALB instance.

LoadBalancerIdstring

The ALB instance ID.

alb-o9ulmq5hgn68jk****
RequestIdstring

The ID of the request.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984

Examples

Sample success responses

JSONformat

{
  "LoadBalancerId": "alb-o9ulmq5hgn68jk****",
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

Error codes

HTTP status codeError codeError messageDescription
400ResourceNotEnough.VSwitchIpThe specified resource %s is not enough.The specified resource %s is not enough.
400QuotaExceeded.LoadBalancersNumThe quota of %s is exceeded, usage %s/%s.The quota of %s is exceeded, usage %s/%s.
400Mismatch.ZoneIdAndVSwitchIdThe %s and %s are mismatched.The %s and %s are mismatched.
400DuplicatedParam.ZoneIdThe param of ZoneId is duplicated.-
400OperationDenyed.ServiceLinkedRoleNotExistThe service linked role AliyunServiceRoleForAlb does not exist.-
404ResourceNotFound.VSwitchThe specified resource %s is not found.The specified resource %s is not found.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-23The Error code has changedView Change Details
2024-01-18The Error code has changedView Change Details
2023-11-03The Error code has changedView Change Details
2023-10-30The Error code has changedView Change Details