CreateLoadBalancer

更新时间:
复制 MD 格式

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

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

alb:CreateLoadBalancer

create

*LoadBalancer

acs:alb:{#regionId}:{#accountId}:loadbalancer/*

  • alb:AddressType
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 ClientToken parameter supports only ASCII characters.

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:

  • true: performs a dry run without creating the Application Load Balancer instance. The system checks for required parameters, the request format, and service limits. If the request fails the check, an error is returned. If the request passes the check, the system returns the DryRunOperation error code.

  • false (default): sends a normal request. If the request passes the check, the system returns an HTTP 2xx status code and performs the operation.

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: The load balancer is assigned a public IP address. Its domain name is resolved to the public IP address, allowing access from the public network.

  • Intranet: The load balancer is assigned a private IP address. Its domain name is resolved to the private IP address, allowing access only from the private network of the VPC where the load balancer is deployed.

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:

  • true: Enables deletion protection.

  • false (default): Disables deletion protection.

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:

  • NonProtection: Modification protection is disabled. If you specify a value for Reason, the value is cleared.

  • ConsoleProtection: Console-based modification protection is enabled. If you specify a value for Reason, the value takes effect.

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:

  • Common (default): an Elastic IP address.

  • Anycast: an Anycast EIP.

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:

  • Fixed (default): A static IP address is assigned to each availability zone.

  • Dynamic: An IP address is dynamically assigned to each availability zone.

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:

  • Basic: Basic edition.

  • Standard: Standard edition.

  • StandardWithWaf: WAF-enabled edition.

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: IPv4.

  • DualStack: The instance supports both IPv4 and IPv6.

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.