AssociateEipAddress - 将EIP绑定到云产品实例

更新时间:
复制 MD 格式

调用AssociateEipAddress将弹性公网IP(EIP)绑定到同地域的云产品实例上。

接口说明

  • EIP 实例可绑定到同地域的专有网络类型的 ECS 实例、专有网络类型的 CLB 实例、辅助弹性网卡、NAT 网关和高可用虚拟 IP 上。

  • AssociateEipAddress 接口属于异步接口,即系统会先返回一个请求 ID,但 EIP 实例与云产品实例并未绑定完成,系统后台的绑定任务仍在进行。您可以调用 DescribeEipAddresses 查询 EIP 实例的状态:

    • 当 EIP 实例处于 Associating 状态时,表示 EIP 实例正在绑定中,在该状态下,您只能执行查询操作,不能执行其他操作。

    • 当 EIP 实例处于 InUse 状态时,表示 EIP 实例绑定完成。

  • AssociateEipAddress 接口不支持同一个 EIP 实例并发绑定云产品实例。

调试

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

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

vpc:AssociateEipAddress

update

*Address

acs:vpc:{#regionId}:{#accountId}:eip/{#AllocationId}

NatGateway

acs:vpc:{#regionId}:{#accountId}:natgateway/{#NatGatewayId}

Instance

acs:vpc:{#regionId}:{#accountId}:instance/{#InstanceId}

Association

acs:vpc:{#regionId}:{#accountId}:havip/{#HaVipId}

请求参数

名称

类型

必填

描述

示例值

RegionId

string

要绑定云产品实例的 EIP 所在的地域 ID。

您可以通过调用 DescribeRegions 接口获取地域 ID。

cn-hangzhou

AllocationId

string

绑定云产品实例的 EIP 的 ID。

eip-2zeerraiwb7ujsxdc****

InstanceId

string

要绑定 EIP 的实例 ID。

支持输入 NAT 网关实例 ID、传统型负载均衡 CLB 实例 ID、云服务器 ECS 实例 ID、辅助弹性网卡实例 ID、高可用虚拟 IP 实例 ID、IP 地址。

i-2zebb08phyczzawe****

InstanceType

string

要绑定 EIP 的实例的类型,取值:

  • Nat:NAT 网关。

  • SlbInstance:传统型负载均衡 CLB。

  • EcsInstance(默认值):云服务器 ECS。

  • NetworkInterface:辅助弹性网卡。

  • HaVip:高可用虚拟 IP。

  • IpAddress:IP 地址。

说明

默认要绑定 EIP 的实例类型为 EcsInstance,如果您需要绑定 EIP 的实例类型不为 EcsInstance,则该值必填。

EcsInstance

InstanceRegionId

string

要绑定 EIP 的实例所属地域的 ID。

说明

仅在 EIP 加入到带宽共享型全球加速实例后,才需要填写该参数。

cn-hangzhou

PrivateIpAddress

string

交换机网段内的一个 IP 地址。

如果不输入该参数,系统根据 VPC ID 和交换机 ID 自动分配一个私网 IP 地址。

说明

InstanceType 配置为 NetworkInterface 时,该参数必填,需输入要绑定的私网 IP。

192.168.XX.XX

Mode

string

绑定模式,取值:

  • NAT(默认值):NAT 模式(普通模式)。

  • MULTI_BINDED:多 EIP 网卡可见模式。

  • BINDED:EIP 网卡可见模式。

说明

InstanceType 配置为 NetworkInterface 时,才需要配置该参数。

NAT

VpcId

string

开通了 IPv4 网关功能且与 EIP 同地域的 VPC ID。

EIP 绑定 IP 地址时,系统可以根据该 VPC 的路由配置,使绑定的 IP 地址具备公网访问能力。

说明

InstanceType 取值为 IpAddress 时,即要绑定 EIP 的实例类型为 IP 地址时,该参数必填。

vpc-257gqcdfvx6n****

ClientToken

string

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

从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。

说明

若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。

0c593ea1-3bea-11e9-b96b-88e9fe63****

返回参数

名称

类型

描述

示例值

object

返回信息列表。

RequestId

string

请求 ID。

0ED8D006-F706-4D23-88ED-E11ED28DCAC0

示例

正常返回示例

JSON格式

{
  "RequestId": "0ED8D006-F706-4D23-88ED-E11ED28DCAC0"
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidAssociation.Duplicated Specified instance already is associated.
400 OperationDenied Specified instance is not in VPC.
400 InvalidParameter.Mismatch Specified elastic IP address and ECS instance are not in the same region.
400 IncorrectEipStatus Current elastic IP status does not support this operation
400 IncorrectInstanceStatus Current instance status does not support this operation.
400 InvalidInstanceType.ValueNotSupported The specified value of InstanceType is not supported.
400 IncorrectHaVipStatus HaVip can be operated by this action only when it's status is Available or InUse. Havip实例为AvailableInUse才允许操作
400 InvalidParameter The specified parameter is not valid.
400 InvalidBindingStatus The eip binding status invalid.
400 BIND_INSTANCE_HAVE_PORTMAP_OR_BIND_EIP The instance may have portMap or already bind eip. ECS 实例已经存在端口转发规则(DNAT),请删除相应的端口转发规则再进行操作。
400 EIP_CAN_NOT_ASSOCIATE_WITH_PUBLIC_IP instance already bind natpublicip,cannot bind eip.
400 BIND_INSTANCE_OWENER_ERROR Cannot operate the eip.
400 NATGATEWAY_FINANCIALLOCKED The NatGateway has expire, cannot do bind operation.
400 InvalidParameter.InstanceTypeNotSupport The specified instance type is not support.
400 QuotaExceeded.NumberOfTrafficEip The number of traffic eip on natgw exceed limitation.
400 QuotaExceeded.NumberOfEip Binded eip Quota exceed on this NatGw. NAT网关上,绑定的EIP数量已经超出配额限制
400 Forbidden.EipCanNotBindGatgw Eip can not bind on natgw.
400 InvalidAction.Denied Action is denied due to unfinished Eip configuration modification. 由于未完成Eip配置修改,操作被拒绝。
400 InstanceType.NotSupport The instance type is invalid.
400 InvalidParams.NotFound instance not found
400 BindInstance.NotSupported bind instance type %s is not supported.
400 Forbidden.InstanceBandwidthNotZero Eip can not bind with instance when it's bandwidth is not zero.
400 INSTANCE_TYPE_NOT_SUPPORT The instance type is invalid.
400 ServerRegion.Invalid Eip bind remote server region invalid.
400 Eni.Attached The eni should be detached from ecs when associating with direct eip. ENI绑定直通EIP时,需要ENIECS解绑
400 Eni.HasSubIp Eni has sub ip can not bind direct eip.
400 Invalid.DirectEip.BindType The direct eip can be only associated with eni.
400 InvalidStatus.EcsStatusNotSupport The special instance status is not support operate
400 Invalid.Function.NotSupported Multi-IP function is under test, the region or uid is not supported.
400 InvalidStatus.EniStatusNotSupport %s
400 InvalidParameter.EniInstanceId %s
400 InvalidNexthop.DirectEni The direct Eni cannot be nexthop. 直通Eni不能作为下一跳
400 Mode.Conflict The eni can bind only one mode of eip.
400 Mode.NotSupport The user cannot use multi direct eip.
400 QuotaExceed.MultiBindedEip The number of multi binded eip is over limit. 可以绑定的多直通模式eip数目超过限制。
400 InvalidEIPStatus.BizDisabled The EIP has been locked. EIP实例被锁定
400 OperationFailed.EniSubIp Eni has sub ip can not bind direct eip.
400 InvalidEip.EipQuotaExceeded The specified eni assigned eip is more than privateIp.
400 OperationUnsupported.MultiIp Multi ip function is not support.
400 InvalidNicOrVm.NotFound Bind nic or vm not exist. 指定绑定的网卡或VM不存在。
400 OperationUnsupported.EipBindModel The instance type of ecs does not support MULTI_BINDED model Eip.
400 IncorrectStatus.NatGateway %s
400 EipBindRemote.BackendRegionMustBeSingle eip bind remote instance, backend region must be single
400 InvalidParameter.BindingInstanceRegion The specified BindingInstanceRegion is not supported.
400 OperationFailed.HavipBoundPortmap %s
400 IllegalParam.Mode %s
400 InvalidStatus.NotAllow Bind instance status invalid 绑定实例状态无效
400 InvalidInstance.NotExist Bind instance data not exist
400 InvalidBandwidthPackageId.NotFound The specified BandwidthPackageId not exist.
400 InvalidStatus.InstanceHasBandWidth The specified instance bandwidth invalid.
400 OperationDenied.CloudBoxResourceExist The operation is not allowed because there are resources related to the cloud box in VPC. 指定操作被禁止,因为VPC中存在云盒相关的资源。
400 OperationDenied.CloudBoxVSwitchExist The operation is not allowed because a cloud box type vSwitch exists in VPC. 指定操作被禁止,因为VPC中存在云盒类型的虚拟交换机。
400 OperationDenied.NoAvailablePrivateIp The operation is failed because of vSwitch has not availalbe private ip 当前虚拟交换机下的可用私网IP不足
400 ResourceAlreadyAssociated.IpAddress %s
400 OperationFailed.Ipv4GatewayNotOpenedInVpc The operation is failed because Ipv4Gateway is not opened in Vpc. EIP绑定IP失败,因为该VPC未开启IPv4网关.
400 OperationFailed.Ipv4GatewayNotActivatedInVpc The operation is failed because Ipv4Gateway is not activated in Vpc.
400 OperationDenied.L2EipBindIpAddress %s
400 Forbidden The eip instance owner error EIP 不属于当前调用者,请您检查该 EIP 是否可被您调用。
400 Forbidden.FinancialLocked The ip business status is invalid. 该实例已欠费锁定,无法操作
400 UnsupportedFeature.EipBindIpAddress The feature of EipBindIpAddress is not supported. Eip绑定IpAddress特性不支持。
400 OperationFailed.InstanceNotExist The ECS instance does not exist, or is not a VPC VM. ECS绑定EIP失败,因为ECS实例不存在或不是VPC虚拟机.
400 OperationDenied.Ipv4GatewayExist The operation is not allowed because of Ipv4GatewayExist.
400 OperationFailed.EipBindModeConflict Eips can not bind Eni with NAT mode and MULTI_BINDED mode at the same time.
400 OperationFailed.EcsMigrating The operation is failed because of ECS is migrating.
400 OperationFailed.IpPrefixConflict The operation failed due to the IP prefix of the ENI. 当前操作与弹性网卡的IP Prefix冲突。
400 UnsupportedFeature.EipBindPrefixIp The feature of EipBindPrefixIp is not supported. 当前地域不支持EIP绑定PrefixIp
400 OperationDenied.UnsupportedEipBindMode The operation is not supported for the NAT gateway due to its EIP binding mode. NAT网关的EIP绑定类型不支持此操作。
400 OperationDenied.Unauthorized The operation is not allowed because the user is not in the whitelist. 此操作不被允许,用户不在白名单。
400 OperationFailed.SystemBusy Operation failed because system is busy. 系统繁忙,请稍后重试
400 OperationFailed.PrivateIpAddressNotExist The operation failed because the PrivateIpAddress is not found. 您传入的私网IP地址不存在。
400 IllegalParamFormat.%s The param format of %s is illegal. 参数模式非法
400 MissingParam.InstanceId The param of InstanceId can't be null or empty. InstanceId不可以为空
400 InvalidEniType.SlaveEni The eni type cannot be slave eni. 网卡类型不能是Slave网卡。
400 IllegalParam.PrivateIpAddress The specified PrivateIpAddress is illegal. 指定的PrivateIpAddress无效。请检查参数约束,并在修改后重试。
400 OperationFailed.Ipv4GatewayNotAssociatedWithGatewayRouteTable The operation failed because the specified IPv4 gateway of the VPC is not associated with any gateway route table. EIP 绑定的 IP 地址对应的 VPC IPv4 网关未绑定任何网关路由表。
404 InvalidAllocationId.NotFound Specified allocation ID is not found.
404 InvalidInstanId.NotFound Specified instance does not exist.
404 Forbidden.RegionNotFound Specified instance is not found during access authentication. 当前Region不支持
404 OperationDenied.VpcIpv4GatewayEnabled The operation is not allowed because of the VPC of the NAT gateway has opened IPv4 Gateway. 不允许操作,因为NAT网关的VPC已经开启IPv4网关

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

变更历史

更多信息,参考变更详情