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

AttachNetworkInterface

最近更新时间2024.01.10 10:41:29

首次发布时间2021.07.29 14:11:54

调用 AttachNetworkInterface 接口,将辅助网卡挂载至云服务器。

调用说明

调用本接口需满足如下条件:

  • 云服务器和辅助网卡两者所属同一VPC且在同一可用区。
  • 云服务器实例的状态为运行中已停止
  • 辅助网卡已分配的私网IPv4地址数量和私网IPv6地址数量均小于云服务器实例规格的单网卡IP配额。
  • 目标云服务器实例已挂载网卡的数量未达到其可挂载的网卡数量(包括1张主网卡)。不同规格云服务器实例可挂载的网卡数量不同,具体请参见规格实例清单

调试

请求参数

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

NetworkInterfaceId

String

eni-bp1fg655nh68xyz9****

辅助网卡ID。
您可以调用 DescribeNetworkInterfaces 接口,查询网卡的ID。

InstanceId

String

i-wijfn35c****

云服务器实例的ID。
您可以调用 DescribeInstances 接口,查询云服务器实例的ID。

返回数据

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

请求示例

GET /?Action=AttachNetworkInterface&Version=2020-04-01&NetworkInterfaceId=eni-bp1fg655nh68xyz9****&InstanceId=i-wijfn35c**** HTTP/1.1
Host: open.volcengineapi.com
Service: vpc
Region: cn-beijing

返回示例

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

错误码

此处仅展示当前API的错误码,更多错误码请参见公共错误码

HttpCode
错误码
错误信息
描述
400InvalidEip.InvalidStatusThe specified elastic ip is not in the correct status for the request.指定的弹性公网IP所处的状态无法响应该请求。
400InvalidEni.AccountMismatchThe specified elastic network interface and instance are in different account.指定的弹性网卡和实例不在同一个账号。
400InvalidEni.IPv4ToIPv6OnlyInstanceAttaching IPv4 ENI to IPv6 only instance is not supported.不支持把IPv4网卡挂载到IPv6 only实例上。
400InvalidEni.InvalidStatusThe specified elastic network interface is not in the correct status for the request.指定的弹性网卡所处的状态无法响应该请求。
400InvalidEni.ZoneMismatchThe specified elastic network interface and instance are in different Available Zones.指定的弹性网卡和实例不在同一个可用区。
400InvalidInstance.InvalidStatusThe specified instance is not in the correct status for the request.指定的ECS实例所处的状态无法响应该请求。
400InvalidInstance.InvalidTypeThe specified instance type is invalid for the request.指定的ECS实例规格无法响应该请求。
400LimitExceeded.EnisPerInstanceYou've reached the limit on the number of elastic network interfaces that can be attached to a single instance.已达到该ECS实例可绑定的弹性网卡的数量上限。
400LimitExceeded.PrivateIpsPerEniYou've reached the limit on the number of private IPs per elastic network interface that you can create.已达到弹性网卡可分配的辅助IP的数量上限。
400LimitExceeded.Ipv6AddressesPerEniThe number of IPv6 addresses for a specified network interface exceeds the limit for the type of instance you are attaching.网卡已达到指定实例规格可分配的IPv6地址数量上限。
403ForbiddenYou are not authorized to perform operations on ESI related resources.无权限操作弹性预约实例关联资源。
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.无权限对指定弹性网卡进行操作。指定的弹性网卡为云产品托管的弹性网卡。
404InvalidEniId.NotFoundThe specified elastic network interface does not exist.指定的弹性网卡不存在。
404InvalidInstance.NotFoundThe specified instance does not exist.指定的ECS实例不存在。
409InvalidOperation.ConflictThe specified resource operation conflicts.指定的资源操作冲突。