调用CreateLoadBalancer接口创建传统型负载均衡实例。

注意事项

  • 实例创建前,请调用DescribeAvailableResource查询可用区支持的资源售卖情况。
  • 实例创建后,会产生费用。
  • 按量付费模式支持创建按规格计费实例和按使用量计费实例。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String CreateLoadBalancer

系统规定参数。取值:CreateLoadBalancer

RegionId String cn-hangzhou

传统型负载均衡实例的地域ID。

您可以通过调用DescribeRegions接口查询地域ID。

AddressType String internet

传统型负载均衡实例的网络类型。取值:

  • internet:创建公网负载均衡实例后,系统会分配一个公网IP地址,可以转发公网请求。
  • intranet:创建专有网络类型的负载均衡实例后,系统会分配一个内网IP地址,仅可转发内网请求。
InternetChargeType String paybytraffic

公网类型实例的付费方式。取值:

  • paybytraffic(默认值):按使用流量计费。
    说明 如果选择了paybytraffic,无需设置Bandwidth的值;如您设置了Bandwidth值,该值也不会生效。
  • paybybandwidth:按固定带宽计费。
说明PayType取值PayOnDemandInstanceChargeType取值PayByCLCU时,该参数仅支持取值paybytraffic
Bandwidth Integer 10

监听的带宽峰值,单位:Mbps。

取值范围:15120。对于按带宽计费的公网负载均衡实例,可以设置每个监听的带宽峰值,但所有监听的带宽峰值之和不能超过实例的带宽峰值。

ClientToken String 593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3

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

由客户端生成该参数值,要保证在不同请求间唯一。

说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。
LoadBalancerName String lb-bp1o94dp5i6ea****

传统型负载均衡实例的名称。

长度为1~80个英文或中文字符,必须以大小写字母或中文开头,可包含数字、半角句号(.)、下划线(_)和短划线(-)。

不指定该参数时,默认由系统分配一个实例名称。

VpcId String vpc-bp1aevy8sofi8mh1****

传统型负载均衡实例的所属的VPC ID。

VSwitchId String vsw-bp12mw1f8k3jgy****

专有网络实例的所属的交换机ID。

创建专有网络类型的负载均衡实例,必须指定该参数。如果指定了该参数,AddessType参数的值会默认被设置为intranet

MasterZoneId String cn-hangzhou-b

传统型负载均衡实例的主可用区ID。

您可以通过调用DescribeZone接口可查到相应地域下的主备可用区信息。

SlaveZoneId String cn-hangzhou-d

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

您可以通过调用DescribeZone接口查询相应地域下的主备可用区信息。

LoadBalancerSpec String slb.s1.small

传统型负载均衡实例的规格。取值:

  • slb.s1.small
  • slb.s2.small
  • slb.s2.medium
  • slb.s3.small
  • slb.s3.medium
  • slb.s3.large
    说明 若不指定规格,则创建性能共享型实例。目前,共享型实例已停止售卖,请指定实例规格。

InstanceChargeType取值为PayByCLCU,该参数不生效,您无需配置该参数。

ResourceGroupId String rg-atstuj3rtopt****

企业资源组ID。

PayType String PayOnDemand

实例的计费类型,取值:

  • PayOnDemand:按量付费。
  • PrePay:包年包月。
    说明 如果该参数设置为PrePay,即表示创建包年包月实例,则Duration参数必选。
PricingCycle String month

预付费公网实例的计费周期,取值:

  • month:月。
  • year:年。
说明 该参数仅适用于中国站且仅对包年包月实例有效。
Duration Integer 1

预付费公网实例的购买时长,取值:

  • 如果PricingCyclemonth,取值为1~9
  • 如果PricingCycleyear,取值为1~5
说明 该参数仅适用于中国站且仅对包年包月实例有效。
AutoPay Boolean true

是否是自动支付预付费公网实例的账单。取值:

  • true:自动支付。调用API后,立即生成SLB实例。
  • false(默认值):调用API后SLB的订单创建成功,但是未支付。您可以在控制台看到未支付订单。由于订单未支付,SLB实例不会被创建出来。
说明 该参数仅适用于中国站且仅对包年包月实例有效。
AddressIPVersion String ipv4

传统型负载均衡实例的IP版本,取值:ipv4ipv6

Address String 192.168.XX.XX

指定实例的私网IP地址,该地址必须包含在交换机的目标网段下。

DeleteProtection String on

是否开启实例删除保护。取值:

  • on:是。
  • off:否。
ModificationProtectionStatus String ConsoleProtection

传统型负载均衡修改保护状态:

  • NonProtection:不限制修改保护,设置后会清空之前设置的ModificationProtectionReason
  • ConsoleProtection:实例控制台修改保护状态。
说明 当取值为ConsoleProtection,即开启修改保护后,用户不能通过负载均衡控制台修改实例配置,但可以通过调用API修改实例配置。
ModificationProtectionReason String Managed instance

设置修改保护状态的原因,长度为1~80个字符,必须以字母或中文开头,支持数字、半角句号(.)、下划线(_)和短划线(-)。

说明 仅在ModificationProtectionStatusConsoleProtection时有效。
InstanceChargeType String PayBySpec

实例计费方式。取值:

  • PayBySpec(默认值):按规格计费。
  • PayByCLCU:按使用量计费。
说明 该参数仅适用于中国站且仅当PayType(实例付费模式)取值为PayOnDemand(按量付费)时,该参数生效。

返回数据

名称 类型 示例值 描述
VpcId String vpc-25dvzy9****

传统型负载均衡实例的所属专有网络的ID。

AddressIPVersion String ipv4

传统型负载均衡实例的IP地址类型。

VSwitchId String vsw-255ecr****

传统型负载均衡实例的所属交换机的ID。

RequestId String 365F4154-92F6-4AE4-92F8-7FF34B540710

请求ID。

LoadBalancerName String lb-bp1o94dp5i6ea****

传统型负载均衡实例的名称。

LoadBalancerId String lb-hddhfjg****

传统型负载均衡实例的ID。

ResourceGroupId String rg-atstuj3rto****

资源组ID。

Address String 42.XX.XX.6

分配的负载均衡实例的IP地址。

NetworkType String classic

传统型负载均衡实例的网络类型,取值:

  • vpc:专有网络实例。
  • classic:经典网络实例。
OrderId Long 20212961978****

预付费实例的订单ID。

示例

请求示例

http(s)://[Endpoint]/?Action=CreateLoadBalancer
&RegionId=cn-hangzhou
&AddressType=internet
&InternetChargeType=paybytraffic
&Bandwidth=10
&ClientToken=593B0448-D13E-4C56-AC0D-FDF0FDE0E9A3
&LoadBalancerName=lb-bp1o94dp5i6ea****
&VpcId=vpc-bp1aevy8sofi8mh1****
&VSwitchId=vsw-bp12mw1f8k3jgy****
&MasterZoneId=cn-hangzhou-b
&SlaveZoneId=cn-hangzhou-d
&LoadBalancerSpec=slb.s1.small
&ResourceGroupId=rg-atstuj3rtopt****
&PayType=PayOnDemand
&PricingCycle=month
&Duration=1
&AutoPay=true
&AddressIPVersion=ipv4
&Address=192.168.XX.XX
&DeleteProtection=on
&ModificationProtectionStatus=ConsoleProtection
&ModificationProtectionReason=Managed instance
&InstanceChargeType=PayBySpec
&公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateLoadBalancerResponse>
    <VpcId>vpc-25dvzy9****</VpcId>
    <AddressIPVersion>ipv4</AddressIPVersion>
    <VSwitchId>vsw-255ecr****</VSwitchId>
    <RequestId>365F4154-92F6-4AE4-92F8-7FF34B540710</RequestId>
    <LoadBalancerName>lb-bp1o94dp5i6ea****</LoadBalancerName>
    <LoadBalancerId>lb-hddhfjg****</LoadBalancerId>
    <ResourceGroupId>rg-atstuj3rto****</ResourceGroupId>
    <Address>42.XX.XX.6</Address>
    <NetworkType>classic</NetworkType>
</CreateLoadBalancerResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "VpcId" : "vpc-25dvzy9****",
  "AddressIPVersion" : "ipv4",
  "VSwitchId" : "vsw-255ecr****",
  "RequestId" : "365F4154-92F6-4AE4-92F8-7FF34B540710",
  "LoadBalancerName" : "lb-bp1o94dp5i6ea****",
  "LoadBalancerId" : "lb-hddhfjg****",
  "ResourceGroupId" : "rg-atstuj3rto****",
  "Address" : "42.XX.XX.6",
  "NetworkType" : "classic"
}

错误码

HttpCode 错误码 错误信息 描述
400 OperationFailed.ZoneResourceLimit The operation failed because of resource limit of the specified zone. 操作失败,原因是当前可用区资源不足。
400 CloudBoxNotSupportIpv6 The cloudBox instance does not support ipv6. 云盒实例不支持ipv6
400 CloudBoxNotSupportInternet The cloudBox instance does not support internet. 云盒实例不支持internet
400 OperationFailed.RegionResourceLimit The operation failed because of resource limit of the specified region. 操作失败,原因是指定地域资源不足。
400 Operation.NotAllowed Operation Denied. The charge type of internet prepay instance can only be paybybandwidth. 操作被拒绝,原因是公网预付费实例只支持按带宽计费。
400 Operation.NotAllowed Operation Denied. The charge type of intranet prepay instance can only be paybytraffic. 操作被拒绝,原因是私网预付费实例只支持按流量计费。
400 OperationFailed.UnpaidBillsExist The account has unpaid bills. Please pay your overdue bill first. 操作失败,原因是当前账户下存在未支付账单。请先支付您的逾期账单。
400 RegionOrZonesNotSupportIpv6 The specified region or master/slave zones does not support ipv6. 指定地域或主备可用区不支持Ipv6。
400 InvalidParameter.Mismatch AddressType and IpVersion is conflict, IPv6 does not support intranet instance. 网络类型和IP版本冲突,私网实例不支持IPv6。
400 HighRiskOperationDenied The operation is denied because of high risk. 操作被拒绝,原因是当前操作为高危操作。
400 VSwitchAvailableIpNotExist The specified VSwitch has no availabe ip. 指定的交换机没有可用的Ip。
400 VSwitchNotExist The specified VSwitch does not exist. 指定的交换机不存在。
400 InvalidParameter Illegal parameter. The IP address is not in subnet. 参数非法,IP地址不在子网中。
400 Instance.ShareSlbNotSupportPay95 Illegal parameter. The share instance not support PayBy95 or PayByOld95. 共享型实例不支持PayBy95或PayByOld95。
400 Instance.Pay95RateInvalid Illegal parameter. The rate is illegal. 指定的Rate无效。请检查参数约束,并在修改后重试。
400 Instance.Pay95BandwidthIllegal Illegal parameter. The bandwidth is illegal. 指定的Bandwidth无效。请检查参数约束,并在修改后重试。
400 Instance.InternetChargeTypeNotAllowed Illegal parameter. The specified InternetChargeType not allowed. 参数非法,指定的InternetChargeType不支持。
400 OperationFailed.TokenIsProcessing The operation is failed, because the Client Token is processing. 操作失败,原因是当前请求正在处理中。
400 MissingParam.VSwitchId The parameter VSwitchId is required. 参数VSwitchId缺失。
400 InvalidVpcId.NotExist The specified VPC not exist. 指定的VPC不存在。
400 InvalidParameter.CloudType The specified CloudType is invalid. 指定的CloudType无效。请检查参数约束,并在修改后重试。
400 OperationFailed.InvalidAccount The account information is incomplete. 操作失败,原因是账户信息不完整。
400 RegionOrZonesNotSupportCEN The specified region or master/slave zones does not support cloudType of hybrid_cen. 指定的地域或主备可用区不支持CEN。
400 MissingParam.LoadBalancerSpec The param LoadBalancerSpec is required. 参数LoadBalancerSpec缺失。
400 InvalidParameter.Bandwidth The param Bandwidth is invalid. 指定的Bandwidth无效。请检查参数约束,并在修改后重试。
400 OperationForbidden.AccountRiskReject The operation failed because of account risk reject. 操作失败,原因是当前账户已被风控。
400 OperationForbidden.QuotaLimit The operation failed because of quota limit of shared loadbalancers. 操作失败,原因是共享性实例数量已达配额上限。
400 InvalidParam.ModificationProtectionStatus The param ModificationProtectionStatus is invalid. 指定的ModificationProtectionStatus无效。请检查参数约束,并在修改后重试。
400 InvalidParam.ModificationProtectionReason The param ModificationProtectionReason is invalid. 指定的ModificationProtectionReason无效。请检查参数约束,并在修改后重试。
400 InvalidParam.ModificationProtectionReason %s. 指定的ModificationProtectionReason无效。请检查参数约束,并在修改后重试。
400 ShareSlbHaltSales The share instance has been discontinued. 共享型负载均衡实例已售罄。
400 OperationFailed.CashBookInsufficient No payment method is specified for your account, We recommend that you add a payment method or maintain a prepayment balance. 操作失败,原因是您的账户未指定付款方式,我们建议您添加付款方式或保持预付款余额。
400 OperationFailed.OnlyInnerCommoditySupportToPurchase AliCroup2Cloud user only can buy inner commodity. 操作失败,原因是集团上云用户只能购买内部商品。
400 OperationFailed.InvokeLingXiaoFailed Failed to invoke lingxiao service. 操作失败,原因是调用凌霄服务失败。
400 AllocateVpcInstanceFailed Failed to allocate vpc instance. 分配VPC实例失败。
400 QueryCreditCtrlInfoFailed Failed to query credit ctrl info. 查询用户信息失败。
400 QueryCommodityCenterFailed Failed to query commodity center. 商品中心查询失败。
400 RegionNotSupportParameter Current region does not support the param of %s. 当前地域不支持指定参数。
400 QueryAccountBookInfoFailed Failed to invoke account book info. 调用账本信息失败。
400 RateAccountFailed Failed to rate account for pricing. 调用定价服务失败。
400 TradeWaitDistributorAudit The trade needs distributor to audit. 此次交易待经销商审核。
400 OperationFailed.InvokeProxyFailed Failed to invoke proxy. 操作失败,原因是调用管控失败。
400 QueryAccountCompleteProgressFailed Failed to query account progress. 查询账户进度失败。
400 QueryVoucherInfoFailed Failed to query voucher info. 查询凭证信息失败。
400 InvalidVSwitchId.NotFound The specified vSwitch instance is invalid. 非法的vswitch实例。
400 IllegalParam.SpecType The param of SpecType is illegal. 指定的SpecType无效。请检查参数约束,并在修改后重试。
400 MissingParam.SpecType The param of SpecType is missing. 参数SpecType缺失。
400 UnsupportedRegion The feature is not supported in current region. 当前地域不支持该功能。
400 PayInsufficientBalance Your account balance is insufficient. 您的账户余额不足
400 IllegalParam.InstanceChargeType The parameter InstanceChargeType is illegal. 指定的InstanceChargeType非法。
400 SystemBusy The system is busy. 系统繁忙,请您稍后再试。
400 PRODUCT.NOT_AVAILABLE_IZ The Instance zone id doesn t support 实例可用区ID不支持。
400 PRICE.INQUIRY_FAILED The instance pricing inquiry is failed. 实例定价查询失败。
400 SDK.ServerUnreachable Service is unreachable. 暂时无法访问服务,请稍后重试。

访问错误中心查看更多错误码。