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

AssociateEipAddress

最近更新时间2024.04.18 17:01:52

首次发布时间2021.07.31 07:47:47

调用 AssociateEipAddress 接口,将公网IP与云资源绑定。

调用说明

  • 单个账号单个地域下每日最多调用本接口的次数为可申请公网IP数量的3倍。
  • 公网IP与云服务器实例绑定后,二者存在如下关系:
    • 公网IP将如同系统盘、数据盘、主网卡一样,作为云服务器实例的子资源。当云服务器实例变更项目时,公网IP将随之变更项目。
    • 包年包月公网IP续费/退订时,可选择与其绑定的包年包月云服务器一同续费/退订。
    • 包年包月云服务器续费/退订时,可选择与其绑定的包年包月公网IP一同续费/退订。

调试

请求参数

参数名称
类型
是否必选
示例值
描述
ActionStringAssociateEipAddress要执行的操作,取值: AssociateEipAddress。
VersionString2020-04-01API的版本信息,当前版本为2020-04-01。

AllocationId

String

eip-2zeewb7ujxscd****

公网IP的ID。
您可以调用 DescribeEipAddresses 接口,查询公网IP的ID。

InstanceType

String

EcsInstance

待绑云资源的类型。取值如下:

  • Nat:公网NAT网关。
  • NetworkInterface: 网卡。
  • ClbInstance: 负载均衡CLB(私网)。
  • EcsInstance:云服务器ECS。
  • HaVip:高可用虚拟IP。

说明

高可用虚拟IP正在邀测中,如需试用,请联系客户经理。

InstanceIdStringi-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参数。

ClientToken

String

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

保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。取值:

  • 仅支持ASCII字符,且不能超过64个字符。

返回数据

参数名称
类型
示例值
描述
RequestIdString2021062415303301022514515207C4****请求ID。

请求示例

GET /?Action=AssociateEipAddress&Version=2020-04-01&AllocationId=eip-2zeewb7ujxscd****&InstanceType=EcsInstance&InstanceId=i-2zebbhyczzaweeval**** HTTP/1.1
Host: open.volcengineapi.com
Service: vpc
Region: cn-beijing

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2021062415303301022514515207C4****",
        "Action": "AssociateEipAddress",
        "Version": "2020-04-01",
        "Service": "vpc",
        "Region": "cn-beijing"
    },
    "Result":{
        "RequestId": "2021062415303301022514515207C4****"
    }
}

错误码

公共错误码,请参见 公共错误码 。

HttpCode
错误码
错误信息
描述
400IdempotentParameterMismatchArguments on this idempotent request are inconsistent with arguments used in previous request(s).此幂等请求的参数与前一个请求中使用的参数不一致。
400InvalidClb.InUseThe specified CLB instance has already been associated with an anycast elastic ip address.指定的CLB实例已经关联任播公网IP。
400InvalidClb.InUseThe specified CLB has already been associated with an elastic ip address.指定的CLB已经绑定公网IP。
400InvalidClb.InvalidStatusThe specified CLB is not in the correct status for the request. Current CLB has been frozen.指定的CLB所处状态无法响应该请求。当前CLB被冻结。
400InvalidEcs.InUseThe specified ECS instance has already been associated with an anycast elastic ip address.指定的ECS实例已经关联任播公网IP。
400InvalidEip.InstanceMismatchThe specified instance private ip does not support eip association.指定实例的私网IP不支持绑定公网IP。
400InvalidEip.InvalidStatusThe specified elastic ip address is not in the correct status for the request.指定的公网IP所处状态无法响应该请求。
400InvalidEip.InvalidStatusThe specified elastic ip is not in the correct status for the request. The specified elastic ip is in freeze.指定的公网IP或私有网络所处的状态无法响应该请求。当前公网IP被冻结。
400InvalidEni.InUseThe specified elastic network interface has already been associated with an elastic ip address.指定网卡已经绑定公网IP。
400InvalidEni.InvalidTypeThe type of specified elastic network interface is illegal for the request.指定类型的弹性网卡无法响应该请求。
400InvalidHaVip.InUseThe specified HaVip has already been associated with an elastic ip address.指定的高可用虚拟IP已经绑定公网IP。
400InvalidInstance.InUseThe specified ECS has already been associated with an elastic ip address.指定的ECS已经绑定公网IP。
400InvalidInstance.InvalidStatusThe specified ECS is not in the correct status for the request. Current ECS has been frozen.指定的ECS所处状态无法响应该请求。当前ECS被冻结。
400InvalidIpAddress.InUseThe specified IP address of elastic network interface has already been associated with an anycast elastic ip address.指定弹性网卡的IP地址已经关联任播公网IP。
400InvalidNatGateway.InvalidStatusThe operation is not supported by the current nat gateway指定的NAT网关所处的状态无法响应该请求。
400InvalidNatGateway.UnSupportActionThe specified NAT gateway does not support this action.指定的NAT网关不支持当前操作。
400InvalidParameter.ClientTokenMalformedThe specified parameter ClientToken is malformed.指定的参数ClientToken格式不合法,长度不能超过64个ASCII字符。

400

InvalidPrivateIp.InstanceMismatch

The specified private ip and the instance mismatch.

指定的辅助IP和实例不匹配。

说明

更多信息请参见请求参数PrivateIpAddress的说明。

400InvalidPrivateIp.MalformedThe specified private ip is malformed. The specified private ip is not the primary ip of ECS.指定的私网IP不合法。指定的私网IP不是ECS的主私网IP。
400QuotaExceeded.EipThe number of EIPs bound to the NAT gateway exceeded quota.已到达一个NAT网关可绑定公网IP的数量上限。
400QuotaExceeded.ExceedLimitInterface call exceeds limit.接口调用次数超出限制。
403ForbiddenYou are not authorized to perform operations on the specified elastic ip and ALB.无权限操作此EIP和ALB。
403ForbiddenYou are not authorized to perform operations on the specified elastic network interface. The specified elastic network interface is a service-managed elastic network interface.无权限对指定弹性网卡进行操作。指定的弹性网卡为云产品托管的弹性网卡。
403ForbiddenYou are not authorized to perform operations on the specified elastic ip and public CLB.无权限操作此EIP和公网CLB。
403ForbiddenYou are not authorized to perform operations on ESI related resources.无权限操作弹性预约实例关联资源。
404InvalidEip.NotFoundThe specified EIP does not exist.指定的公网IP不存在。
404InvalidEniId.NotFoundThe specified elastic network interface does not exist.指定的弹性网卡不存在。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的实例不存在。
404InvalidInstanceType.NotFoundThe specified instance type does not exist.指定的实例类型不存在。
412IdempotentProcessingThe request uses the same client token as a previous one that is still in process.幂等请求处理中。
412InvalidNatGateway.ExpiredThe specified NAT gateway has expired.指定的NAT网关已到期。