调用AllocateEipAddressPro接口申请指定的弹性公网IP(Elastic IP Address,简称EIP)。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AllocateEipAddressPro | 系统规定参数。取值:AllocateEipAddressPro。 |
RegionId | String | 是 | cn-hangzhou | 要指定申请的EIP所在的地域ID。 您可以通过调用DescribeRegions接口获取地域ID。 |
IpAddress | String | 否 | 192.0.XX.XX | 要指定申请的EIP的IP地址。 IpAddress和InstanceId参数仅需传入一个,如果都不传,系统会随机申请EIP。 |
InstanceId | String | 否 | eip-25877c70gddh**** | 要指定申请的EIP的实例ID。 IpAddress和InstanceId参数仅需传入一个,如果都不传,系统会随机申请EIP。 |
Bandwidth | String | 否 | 5 | 要指定申请的EIP的带宽峰值,单位:Mbps。
默认值:5 Mbps。 |
Period | Integer | 否 | 1 | 购买时长。
如果InstanceChargeType参数的值为PrePaid时,该参数必选。 如果InstanceChargeType参数的值为PostPaid时,该参数不填。 |
ISP | String | 否 | BGP | 线路类型。取值:
关于BGP(多线)线路和BGP(多线)_精品线路的更多信息,请参见EIP线路类型。
|
Netmode | String | 否 | public | 网络类型,仅取值为public(默认值),表示公网。 |
AutoPay | Boolean | 否 | true | 是否自动付费,取值:
当InstanceChargeType参数的值为PrePaid时,该参数必选;当InstanceChargeType参数的值为PostPaid时,该参数可不填。 |
PricingCycle | String | 否 | Month | 包年包月的计费周期,取值:
当InstanceChargeType参数的值为PrePaid时,该参数必选;当InstanceChargeType参数的值为PostPaid时,该参数可不填。 |
InstanceChargeType | String | 否 | PostPaid | 要指定申请的EIP的计费方式,取值:
当InstanceChargeType取值为PrePaid时,InternetChargeType必须取值PayByBandwidth。 当InstanceChargeType取值为PostPaid时,InternetChargeType可取值PayByBandwidth或PayByTraffic。 |
InternetChargeType | String | 否 | PayByBandwidth | 要指定申请的EIP的计量方式,取值:
当InstanceChargeType取值为PrePaid时,InternetChargeType必须取值PayByBandwidth。 当InstanceChargeType取值为PostPaid时,InternetChargeType可取值PayByBandwidth或PayByTraffic。 |
ResourceGroupId | String | 否 | rg-resourcegroup**** | 要指定申请的EIP所属的资源组ID。 |
ClientToken | String | 否 | 0c593ea1-3bea-11e9-b96b-88e9fe6**** | 客户端Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持ASCII字符。 说明 若您未指定,则系统自动使用API请求的RequestId作为ClientToken标识。每次API请求的RequestId不一样。 |
SecurityProtectionTypes.N | String | 否 | AntiDDoS_Enhanced | 安全防护级别。
您最多可以为10个EIP设置安全防护级别。 |
PublicIpAddressPoolId | String | 否 | pippool-2vc0kxcedhquybdsz**** | IP地址池ID。 EIP将从该IP地址池中分配。 IP地址池功能默认不开放。如需使用,请在配额中心申请IP地址池功能权益配额。具体操作,请参见通过配额中心提升配额。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
RequestId | String | 4EC47282-1B74-4534-BD0E-403F3EE64CAF | 请求ID。 |
OrderId | Long | 20190000 | 订单号。仅InstanceChargeType取值为PrePaid时返回。 |
ResourceGroupId | String | rg-resourcegroup**** | 资源组ID。仅InstanceChargeType取值为PostPaid时返回。 |
EipAddress | String | 192.0.XX.XX | 您指定申请的EIP被分配到的IP地址。仅InstanceChargeType取值为PostPaid时返回。 |
AllocationId | String | eip-25877c70gddh**** | EIP的ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=AllocateEipAddressPro
&RegionId=cn-hangzhou
&IpAddress=192.0.XX.XX
&InstanceId=eip-25877c70gddh****
&Bandwidth=5
&Period=1
&ISP=BGP
&Netmode=public
&AutoPay=true
&PricingCycle=Month
&InstanceChargeType=PostPaid
&InternetChargeType=PayByBandwidth
&ResourceGroupId=rg-resourcegroup****
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe6****
&SecurityProtectionTypes=["AntiDDoS_Enhanced"]
&PublicIpAddressPoolId=pippool-2vc0kxcedhquybdsz****
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AllocateEipAddressProResponse>
<RequestId>4EC47282-1B74-4534-BD0E-403F3EE64CAF</RequestId>
<OrderId>20190000</OrderId>
<ResourceGroupId>rg-resourcegroup****</ResourceGroupId>
<EipAddress>192.0.XX.XX</EipAddress>
<AllocationId>eip-25877c70gddh****</AllocationId>
</AllocateEipAddressProResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "4EC47282-1B74-4534-BD0E-403F3EE64CAF",
"OrderId" : 20190000,
"ResourceGroupId" : "rg-resourcegroup****",
"EipAddress" : "192.0.XX.XX",
"AllocationId" : "eip-25877c70gddh****"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParameter | Specified value of "Bandwidth" is not valid. | 该带宽不合法。 |
400 | InsufficientBalance | Your account does not have enough balance. | 账户余额不足,请先充值再操作。 |
400 | QuotaExceeded.Eip | Elastic IP address quota exceeded. | 弹性公网IP的个数超过额度限制,如果您有更多额度的需求,建议您考虑使用NAT网关。 |
400 | ReserveIpFail | Reserve eip failed. | EIP预留失败。 |
400 | InvalidRegion.NotSupport | The specified region does not support. | 该 RegionId 不支持此操作。 |
400 | InvalidResourceGroupId | The specified ResourceGroupId does not exist. | 资源组ID不存在。 |
400 | OperationFailed.AllocateUnfamiliarIp | The operation failed because only IP addresses used within the last seven days can be allocated. | 指定EIP申请只允许申请7天内使用过的IP |
400 | OperationFailed.RiskControl | Risk control check failed. | 我们检测到您的付款方式存在安全风险。请通过电子邮件或控制台消息中的链接继续验证,并在验证后重新提交订单。 |
400 | OrderError.EIP | The Account failed to create order. | 下单失败 |
400 | Mismatch.IpAndIsp | The specified IP address does not match the ISP. | 申请指定IP失败,ISP和IP参数不匹配. |
400 | IncorrectStatus.PublicIpAddressPool | The status of PublicIpAddressPool is incorrect. | 地址池实例未处于稳态,不允许分配EIP。 |
403 | Forbbiden | User not authorized to operate on the specified resource. | 您没有权限操作该资源,请您申请操作权限后再试。 |
500 | InternalError | The request processing has failed due to some unknown error, exception or failure. | 内部错误 |
访问错误中心查看更多错误码。