Creates a Network Load Balancer (NLB) instance.
Usage notes
- 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
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateLoadBalancer | The operation that you want to perform. Set the value to CreateLoadBalancer. |
LoadBalancerType | String | No | network | The type of the instance. Set the value to network, which specifies an NLB instance. |
LoadBalancerName | String | No | NLB1 | 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. |
AddressType | String | Yes | Internet | The type of IPv4 address used by the NLB instance. Valid values:
Note To enable public IPv6 for a dual-stack NLB instance, call the EnableLoadBalancerIpv6Internet operation. |
AddressIpVersion | String | No | ipv4 | The protocol version. Valid values:
|
VpcId | String | Yes | vpc-bp1b49rqrybk45nio**** | The ID of the VPC where the NLB instance is deployed. |
ZoneMappings.N.VSwitchId | String | Yes | vsw-sersdf**** | 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. |
ZoneMappings.N.ZoneId | String | Yes | cn-hangzhou-a | 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. |
ZoneMappings.N.PrivateIPv4Address | String | No | 192.168.10.1 | The private IP address. You must add at least two zones. You can add a maximum of 10 zones. |
ZoneMappings.N.AllocationId | String | No | eip-bp1aedxso6u80u0qf**** | 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. |
BandwidthPackageId | String | No | cbwp-bp1vevu8h3ieh**** | The ID of the EIP bandwidth plan that is associated with the Internet-facing NLB instance. |
LoadBalancerBillingConfig.PayType | String | No | PostPay | The billing method of the NLB instance. Set the value to PostPay, which specifies the pay-as-you-go billing method. |
ResourceGroupId | String | No | rg-atstuj3rtop**** | The ID of the resource group. |
DryRun | Boolean | No | false | Specifies whether to perform a dry run. Valid values:
|
ClientToken | String | No | 123e4567-e89b-12d3-a456-426655440000 | The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that the value is unique among all requests. The ClientToken value contains only ASCII characters. Note If you do not set this parameter, the system automatically uses the value of RequestId as the value of ClientToken. The value of RequestId for each API request is different. |
RegionId | String | No | cn-hangzhou | The ID of the region where the NLB instance is deployed. You can call the DescribeRegions operation to query the most recent region list. |
DeletionProtectionConfig.Enabled | Boolean | No | false | Specifies whether to enable deletion protection. Valid values:
|
DeletionProtectionConfig.Reason | String | No | The instance is in the Running state. | 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. |
ModificationProtectionConfig.Status | String | No | ConsoleProtection | Specifies whether to enable the configuration read-only mode. Valid values:
Note If you set this parameter to ConsoleProtection, you cannot modify instance configurations in the NLB console. However, you can modify instance configurations by calling API operations. |
ModificationProtectionConfig.Reason | String | No | Service guarantee period | 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 when Status is set to ConsoleProtection. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | CEF72CEB-54B6-4AE8-B225-F876FF7BA984 | The ID of the request. |
LoadbalancerId | String | nlb-83ckzc8d4xlp8o**** | The ID of the NLB instance. |
OrderId | Long | 20230000 | The ID of the order for the NLB instance. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=CreateLoadBalancer
&LoadBalancerType=network
&LoadBalancerName=NLB1
&AddressType=Internet
&AddressIpVersion=ipv4
&VpcId=vpc-bp1b49rqrybk45nio****
&ZoneMappings=[{"VSwitchId":"vsw-sersdf****","ZoneId":"cn-hangzhou-a","PrivateIPv4Address":"192.168.10.1","AllocationId":"eip-bp1aedxso6u80u0qf****"}]
&BandwidthPackageId=cbwp-bp1vevu8h3ieh****
&LoadBalancerBillingConfig={"PayType":"PostPay"}
&ResourceGroupId=rg-atstuj3rtop****
&DryRun=false
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&RegionId=cn-hangzhou
&DeletionProtectionConfig={"Enabled":false,"Reason":"The instance is in the Running state."}
&ModificationProtectionConfig={"Status":"ConsoleProtection","Reason":"Service guarantee period"}
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateLoadBalancerResponse>
<RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
<LoadbalancerId>nlb-83ckzc8d4xlp8o****</LoadbalancerId>
<OrderId>20230000</OrderId>
</CreateLoadBalancerResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "CEF72CEB-54B6-4AE8-B225-F876FF7BA984",
"LoadbalancerId" : "nlb-83ckzc8d4xlp8o****",
"OrderId" : 20230000
}
Error codes
For a list of error codes, see Service error codes.