You need to enable JavaScript to run this app.
文档中心
公网IP

公网IP

复制全文
下载 pdf
公网IP
AssociateEipAddress - 绑定公网IP
复制全文
下载 pdf
AssociateEipAddress - 绑定公网IP
调用 AssociateEipAddress 接口,将公网IP与云资源绑定。
使用说明
单个账号单个地域下每日最多调用本接口的次数为可申请公网IP数量的3倍。
调试
API Explorer
您可以通过 API Explorer 在线发起调用,无需关注签名生成过程,快速获取调用结果。
请求参数
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数
Action String 必选 示例值:AssociateEipAddress
要执行的操作,取值:AssociateEipAddress
Version String 必选 示例值:2020-04-01
API的版本信息,当前版本为 2020-04-01
AllocationId String 必选 示例值:eip-2zeewb7ujxscd****
公网IP的ID。
您可以调用 DescribeEipAddresses 接口,查询公网IP的ID。
DirectMode Boolean 可选 示例值:false
绑定公网IP时是否启用直通模式。请严格按照以下枚举值的大小写输入,不要传入其他取值。
  • false(默认):不使用直通模式。
  • true:使用直通模式。
说明
EIP直通功能正在邀测中,如需试用,请联系客户经理申请。
InstanceType String 必选 示例值:EcsInstance
要绑定公网IP的实例的类型。
  • Nat:NAT网关。
  • NetworkInterface: 辅助网卡。
  • ClbInstance: 负载均衡CLB。
  • EcsInstance:云服务器ECS。
  • HaVip:高可用虚拟IP。
InstanceId String 必选 示例值:i-2zebbhyczzaweeval****
待绑定云资源的ID。根据InstanceType传入的参数,传入对应类型云资源的ID。
PrivateIpAddress String 可选 示例值:192.XX.XX.4
要绑定公网IP的实例的私网IP地址。
  • 只支持传入云服务ECS主网卡的私网IP地址和辅助网卡IP地址。
  • 若不填写:InstanceType传入EcsInstance,则绑定云服务器ECS主网卡的主私网IP地址。InstanceType传入NetworkInterface,则绑定辅助网卡主私网IP地址。
说明
在公网IP绑定高可用虚拟IP、NAT网关、负载均衡CLB时,不支持传入PrivateIpAddress参数。
VpcId String 可选 示例值:vpc-257gqcdfvx6n****
与公网IP绑定的VPC ID。
InstanceType 参数取值为 IpAddress 时,该参数必填。仅支持输入开通了IPv4网关功能且与EIP 同地域的VPC ID。
ClientToken String 可选 示例值:123e4567-e89b-12d3-a456-42665544****
保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。取值:
  • 仅支持ASCII字符,且不能超过64个字符。
返回参数
下方仅列出本接口特有的返回参数。更多信息请参见返回结构
RequestId String 示例值:2021062415303301022514515207C4****
请求ID。
请求示例
GET /?Action=AssociateEipAddress&Version=2020-04-01&AllocationId=eip-2zeewb7ujxscd****&InstanceType=EcsInstance&InstanceId=i-2zebbhyczzaweeval**** HTTP/1.1
Host: vpc.cn-beijing.volcengineapi.com
Service: vpc
Region: cn-beijing
返回示例
{
"ResponseMetadata": {
"RequestId": "20230604110420****100232280022D31",
"Action": "AssociateEipAddress",
"Version": "2020-04-01",
"Service": "vpc",
"Region": "cn-north-1"
},
"Result": {
"RequestId": "2021062415303301022514515207C4****"
}
}
错误码
公共错误码请参见公共错误码
状态码
错误码
错误信息
说明
400
DryRunOperation
Exception raised to indicate a successfully authorized action when the DryRun flag is set to true.
该请求设置为DryRun操作,操作授权已获得许可,但未被实际执行。
400
IdempotentParameterMismatch
Arguments on this idempotent request are inconsistent with arguments used in previous request(s).
此幂等请求的参数与前一个请求中使用的参数不一致。
400
InvaildIpv6.NotSupport
The specified IPv6 address does not support this operation.
指定的IPv6地址不支持此操作。
400
InvalidClb.InUse
The specified CLB instance has already been associated with an anycast elastic ip address.
指定的CLB实例已经关联任播公网IP。
400
InvalidClb.InUse
The specified CLB has already been associated with an elastic ip address.
指定的CLB已经关联弹性公网IP。
400
InvalidClb.InvalidStatus
The specified CLB is not in the correct status for the request. Current CLB has been frozen.
指定的CLB所处状态无法响应该请求。当前CLB被冻结。
400
InvalidDirectModeEip.IPv4GatewayEnabled
EIP not allowed to open direct mode when VPC has enabled IPv4 gateway.
VPC已开启IPv4网关,EIP无法开启直通模式。
400
InvalidDirectModeEip.InstanceMismatch
The specified instance type does not support direct mode EIP.
指定的实例类型不支持直通EIP。
400
InvalidDirectModeEip.InvalidBindInstanceType
Only elastic network interface bound to ECS support associating direct mode EIP.
只有绑定了ECS的弹性网卡支持绑定直通EIP。
400
InvalidEcs.InUse
The specified ECS instance has already been associated with an anycast elastic ip address.
指定的ECS实例已经关联任播公网IP。
400
InvalidEip.IPFormatError
IP format error
IP 格式错误。
400
InvalidEip.InUse
The specified EIP is being operated by another request.
指定的EIP正被另一个请求操作,请稍后再试。
400
InvalidEip.InstanceMismatch
The specified instance private ip does not support eip association.
指定的实例类型不支持关联指定的私有IP地址。
400
InvalidEip.InvalidStatus
The specified elastic ip address is not in the correct status for the request.
指定的弹性公网IP所处状态无法响应该请求。
400
InvalidEip.InvalidStatus
The specified elastic ip is not in the correct status for the request.
指定的弹性公网IP所处的状态无法响应该请求。
400
InvalidEip.InvalidStatus
The specified elastic ip is not in the correct status for the request. The specified elastic ip is in freeze.
指定的弹性公网IP或私有网络所处的状态无法响应该请求。当前弹性公网IP被冻结。
400
InvalidEip.PrivateAddressConflict
The specified private address conflicts with another associated with EIP.
指定的私网地址已绑定EIP。
400
InvalidEipMode.Malformed
The specified elastic IP mode is malformed.
指定的EIP模式不合法。
400
InvalidEipOrNat.InvalidStatus
The specified elastic ip or Nat is not in the correct status for the request.
指定的弹性公网IP或Nat网关所处的状态无法响应该请求。
400
InvalidEni.InUse
The specified elastic network interface has already been associated with an elastic ip address.
指定的弹性网卡已经关联弹性公网IP。
400
InvalidEni.InvalidStatus
The specified elastic network interface is not in the correct status for the request.
指定的弹性网卡所处的状态无法响应该请求。
400
InvalidEni.InvalidType
The type of specified elastic network interface is illegal for the request.
指定类型的弹性网卡无法响应该请求。
400
InvalidEniType.Malformed
The specified elastic network interface type is malformed. EIP can not bind to multiPrivateIp elastic network interface when in BINDED mode.
指定的网卡类型不支持。EIP处于可见模式下不支持多私网IP的网卡。
400
InvalidHaVip.InUse
The specified HaVip has already been associated with an elastic ip address.
指定的高可用虚拟IP已经关联弹性公网IP。
400
InvalidInstance.IPv4Disabled
IPv4 has been disabled for the specified instance.
指定实例已经禁用IPv4。
400
InvalidInstance.InUse
The specified ECS has already been associated with an elastic ip address.
指定的ECS已经关联弹性公网IP。
400
InvalidInstance.InvalidStatus
The specified ECS is not in the correct status for the request. Current ECS has been frozen.
指定的ECS所处状态无法响应该请求。当前ECS被冻结。
400
InvalidInstanceType.Malformed
The specified instance type is malformed. Instance type can only support NetworkInterface when EIP is in BINDED mode.
指定的实例类型不合法。EIP处于可见模式下只支持绑定辅助网卡。
400
InvalidIpAddress.InUse
The specified IP address of elastic network interface has already been associated with an anycast elastic ip address.
指定弹性网卡的IP地址已经关联任播公网IP。
400
InvalidModeEip.DirectMode
EIP not allowed to open direct mode.
EIP 无法开启直通模式。
400
InvalidNatBindEip.AssignPrivateIpAddressFailed
The specified nat gateway assign private ip address failed.
指定的NAT网关分配私网地址失败。
400
InvalidNatGateway.InvalidStatus
The specified NAT gateway is not in the correct status for the request.
指定的NAT网关所处的状态无法响应该请求。
400
InvalidNatGateway.UnSupportAction
The specified NAT gateway does not support this action.
指定的NAT网关不支持当前操作。
400
InvalidOperation.InvalidBindInstanceType
Only EIPs bound to ECS support releasing with instances.
EIP随实例释放功能只对绑定ECS实例时生效。
400
InvalidOperation.InvalidEipBillingType
Only postpaid EIPs support releasing with instances.
只有按量付费EIP支持随实例释放功能。
400
InvalidParameter
A parameter specified in the request is not valid, is unsupported or cannot be used.
该请求传入了非法或不支持的参数。
400
InvalidParameter.ClientTokenMalformed
The specified parameter ClientToken is malformed.
指定的参数ClientToken格式不合法,长度不能超过64个ASCII字符。
400
InvalidPrivateIp.Duplicated
The specified private ip address duplicated.
指定的私网ip地址重复了。
400
InvalidPrivateIp.IPFormatError
The specified private IP format error.
指定的辅助 IP 格式错误。
400
InvalidPrivateIp.InstanceMismatch
The specified private ip and the instance mismatch.
指定的辅助IP和实例不匹配。
400
InvalidPrivateIp.Malformed
The specified private ip is malformed. The specified private ip is not the primary ip of ECS.
指定的私网IP不合法。指定的私网IP不是ECS的主私网IP。
400
InvalidVpc.IPv4GatewayDisabled
IPv4 gateway attached to the specified VPC is disabled.
指定的VPC未开启IPv4网关。
400
InvalidVpc.InvalidStatus
The specified VPC is not in the correct status for the request.
指定的VPC所处状态无法响应该请求。
400
InvalidZone.Malformed
Gateway service not ready in the specified zone.
指定zone内的网关服务未就绪。
400
LimitExceeded.Eip
You've reached the limit on the number of EIPs that you can operate per action.
已达到单次操作EIP数量上限。
400
MissingParameter
The request is missing a required parameter.
该请求缺少必要参数。
400
QuotaExceeded.Eip
The number of EIPs bound to the NAT gateway exceeded quota.
已到达一个NAT网关可绑定公网IP的数量上限。
403
Forbidden
You are not authorized to perform operations on the specified EIP. The specified EIP is a service-managed EIP.
无权限对指定EIP进行操作。指定的EIP为云产品托管的EIP。
403
Forbidden
You are not authorized to perform operations on the specified elastic ip and public CLB.
无权限操作此EIP和公网CLB。
403
Forbidden
You are not authorized to associate direct mode EIP with ECS.
无权限绑定直通EIP到ECS上。
403
Forbidden
You are not authorized to perform operations on ESI related resources.
无权限操作弹性预约实例关联资源。
403
Forbidden
You are not authorized to perform operations on the specified elastic network interface. The specified elastic network interface is a service-managed elastic network interface.
无权限对指定弹性网卡进行操作。指定的弹性网卡为云产品托管的弹性网卡。
403
Forbidden
You are not authorized to associate EIP by IP address.
无权限使用IP Address绑定EIP。
403
Forbidden
You are not authorized to perform operations on the specified elastic ip and ALB.
无权限操作此EIP和ALB。
403
Forbidden
You are not authorized to associate binded EIP on elastic network interface.
无权限绑定直通EIP到弹性网卡上。
404
InvalidEip.NotFound
The specified EIP does not exist.
指定的EIP不存在。
404
InvalidEniId.NotFound
The specified elastic network interface does not exist.
指定的弹性网卡不存在。
404
InvalidHaVip.NotFound
The specified HaVip does not exist.
指定的高可用虚拟IP不存在。
404
InvalidInstance.NotFound
The specified instance does not exist.
指定的实例不存在。
404
InvalidInstanceType.NotFound
The specified instance type does not exist.
指定的instance type不可用。
404
InvalidNatGateway.NotFound
The specified NAT gateway does not exist.
指定的NAT网关不存在。
404
InvalidVpc.NotFound
The specified VPC does not exist.
指定的VPC不存在。
404
InvalidZoneId.NotFound
The specified zone does not exist.
指定的可用区不存在。
409
InvalidOperation.Conflict
The specified resource operation conflicts.
指定的资源操作冲突。
412
IdempotentProcessing
The request uses the same client token as a previous one that is still in process.
幂等请求处理中。
412
InvalidNatGateway.Expired
The specified NAT gateway has expired.
指定的NAT网关已到期。
500
InternalError
An internal error has occurred.
发生内部错误。
最近更新时间:2026.02.05 14:38:18
这个页面对您有帮助吗?
有用
有用
无用
无用