You need to enable JavaScript to run this app.
导航

CreateLoadBalancer

最近更新时间2024.04.11 15:34:04

首次发布时间2021.08.31 10:37:27

调用 CreateLoadBalancer 接口创建一个负载均衡实例。

使用说明

Tags.N.b类型的请求参数中,“N”表示标签信息的序号,需按照数字顺序从1开始填写,取值范围为1~20。多个标签之间使用&分隔。

调试

请求参数

名称类型是否必填示例值
描述
ActionStringCreateLoadBalancer要执行的操作,取值为CreateLoadBalancer。
VersionString2020-04-01API版本信息,当前版本为:2020-04-01。
RegionIdStringcn-shanghai请求的Region。

Type

String

private

负载均衡实例的类型。取值如下:

  • public:表示创建一个公网负载均衡实例,系统会分配一个公网IP地址,仅用于转发公网请求。
  • private:表示创建一个私网负载均衡实例,系统会分配一个私网IP地址,仅用于转发私网请求。

ZoneType

String

active-standby

负载均衡实例的可用区类型。

  • single:单可用区。
  • active-standby:主备可用区。
    不传入该参数或该参数不传入数值时,默认根据指定地域的可用区部署情况选择:指定地域为单可用区部署,则默认为“single”;指定地域为多可用区部署,则默认为“active-standby”。

说明

负载均衡支持单可用区部署的功能正在邀测中,如需使用,请联系客户经理。

MasterZoneId

String

cn-shanghai-a

负载均衡实例的主可用区ID。各地域当前支持的可用区信息可参见地域与可用区

  • 取值不能与SlaveZoneId参数取值相同。
  • 不传入该参数或该参数不传入数值时,默认分配子网所在可用区为主可用区。

SlaveZoneId

String

cn-beijing-b

负载均衡实例的备可用区ID。

  • 取值不能与MasterZoneId参数取值相同。
  • 如果传入该参数,则参数MasterZoneId必须传入,否则会报错。
  • 不传入该参数或该参数不传入数值时,根据地域可用区部署情况按照如下逻辑处理:
    • 指定地域为单可用区部署时,该参数默认为空,创建单可用区负载均衡实例。
    • 指定地域为多可用区部署,且ZoneType配置为“single”时,该参数默认为空,创建单可用区负载均衡实例。
    • 指定地域为多可用区部署,且ZoneType配置为“active-standby”时,默认根据指定地域支持的可用区随机分配备可用区。

ExclusiveClusterId

String

ec-bp1o94dp5i6ea****

CLB实例所属独占集群的ID。您可以调用DescribeExclusiveClusters接口获取独占集群的ID。

  • 当需要创建独占集群类型的CLB实例时,请传入该参数。
  • 该参数不传入或传入为空时,默认创建非独占集群类型的CLB实例。

独占集群功能正在邀测中,如需使用,请联系客户经理。

ClientToken

String

123e4567-e89b-12d3-a456-42665544****

客户端Token,用于保证请求的幂等性。

  • 该参数值由客户端自动生成,确保不同请求的取值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。
  • 取值仅支持ASCII字符,最大不超过64个字符。
  • 未指定该参数值时,不进行幂等校验。

LoadBalancerName

String

clb-test

负载均衡实例的名称。

  • 必须以字母、数字或中文开头,可包含字母、数字、中文及以下特殊字符:点(.)、下划线(_)和中划线(-)。
  • 长度限制为1 ~ 128个字符。
  • 不传入该参数或该参数不传入数值时,默认为实例ID。

Description

String

This is a LB.

负载均衡实例的描述,默认值为空字符串。

  • 必须以字母、数字或中文开头,可包含字母、数字、中文及以下特殊字符:英文逗号(,)、点(.)、下划线(_)、空格( )、等号(=)、中划线(-)、中文逗号(,)、中文句号(。)。
  • 长度限制为0 ~ 255个字符。

VpcId

String

vpc-bp1aevy8sofi8mh1****

负载均衡实例所属的VPC ID。您可以调用DescribeVpcs接口获取VPC ID。
不传入该参数或该参数不传入数值时,默认为子网所属的VPC ID。

SubnetIdStringsubnet-bp12mw1f8k3jgy****负载均衡实例所属VPC内的子网ID。负载均衡实例的私网IP地址将从该子网网段中分配。您可以调用DescribeSubnets接口获取子网ID。

AddressIpVersion

String

ipv4

负载均衡实例的IP地址类型。取值如下:

  • ipv4(默认值):表示该负载均衡为IPv4类型,仅支持转发IPv4请求。
  • DualStack:表示该负载均衡为双栈类型,支持转发IPv4和IPv6请求。

说明

双栈负载均衡功能正在邀测中,如需使用,请联系客户经理。

EniAddressNum

Integer

2

负载均衡实例的私网IPv4地址数量。取值范围为1~5。默认值为1。

  • 该参数正在邀测中,如需使用,请联系客户经理。
  • 该参数和参数EniAddress不能同时传入,如果传入该参数,则无需传入EniAddress

EniAddress

String

192.XX.XX.06

指定负载均衡实例的私网IPv4地址,该地址必须包含在所选子网的IPv4网段中,且未被占用。

说明

不传入该参数或该参数不传入数值时,系统将从子网的IPv4网段中自动分配私网IPv4地址。

EniIpv6Address

String

2408:4005:XX:XX:200

待创建负载均衡实例的私网IPv6地址,该地址必须包含在所选子网的IPv6网段中,且未被占用。

说明

参数AddressIpVersion设置为“DualStack”,且不传入该参数或该参数不传入数值时,系统将从子网的IPv6网段中自动分配私网IPv6地址。

ModificationProtectionStatus

String

ConsoleProtection

负载均衡实例在控制台上修改保护的状态。取值如下:

  • NonProtection:不开启控制台修改保护功能,表示允许通过控制台修改实例或删除实例。
  • ConsoleProtection:开启控制台修改保护功能,表示禁止通过控制台修改实例或删除实例。
不传入该参数或该参数不传入数值时,默认为空,表示不开启控制台修改保护功能。

ModificationProtectionReason

String

托管实例

设置修改保护状态的原因。

  • 必须以字母、数字或中文开头,可包含字母、数字、中文及以下特殊字符:半角句号(.)、下划线(_)和中划线(-)。
  • 长度限制为1 ~ 80个字符。

说明

仅在参数ModificationProtectionStatus配置为ConsoleProtection时有效。

LoadBalancerSpec

String

small_1

负载均衡实例的规格,不同规格提供的转发能力不同,更多信息请参见产品类型与规格。取值如下:

  • small_1:小型I
  • small_2:小型II
  • medium_1:中型I
  • medium_2:中型II
  • large_1:大型I
  • large_2:大型II

说明

  • 参数ExclusiveClusterId不传入或者传入取值为空时,该参数必须填写。
  • 参数LoadBalancerBillingType传入3时,该参数无需传入,默认为clb_lcu(表示单实例默认最大提供100万并发连接、10万新建连接、10Gbps出入带宽和10万QPS)。

LoadBalancerBillingType

Integer

2

负载均衡实例计费方式。

  • 1:包年包月
  • 2(默认值):按量计费--按规格计费
  • 3:按量计费-按使用量计费

EipBillingConfig.ISP

String

BGP

公网负载均衡实例的公网IP线路类型。取值如下:

  • BGP(默认值):BGP多线
  • ChinaMobile:中国移动静态单线
  • ChinaTelecom:中国电信静态单线
  • ChinaUnicom:中国联通静态单线
  • SingleLine_BGP:BGP单线
  • Static_BGP:静态BGP

说明

除BGP(多线)外,其他线路类型均在邀测中,如需使用,请联系客户经理。

EipBillingConfig.EipBillingType

Integer

2

公网IP的计费方式。取值如下:

  • 1:包年包月计费-按带宽上限计费
  • 2:按量计费-按带宽上限计费
  • 3:按量计费-按实际流量计费

说明

  • 创建包年包月类型的公网CLB实例时,不传入该参数或该参数不传入数值则默认为1。
  • 创建按量计费类型的公网CLB实例时,不传入该参数或该参数不传入数值则默认为2。

EipBillingConfig.Bandwidth

Integer

10

公网IP的带宽峰值,默认值为1,单位为Mbps。根据公网计费方式的不同,取值范围有所不同。

  • 参数EipBillingConfig.EipBillingType取值为2时,带宽取值范围为1~500。
  • 参数EipBillingConfig.EipBillingType取值为3时,带宽取值范围为1~200。

EipBillingConfig.BandwidthPackageId

String

bwp-2zeo05qre24nhrqpy****

公网IP待加入的共享带宽包ID。您可以调用DescribeBandwidthPackages接口获取共享带宽包ID。
仅当参数LoadBalancerBillingType配置为2时,该参数生效。

EipBillingConfig.SecurityProtectionTypes.N

String

EipBillingConfig.SecurityProtectionTypes.1=AntiDDoS_Enhanced

公网IP的安全防护类型。取值如下:
AntiDDoS_Enhanced:增强防护类型,该类型的公网IP可以加入到DDoS原生防护(企业版)实例。

  • 不填则表示公网IP为基础防护类型。
  • 参数 - N:表示安全防护类型的序列,当前仅支持取1。

说明

  • 仅当参数LoadBalancerBillingType配置为2时,该参数生效。
  • 公网IP的增强防护功能正在邀测中,如需使用,请联系客户经理。

EipBillingConfig.SecurityProtectionInstanceId

Integer

20

DDoS原生防护(企业版)实例的ID。您可以调用DescInstanceList接口获取DDos原生防护(企业版)实例的ID。

说明

  • 参数EipBillingConfig.SecurityProtectionTypes.N配置为AntiDDoS_Enhanced时,该参数必填。
  • 仅当参数LoadBalancerBillingType配置为2或3时,该参数生效。

PeriodUnit

String

Month

包年包月计费类型的时长单位。取值如下:

  • Month (默认值):按月计费
  • Year:按年计费

说明

当参数LoadBalancerBillingType配置为1时有效。

Period

Integer

1

包年包月计费类型的时长数量。

  • PeriodUnit配置为Month时,取值范围为1~9,12,24和36。
  • PeriodUnit配置为Year时,取值范围为1~3。

说明

  • 当参数LoadBalancerBillingType配置为1时有效。
  • 不传入该参数或该参数不传入数值时,默认为1。
ProjectNameStringdefaultCLB实例所属项目的名称。
不传入该参数或该参数不传入数值时,默认为default。

Tags.N.Key

String

Tags.1.Key=k1&Tags.2.Key=k2

标签的标签键。

  • 长度限制为1~128个字符。
  • 大小写敏感,不能以volc:sys:的任意大小写组合开头。
  • 不能以空格开头或结尾。
  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

说明

同一资源的标签键不允许重复。如果传入的Tags.N.Key与已有标签的标签键重复,则后添加的标签会覆盖原有标签。

Tags.N.Value

String

Tags.1.Value=v1&Tags.2.Value=v2

标签的标签值。

  • 长度限制为1~256个字符。
  • 大小写敏感,不能以空格开头或结尾。
  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

说明

如果传入该参数,则必须先传入Tags.N.Key

返回参数

字段类型示例值
描述
LoadBalancerIdStringclb-bp1o94dp5i6ea****负载均衡实例ID。
RequestIdString20210811152539010225146063030****请求ID。

OrderId

String

Order705261343570982****

订单ID。

说明

仅在参数LoadBalancerBillingType配置为1时,返回该参数。

请求示例

GET /?Action=CreateLoadBalancer&Version=2020-04-01&Type=private&LoadBalancerName=clb-test&VpcId=vpc-bp1aevy8sofi8mh1****&SubnetId=subnet-bp12mw1f8k3jgy****&LoadBalancerSpec=small_1&LoadBalancerBillingType=2 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-shanghai
Service: clb

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20210811152539010225146063030****",
        "Action": "CreateLoadBalancer",
        "Version": "2020-04-01",
        "Service": "clb",
        "Region": "cn-shanghai"
    }, 
    "Result": {
        "RequestId": "20210811152539010225146063030****",
        "LoadBalancerId": "clb-bp1o94dp5i6ea****",
        "OrderId": "Order705261343570982****"
    }
}

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

HttpCode错误码错误信息描述

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the 'XXX'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如XXX

说明

其中,XXX表示缺少的参数名称。

400UnsupportedOperation.AccountArrearsThe request on the specified instance is denied due to the account in arrears status.因账户处于欠费状态,对于该实例的操作请求被拒绝。
400UnsupportedOperation.AccountArrearsThe request on the specified instance is denied due to the account balance and available vouchers are less than 100 yuan in total.因账户余额及可用代金券共不足100元,对于该实例的操作请求被拒绝。
400InvalidBillingType.MalformedThe specified billing type is malformed.指定的计费类型不支持。安全防护EIP只支持按带宽上限计费和按流量计费。
400InvalidBandwidth.MalformedThe specified Bandwidth is malformed.指定的 Bandwidth 参数格式不合法。
400InvalidEipBillingType.MalformedThe specified EipBillingType is malformed.指定的 EipBillingType 参数格式不合法。
400InvalidISP.MalformedThe specified ISP is malformed.指定的 ISP 参数格式不合法。
400QuotaExceed.InstanceNumberYou've reached the limit on the number of instance that you can create.已达到可创建负载均衡实例数量的配额上限。
400QuotaExceed.EipYou've reached the limit on the number of EIP that you can create.已达到可创建公网IP实例数量的配额上限。
400QuotaExceed.EniYou've reached the limit on the number of ENI that you can create.已达到可创建网卡数量的配额上限。
400OrderError.PreOrderFailed to create an order.下单失败。
400OrderError.OrderPayFailed to create order and pay.下单支付失败。
400IdempotentParameterMismatchArguments on this idempotent request are inconsistent with arguments used in previous request(s).此幂等请求的参数与前一个请求中使用的参数不一致。
400InvalidTagKey.MalformedThe specified TagKey is invalid.指定的 TagKey 参数格式不合法。
400InvalidTagValue.MalformedThe specified TagValue is invalid.指定的 TagValue 参数格式不合法。
400InvalidAddressIpVersion.MalformedThe specified AddressIpVersion is malformed.指定的 AddressIpVersion 参数格式不合法。
400LimitExceeded.ServiceManagedTagYou've reached the limit on the number of service managed tags that you can create.已达到单次可创建受管资源标签键值数量的上限。
400LimitExceeded.TagOperationYou've reached the limit on the number of tags that you can operate at a time.已达到单次可操作标签数量的上限。
400InvalidIncorrectOrder.MalformedThe specified index order is malformed.指定的索引顺序参数格式不合法。
400InvalidEniAddress.MalformedThe specified EniAddress is malformed.指定的 EniAddress 参数格式不合法。
400InvalidCount.MalformedThe specified Count is malformed.指定的 Count 参数格式不合法。
400InvalidClientToken.MalformedThe specified ClientToken is malformed.指定的 ClientToken 参数格式不合法。
400InvalidLoadBalancerBillingType.MalformedThe specified LoadBalancerBillingType is malformed.指定的 LoadBalancerBillingType 参数格式不合法。
400InvalidLoadBalancerDescription.MalformedThe specified LoadBalancerDescription is malformed.指定的 LoadBalancerDescription 参数格式不合法。
400InvalidLoadBalancerName.MalformedThe specified LoadBalancerName is malformed.指定的 LoadBalancerName 参数格式不合法。
400InvalidLoadBalancerSpec.MalformedThe specified LoadBalancerSpec is malformed.指定的 LoadBalancerSpec 参数格式不合法。
400InvalidMasterZoneId.MalformedThe specified MasterZoneId is malformed.指定的 MasterZoneId 参数格式不合法。
400InvalidModificationProtectionReason.MalformedThe specified ModificationProtectionReason is malformed.指定的 ModificationProtectionReason 参数格式不合法。
400InvalidModificationProtectionStatus.MalformedThe specified ModificationProtectionStatus is malformed.指定的 ModificationProtectionStatus 参数格式不合法。
400InvalidPeriod.MalformedThe specified Period is malformed.指定的 Period 参数格式不合法。
400InvalidPeriodUnit.MalformedThe specified PeriodUnit is malformed.指定的 PeriodUnit 参数格式不合法。
400InvalidRegionId.MalformedThe specified RegionId is malformed.指定的 RegionId 参数格式不合法。
400InvalidSlaveZoneId.MalformedThe specified SlaveZoneId is malformed.指定的 SlaveZoneId 参数格式不合法。
400InvalidType.MalformedThe specified Type is malformed.指定的 Type 参数格式不合法。
400InvalidEniIpv6Address.MalformedThe specified EniIpv6Address is malformed.指定的 EniIpv6Address 参数格式不合法。
400InvalidAddressIpVersion.MalformedThe specified AddressIpVersion is malformed.指定的 AddressIpVersion 参数格式不合法。
400InvalidSubnetIPv6Cidr.NotSupportThe specified subnet does not support ipv6 cidr.指定子网不支持IPv6网段。
400UnSupportedOperation.AssociatedByPrivateLinkThe specified LoadBalancer associated by PrivateLink.指定的负载均衡被私网连接绑定。
400InvalidProject.MalformedThe specified Project is malformed.指定的 Project 参数格式不合法。
400QuotaExceed.ExclusiveClusterInstanceNumberYou've reached the limit on the number of exclusive cluster instance that you can create.已达到独占集群可创建负载均衡实例数量的配额上限。
400InvalidExclusiveCluster.UnSupportActionThe specified ResourceType does not support this action.指定的独占集群不支持当前操作。
400InvalidEniAddressNum.MalformedThe specified EniAddressNum is malformed.指定的 EniAddressNum 参数格式不合法。
400InvalidParameter.EniAddressNumConflictsTypeThe specified EniAddressNum and Type conflict.指定的 EniAddressNum 和 Type 参数冲突。
400InvalidParameter.EniAddressConflictsEniAddressNumThe specified EniAddress and EniAddressNum conflict.指定的 EniAddress 和 EniAddressNum 参数冲突。
400UnsupportedOperationThe request on the specified instance is denied due to the account in arrears status.因账户处于欠费状态,对于该实例的操作请求被拒绝。
400UnsupportedOperationThe request on the specified instance is denied due to the account balance and available vouchers are less than 100 yuan in total.因账户余额及可用代金券共不足100元,对于该实例的操作请求被拒绝。
403ForbiddenYou are not authorized to perform operations on the service managed tag.无权限对指定资源打上受管标签。
403ForbiddenYou are not authorized to perform operations on the specified service; for example, the 'EniAddressNum'.无权限对指定服务进行操作,比如 EniAddressNum。
404InvalidProject.NotFoundThe specified Project does not exist.指定的项目不存在。
404InvalidVPC.NotFoundThe specified VPC does not exist.指定的 VPC 不存在。
404InvalidSubnet.NotFoundThe specified Subnet does not exist.指定的子网不存在。
404InvalidEipBillingType.NotFoundThe specified EipBillingType does not exist.指定的公网 IP 计费方式不存在。
404InvalidZone.NotFoundThe specified Zone mapping does not exist.指定主备可用区关系不存在。
404InvalidExclusiveCluster.NotFoundThe specified ExclusiveCluster does not exist.指定的独占集群不存在。
412InvalidExclusiveCluster.ExpiredThe specified ExclusiveCluster has expired.指定的独占集群已过期。
412InvalidExclusiveCluster.UnPurchasedThe specified ExclusiveCluster is not purchased.指定的独占集群未购买。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.幂等请求处理中。