最近更新时间:2023.11.20 10:48:37
首次发布时间:2023.07.19 15:23:09
调用 ModifyInstanceVpcAttribute 接口修改一台实例的VPC、子网或安全组。
说明
调用该接口时,目标实例与VPC需满足的条件请参见更换ECS的VPC。
名称 | 类型 | 是否必填 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | ModifyInstanceVpcAttribute | 要执行的操作,取值:ModifyInstanceVpcAttribute。 |
Version | String | 是 | 2020-04-01 | API的版本,取值:2020-04-01。 |
InstanceId | String | 是 | i-bp1iudwa5b1tqag1**** | 实例ID。 |
VpcId | String | 否 | vpc-33gf6af3mgpvk1pz2ijlf**** | 目标VPC ID,您可以调用DescribeVpcs查询与实例处于同一地域的可用VPC。 说明 不传入该参数则表示在同一VPC下更换子网,此时 |
SubnetId | String | 是 | subnet-33gf6b2rztdkw1pz2ijvq**** | 新的子网ID,您可以调用DescribeSubnets查询目标VPC下与原子网处于同一可用区的子网ID。 说明
|
SecurityGroupIds.N | String | 否 | SecurityGroupIds.1=sg-33gf6al0psvsw1pz2ij8e****&SecurityGroupIds.2=sg-o6w9l8bc8dgmkw87**** | 实例修改VPC后加入的安全组ID,您可以调用DescribeSecurityGroups查询安全组ID。
说明 当且仅当传入 |
PrimaryIpAddress | String | 否 | 172.17.XX.XX | 新的主私网IP地址,必须在子网网段中。您可以调用DescribeNetworkInterfaceAttributes查询网卡的主私网IP地址。 说明 不传入该参数时,将从子网网段中随机分配。 |
ClientToken | String | 否 | 333456899ff**** | 保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。 |
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
NetworkInterfaceId | String | eni-3tiu4lmhwq4e8i4q**** | 新创建的网卡ID。 |
GET /?Action=ModifyInstanceVpcAttribute&Version=2020-04-01&InstanceId=i-ybuweywu4xk2c1x5****&SubnetId=subnet-33gf6b2rztdkw1pz2ijvq****&SecurityGroupIds.1=sg-33gf6al0psvsw1pz2ij8e****&VpcId=vpc-33gf6af3mgpvk1pz2ijlf**** HTTP/1.1 Host: open.volcengineapi.com Region: cn-beijing ServiceName: ecs
{ "ResponseMetadata": { "RequestId": "2021062415303301022514515207C4****", "Action": "ModifyInstanceVpcAttribute", "Version": "2020-04-01", "Service": "ecs", "Region": "cn-beijing" }, "Result": { "NetworkInterfaceId": "eni-3tiu4lmhwq4e8i4q****" } }
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidArgument | The specified argument is invalid. | 指定的参数不合法。 |
400 | InvalidInstanceStatus | The status of the specified instance does not support this request. | 当前实例的状态不支持此操作。 |
400 | MissingParameter.InstanceId | The required parameter InstanceId is not supplied. | 实例ID不能为空。 |
400 | MissingParameter.SecurityGroupIds | The required parameter SecurityGroupIds is not supplied. | 安全组ID不能为空。 |
400 | MissingParameter.SubnetId | The required parameter SubnetId is not supplied. | 子网ID不能为空。 |
400 | LimitExceeded.MaximumSubnetIps | The number of specified subnet IP addresses exceeds the maximum limit. | 指定子网的IP地址数量已经达到最大限制。 |
400 | QuotaExceeded.MaximumSecurityGroups | You've reached the limit on the number of SecurityGroups that you can create, please submit ticket to request an increase in quota. | 安全组配额不足,请提工单申请提高配额。 |
400 | InvalidIp | The specified ip is not valid, is unsupported, or cannot be used. | 指定的IP地址不合法。 |
400 | InvalidSecurityGroupType.Malformed | The specified SecurityGroupType is malformed. | 指定的安全组类型不合法。 |
400 | QuotaExceeded.MaximumSecurityGroupNetworkInterfaces | You've reached the limit on the number of SecurityGroupEnis that you can create, please submit ticket to request an increase in quota. | 安全组关联的网卡数配额不足,请提工单申请提高配额。 |
400 | InvalidSubnet.VpcMismatch | The specified subnet is not in the specified VPC. | 指定的子网不在指定的VPC中。 |
400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. | 幂等参数不一致。 |
400 | InvalidClientToken.Malformed | The specified ClientToken is malformed. | 指定的ClientToken不合法。 |
404 | InvalidVpc.NotFound | The specified VPC does not exist. | 指定的VPC不存在。 |
404 | InvalidInstance.NotFound | The specified instance does not exist. | 指定的实例不存在。 |
404 | InvalidInstance.EniNotFound | The specified instance ENI not found. | 指定的实例网卡不存在。 |
404 | InvalidSecurityGroup.NotFound | The specified SecurityGroup does not exist. | 指定的安全组不存在。 |
404 | InvalidSubnet.NotFound | The specified subnet does not exist. | 指定的子网不存在。 |
409 | InvalidSecurityGroupId.Conflict | The specified security group is duplicated with another security group associated with the same elastic network interface. | 指定的安全组已关联至该网卡,无法重复绑定。 |
409 | InvalidSubnet.Conflict | The specified instance already in target subnet. | 指定的实例已在目标子网中。 |
409 | InvalidPrimaryIpAddress.Conflict | The specified PrimaryIpAddress already exists. | 指定的私网IP地址已存在。 |
412 | OperationDenied.ResourceLocked | The specified operation is denied as your resource is locked for another operation. | 指定的操作被拒绝,因为您的资源已被其他操作锁定。 |
412 | InvalidSecurityGroup.SubnetMismatch | The specified SecurityGroup and Subnet do not match. | 安全组与子网的私有网络不匹配。 |
412 | InvalidInstance.DependenceHaVipExist | The specified instance has a dependency on HaVip. | 指定的实例与高可用虚拟IP有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceRouteEntryExist | The specified instance has a dependency on custom route entry. | 指定的实例与自定义路由条目有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceEniExist | The specified instance has a dependency on elastic network interface. | 指定的实例与弹性网卡有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceMultiPrivateIpExist | The specified instance has a dependency on private IP address. | 指定的实例与多个私网IP有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceIpv6Exit | The specified instance has a dependency on IPv6 address. | 指定的实例与IPv6地址有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceClbExit | The specified instance has a dependency on CLB. | 指定的实例与CLB有依赖,无法响应该请求。 |
412 | InvalidInstance.DependenceEipExit | The specified instance has a dependency on elastic ip address in binded mode. | 指定的实例与EIP可见模式有依赖,无法响应该请求。 |
412 | InvalidSubnet.ZoneMismatch | The specified subnet and instance are in different Availability Zones. | 指定的子网与实例不属于同一可用区。 |
412 | InvalidInstance.DependenceAnycastEipExit | The specified instance has a dependency on anycast elastic IP. | 指定的实例与任播公网IP有依赖,无法响应该请求。 |
412 | IdempotentProcessing | The request uses the same client token as a previous one that is still in process. | 先前的幂等请求仍在处理中,请稍后重试。 |
500 | InternalError | An internal error has occurred. | 内部错误,请重试。如果多次尝试失败,请提交工单。 |