All Products
Search
Document Center

Server Load Balancer:CreateLoadBalancer

Last Updated:Oct 10, 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:CreateLoadBalancercreate
  • LoadBalancer
    acs:nlb:{#regionId}:{#accountId}:loadbalancer/*
  • VSwitch
    acs:vpc:{#regionId}:{#accountId}:vswitch/{#VSwitchId}
  • EipAddress
    acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId}
  • VPC
    acs:vpc:{#regionId}:{#accountId}:vpc/{#VpcId}
    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 network type of the IPv4 address used by the NLB instance. Valid values:

  • Internet: The NLB instance is assigned a public IP address. The domain name is resolved to the public IP address. The NLB instance is accessible over the Internet.
  • Intranet: The NLB instance is assigned only a private IP address. The domain name is resolved to the private IP address. The NLB instance is accessible only within the VPC of the NLB instance.
Note To enable a public IPv6 address for a dual-stack NLB instance, call the EnableLoadBalancerIpv6Internet operation.
Internet
AddressIpVersionstringNo

The version of the protocol. Valid values:

  • ipv4 (default)
  • DualStack
ipv4
VpcIdstringYes

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

vpc-bp1b49rqrybk45nio****
ZoneMappingsarray<object>Yes

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

ZoneMappingobjectYes

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****
Ipv6AddressstringNo

The IPv6 address. The IPv6 address that the NLB instance uses to provide external services.

2408:400a:d5:3080:b409:840a:ca:e8e5
Ipv4LocalAddressesarrayNo

The IPv4 link-local addresses. The IP addresses that the NLB instance uses to communicate with the backend servers. The number of IP addresses must be an even number, which must be at least 2 and at most 8.

stringNo

The IPv4 link-local address.

192.168.10.2
Ipv6LocalAddressesarrayNo

The IPv6 link-local addresses. The IP addresses that the NLB instance uses to communicate with the backend servers. The number of IP addresses must be an even number, which must be at least 2 and at most 8.

stringNo

The IPv6 link-local address.

2408:400a:d5:3080:b409:840a:ca:e8e6
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, without performing the actual request. Valid values:

  • true: performs a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error code is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. 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
Tagarray<object>No

The tags.

objectNo

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.
400QuotaExceeded.QuotaInsufficientThe quota of %s is exceeded, usage %s/%s.The quota is insufficient, currently used %s/%s. Please modify the quota size in the quota center.
400ResourceInUse.IPThe specified resource of IP is in use.-
400OperationFailed.CreateOrderErrorOperation failed because CreateOrderError.The operation failed because the order creation failed.
400OperationFailed.NotExist.ResourceGroupOperation failed because ResourceGroup not exist.The specified resource group does not exist.
400IllegalParam.loadBalancerNameParam loadBalancerName is illegal.The instance name is invalid. Check the parameters.
400SystemBusySystem is busy, please try again later.-
400MissingParam.%sThe parameter of %s is missing.-
400IllegalParam.loadBalancerNameThe parameter loadBalancerName of listener is illegal.The NLB instance name does not meet the input requirements, please modify according to the details in the error.
400IllegalParam.DeletionProtectionConfigDeletionProtectionConfig reason is illegal.The reason parameter for changing the delete protection status is invalid.
400IllegalParam.ModificationProtectionConfigModificationProtectionConfig reason is illegal.ModificationProtectionConfig reason is illegal.
400Throttling.UserRequest was denied due to api flow control.Request was denied due to api flow control.
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-09-06The Error code has changedView Change Details
2024-09-04The Error code has changedView Change Details
2024-02-04The Error code has changedView Change Details
2024-02-04The Error code has changedView Change Details
2024-02-04The Error code has changedView Change Details
2024-01-22The Error code has changedView Change Details
2023-12-20The Error code has changedView Change Details
2023-11-27The Error code has changedView Change Details
2023-10-09The Error code has changedView Change Details
2023-09-26The Error code has changedView Change Details
2023-09-12The Error code has changedView Change Details
2023-09-08The Error code has changedView Change Details
2023-09-05The Error code has changedView Change Details
2023-08-22The Error code has changedView Change Details
2023-06-30The internal configuration of the API is changed, but the call is not affectedView Change Details
2023-06-29The request parameters of the API has changedView Change Details