All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Mar 13, 2024

Creates a Network Load Balancer (NLB) instance in a specified region.

Operation description

  • When you create an NLB instance, the service-linked role AliyunServiceRoleForNlb is automatically created and assigned to you.

  • CreateLoadBalancer is an asynchronous operation. After you send a request, the system returns an instance ID and runs the task in the background. You can call GetLoadBalancerAttribute to query the status of an NLB instance.

    • If an NLB instance is in the Provisioning state, the NLB instance is being created.
    • If an NLB instance is in the Active state, the NLB instance is created.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
nlb:CreateLoadBalancerWrite
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
LoadBalancerTypestringNo

The type of the instance. Set the value to network, which specifies an NLB instance.

network
LoadBalancerNamestringNo

The name of the NLB instance.

The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter.

NLB1
AddressTypestringYes

The type of IPv4 address used by the NLB instance. Valid values:

  • Internet: The NLB instance uses a public IP address. The domain name of the NLB instance is resolved to the public IP address. Therefore, the NLB instance can be accessed over the Internet.
  • Intranet: The NLB instance uses a private IP address. The domain name of the NLB instance is resolved to the private IP address. Therefore, the NLB instance can be accessed over the virtual private cloud (VPC) where the NLB instance is deployed.
Note To enable a public IPv6 address for an NLB instance, call the EnableLoadBalancerIpv6Internet operation.
Internet
AddressIpVersionstringNo

The protocol version. Valid values:

  • ipv4: IPv4. This is the default value.
  • DualStack: dual stack.
ipv4
VpcIdstringYes

The ID of the VPC where the NLB instance is deployed.

vpc-bp1b49rqrybk45nio****
ZoneMappingsobject []Yes

The mappings between zones and vSwitches. You must add at least two zones. You can add a maximum of 10 zones.

VSwitchIdstringYes

The vSwitch in the zone. You can specify only one vSwitch (subnet) in each zone of an NLB instance. You must add at least two zones. You can add a maximum of 10 zones.

vsw-sersdf****
ZoneIdstringYes

The ID of the zone of the NLB instance. You must add at least two zones. You can add a maximum of 10 zones.

You can call the DescribeZones operation to query the most recent zone list.

cn-hangzhou-a
PrivateIPv4AddressstringNo

The private IP address. You must add at least two zones. You can add a maximum of 10 zones.

192.168.10.1
AllocationIdstringNo

The ID of the elastic IP address (EIP) that is associated with the Internet-facing NLB instance. You can specify one EIP for each zone. You must add at least two zones. You can add a maximum of 10 zones.

eip-bp1aedxso6u80u0qf****
BandwidthPackageIdstringNo

The ID of the EIP bandwidth plan that is associated with the Internet-facing NLB instance.

cbwp-bp1vevu8h3ieh****
LoadBalancerBillingConfigobjectNo

The billing settings of the NLB instance.

PayTypestringNo

The billing method of the NLB instance.

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

PostPay
ResourceGroupIdstringNo

The ID of the resource group.

rg-atstuj3rtop****
DryRunbooleanNo

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run. The system checks the required parameters, request syntax, and 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. This is the default value. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
false
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 make sure that it is unique among different requests. The client token can contain only ASCII characters.

Note If you do not set this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request is different.
123e4567-e89b-12d3-a456-426655440000
RegionIdstringNo

The ID of the region where the NLB instance is deployed.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
DeletionProtectionConfigobjectNo

The configuration of the deletion protection feature.

EnabledbooleanNo

Specifies whether to enable deletion protection. Valid values:

  • true: yes
  • false (default): no
false
ReasonstringNo

The reason why the deletion protection feature is enabled or disabled. The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter.

The instance is running
ModificationProtectionConfigobjectNo

The configuration of the configuration read-only mode.

StatusstringNo

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

  • NonProtection: does not enable the configuration read-only mode. You cannot set the Reason parameter. If the Reason parameter is set, the value is cleared.
  • ConsoleProtection: enables the configuration read-only mode. You can set the Reason parameter.
Note If you set this parameter to ConsoleProtection, you cannot use the NLB console to modify instance configurations. However, you can call API operations to modify instance configurations.
ConsoleProtection
ReasonstringNo

The reason why the configuration read-only mode is enabled. The value must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter.

Note This parameter takes effect only if the Status parameter is set to ConsoleProtection.
Service guarantee period
Tagobject []No

The tags.

KeystringNo

The key of the tag. You can specify up to 20 tag keys. The tag key cannot be an empty string.

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

env
ValuestringNo

The value of the tag. You can specify up to 20 tag values. The tag value can be an empty string.

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

product

Response parameters

ParameterTypeDescriptionExample
object

response

RequestIdstring

The ID of the request.

CEF72CEB-54B6-4AE8-B225-F876FF7BA984
LoadbalancerIdstring

The ID of the NLB instance.

nlb-83ckzc8d4xlp8o****
OrderIdlong

The ID of the order for the NLB instance.

20230000

Examples

Sample success responses

JSONformat

{
  "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
  "LoadbalancerId": "nlb-83ckzc8d4xlp8o****",
  "OrderId": 20230000
}

Error codes

HTTP status codeError codeError messageDescription
400OperationDenied.OnlyPayByTrafficSupportedThe operation is not allowed because of OnlyPayByTrafficSupported.-
400OperationFailed.%sThe operation failed because of %s.Failed to call the API operation due to %.
400Mismatch.ZoneIdAndVswitchIdThe ZoneIdAndVswitchId is mismatched for %s and %s.-
400QuotaExceeded.%sThe quota of %s is exceeded, usage %s/%s.-
400DryRunOperationRequest validation has been passed with DryRun flag set.Request validation has been passed with DryRun flag set.
400OperationDenied.OnlyPostPaidSupportedThe operation is not allowed because of OnlyPostPaidSupported.-
400OperationFailed.DuplicateZones.The operation failed because of Can not Specify duplicate zones.-
400ResourceNotEnough.VSwitchIpThe specified resource of VSwitchIp is not enough.The specified resource of VSwitchIp is not enough.
400DuplicatedParam.AllocationIdThe param of AllocationId is duplicated.-
400ResourceInConfiguring.VswitchIdThe specified resource of VswitchId is being configured, please try again later.The specified resource of VswitchId is being configured, please try again later.
400IllegalParamThe param of %s is illegal.-
400OperationFailed.UnpaidBillThe operation failed because of UnpaidBill.-
400OperationDenied.ServiceLinkedRoleNotExistThe operation is not allowed because of ServiceLinkedRoleNotExist.The operation is not allowed because of ServiceLinkedRoleNotExist.Please check if the necessary permissions are granted in RAM for the NLB.
400ResourceAlreadyAssociated.AllocationIdThe specified resource of %s is already associated.-
400OperationFailed.vSwitchNotSupportIpv6The operation failed because of vSwitchNotSupportIpv6.-
400InvalidZonesThe current zone list is illegal.The Availability Zone used in Zone maping is illegal.
403UnauthorizedZoneThe specified zone of %s is not authorized.-
403Forbidden.NoPermissionAuthentication is failed for NoPermission.Authentication is failed for NoPermission.
403UnauthorizedRegionThe specified region of %s is not authorized.-
404ResourceNotFound.VSwitchThe specified resource of vSwitch is not found.The specified vSwitch resource was not found. Please check the input parameters.
404ResourceNotFound.VpcThe specified resource of Vpc is not found.The specified VPC resource was not found. Please check the input parameters.

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

Change history

Change timeSummary of changesOperation
2024-02-04The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2024-02-04The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
2024-02-04The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 404 change
    delete Error Codes: 403
2024-01-22The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 404 change
    delete Error Codes: 403
2023-12-20The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2023-11-27The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2023-10-09The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2023-09-26The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2023-09-12The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    Error Codes 404 change
2023-09-08The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
2023-09-05The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    Error Codes 403 change
    Error Codes 404 change
2023-08-22The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Added Error Codes: 400
    Added Error Codes: 403
    Added Error Codes: 404
2023-06-30The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.
2023-06-29The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Tag