修改一台专有网络类型ECS实例的专有网络VPC、私网IP地址、安全组或交换机。
接口说明
调用接口时,ECS 实例的状态必须是已停止(Stopped)。
-
修改实例的私网 IP 地址或交换机时,请注意:
新建的 ECS 实例必须经过重启才能调用该接口。
成功修改一次后,ECS 实例必须经过重启才能继续调用该接口进行修改。
-
修改实例的专有网络 VPC 时,请注意:
-
实例:
实例状态:不能为已锁定、等待释放、已过期、过期回收中、欠费回收中。更多信息,请参见实例生命周期介绍。
不支持已关联负载均衡实例的 ECS 实例。
实例不能在其它云服务中被使用。例如,实例不能在迁移中、不能已在更换 VPC 或实例内部署的数据库不能被 DTS 服务管理等。
-
网络:
不支持配置了 EIP 网卡可见模式或多 EIP 网卡可见模式的实例。
不支持绑定了高可用虚拟 IP(HaVip)的实例。
不支持交换机绑定了自定义路由表的实例。
不支持开通了全球加速(GA)的实例。
不支持绑定辅助弹性网卡的实例。
不支持已分配 IPv6 地址的实例。
不支持主网卡有多 IP 的实例。
传入的交换机必须属于目标 VPC。
修改前后交换机可用区必须一致。
如果指定主网卡私网 IP,则 IP 必须在交换机地址段内且可用。如果不指定则随机分配,且目标交换机的可用 IP 数充足。
如果您使用的是其他账号共享给您的 VPC,那么您需要确保目标安全组是由您的账号在该共享 VPC 中创建的,而不是由 VPC 所有者的账号创建的安全组。
-
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:ModifyInstanceVpcAttribute |
update |
*Instance
*VSwitch
|
|
无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| InstanceId |
string |
是 |
实例 ID。 说明
调用该接口时,ECS 实例的状态必须是已停止( |
i-bp1iudwa5b1tqag1**** |
| VSwitchId |
string |
是 |
交换机 ID。
|
vsw-bp1s5fnvk4gn3tw12**** |
| PrivateIpAddress |
string |
否 |
新的私网 IP 地址。 说明
参数 默认值:当不传该值时,从虚拟交换机子网网段中随机分配。 |
172.17.**.** |
| VpcId |
string |
否 |
目标 VPC ID。 |
vpc-bp1vwnn14rqpyiczj**** |
| SecurityGroupId |
array |
否 |
实例修改 VPC 后加入的安全组 ID 列表。当且仅当传入 |
sg-o6w9l8bc8dgmkw87**** |
|
string |
否 |
安全组 ID。 |
sg-o6w9l8bc8dgmkw87**** |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
异常返回示例
JSON格式
{
"RequestId": "E69EF3CC-94CD-42E7-8926-F133B86387C0",
"HostId": "ecs.aliyuncs.com",
"Code": "InvalidPrivateIp.Changing",
"Message": "Specified private IP address is not in the CIDR block of virtual switch."
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidTarget.TrafficMirrorSession | Instance is target of traffic mirror session. | |
| 400 | InvalidSource.TrafficMirrorSession | Instance is source of traffic mirror session. | |
| 400 | InvalidPrivateIpAddress.Malformed | Specified private IP address is malformed. | 指定的私有 IP 不合法。 |
| 400 | InvalidPrivateIpAddress.Duplicated | Specified private IP address is duplicated. | |
| 400 | IncorrectVSwitchStatus | The current status of virtual switch does not support this operation. | 指定的虚拟交换机处于 pending 状态,无法删除。 |
| 400 | IncorrectInstanceStatus | The current status of instance does not support this operation. | 目前实例状态不支持此类操作。 |
| 400 | OperationDenied | Specified operation is denied as your instance is not in VPC. | 该实例不是 VPC 实例。 |
| 400 | InvalidVSwitchId.Mismatch | Specified instance and virtual switch are not in the same zone. | 指定的实例和指定的虚拟交换机不属于同一个可用区。 |
| 400 | InvalidPrivateIpAddress.Mismatch | Specified private IP address is not in the CIDR block of virtual switch. | 指定的私网 IP 不在指定虚拟交换机的网段中。 |
| 400 | InvalidPrivateIp.Changing | Previous action is not finished yet. | 实例修改私网IP未完成,不能再进行在修改。 |
| 400 | PrimaryEniHasSubIp | Primary network interface of the specified instance has more than one private ip. | 主网卡有多个辅助私网IP。 |
| 400 | VSwitchIdNotMatch | The subnet of private ip is different to the instance, please unbind ha vip. | 虚拟交换机地址段,不包含指定的IP,请检查。 |
| 400 | InvalidOperation.EniCountExceeded | The number of ENIs in an enterprise security group has reached the maximum limit. | |
| 400 | InvalidParameter.SecurityGroupId | Security group ids are invalid. | 无效的安全组ID |
| 400 | InvalidVSwitch.IllegalStatus | The operation is not allowed in the current VSwitch state. Expecting state includes "Created", but current state is "%s". | 当前交换机状态不支持该操作。 |
| 400 | QuotaExceeded.PrivateIpAddress | There are not enough private IPs in the specified VSwitch. | 当前交换机没有足够的Ip |
| 401 | InvalidOperation.SecurityGroupNotAuthorized | The specified security group is not authorized to operate. | 没有权限操作当前安全组 |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | OperationDenied | The Specified operation is denied as your instance is locked for security reasons. | |
| 403 | InvalidIp.Ipv6Assigned | The specified instance has been assigned IPv6 address. | |
| 403 | SecurityGroupInstanceLimitExceed | %s | 该安全组内已有的实例数量已达到最大限制。 |
| 403 | InvalidInstance.HasTransitionRecord | The operation is denied because the specified instance has a migration plan. | |
| 403 | InvalidInstanceStatus.NotNormal | The Specified operation is denied due to instance status. | |
| 403 | InvalidVpcId.SharedVpc | The Specified operation is denied as your targe vpc is SharedVpc. | |
| 403 | InvalidOperation.NotAllowed | The operation is denied because the specified VPC has advanced features enabled. | |
| 403 | InvalidParameter.ToSecurityGroupId | %s | |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | %s | 云产品托管的安全组不支持修改操作。 |
| 403 | InvalidOperation.VswAndEcsAvailabilityZoneMismatch | Specified instance and virtual switch are not in the same zone. | 实例和目标交换机不属于同一个可用区。 |
| 403 | InvalidOperation.CloudBoxEcsNotSupport | Cloud box ecs instance does not support modifying VPC. | 云盒实例不支持修改VPC |
| 403 | AclLimitExceed | %s | 网卡或实例的安全组规则数量超过限额值。 |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | 指定的实例ID无效。 |
| 404 | InvalidVSwitchId.NotFound | Specified virtual switch does not exist. | 指定的虚拟交换机 ID 不存在。 |
| 404 | NoSuchResource | The specified resource is not found. | 指定的资源不存在。 |
| 404 | InvalidParameter.InvalidInstanceId | The specified InstanceId does not exist. | |
| 404 | InvalidParameter.VSwitchId | The specified virtual vswitch does not exist. | 指定的交换机不存在。 |
| 404 | InvalidRegion.ValueNotSupported | The specified Region does not exist. | |
| 404 | InvalidInstance.AttachedEni | The Specified operation is denied due to elastic network interface. | 实例绑定了辅助网卡,不允许更换VPC。 |
| 404 | InvalidIp.MultiPrimaryIp | The Specified operation is denied due to multi private ip. | 主网卡有多个私网IP,不允许该操作。 |
| 404 | InvalidIp.Ipv6 | The Specified operation is denied due to ipv6. | |
| 404 | InvalidVSwitch.NotBelongToVpc | %s | 指定的VSwitchId不属于指定的VPC。请检查参数值是否正确。 |
| 404 | InvalidParameter.EniNo | %s | |
| 404 | InvalidSecurityGroupId.NotFound | %s | 指定的安全组 ID 不存在。 |
| 404 | InvalidParameter.SecurityGroupIdRepeated | %s | |
| 404 | InvalidSecurityGroupType.NotSupportClassic | The specified SecurityGroupIds have classic group type. | 指定的安全组的网络类型为经典网络。请检查 SecurityGroupIds 参数值是否正确。 |
| 404 | InvalidSecurityGroupVpc.NotBelongToOneVpc | The specified SecurityGroupIds are belong to different vpc. | 指定的安全组ID属于不同的VPC。请检查 SecurityGroupIds 参数值是否正确。您可以调用 DescribeSecurityGroups 查询指定安全组所属的VPC。 |
| 404 | EnterpriseGroupLimited.MutliGroupType | The specified instance can not join multi SecurityGroup types. | |
| 404 | InvalidParameter.AlreadyInTargetVpc | The specified instance is already in the destination VPC. | |
| 404 | InvalidParameter.SecurityGroupId | The specified SecurityGroupId.N is invalid or does not exist. | |
| 404 | JoinedGroupLimitExceed | The specified instance has exceed quota of SecurityGroup. | |
| 404 | InvalidParameter.MustBeEmpty | The specified parameter SecurityGroupId.N and VpcId need be empty. | 指定的参数,SecurityGroupId.N和VpcId必须为空。 |
| 404 | InvalidParameter.NotEnoughIpInVSwitch | The specified virtual switch has not enough available ip. | |
| 404 | InvalidDependence.MutliDirectlyEip | The Specified operation is denied due to multi directly Eips. | |
| 404 | InvalidDependence.HaVip | The Specified operation is denied due to HaVip. | |
| 404 | InvalidDependence.NextHopOfCustomRouter | The Specified operation is denied due to next hop of Custom Router. | 指定的实例是自定义路由的下一跳,不允许操作。 |
| 404 | InvalidDependence.BeenUsedAsAppServer | The Specified operation is denied due to AppServer. | |
| 404 | InvalidDependence.GrantAccess | The Specified operation is denied due to grant access. | ECS实例可能使用了其他产品(DBS、DTS、DMS、Workbench等),有授权其它产品访问的记录,存在反向访问规则。 |
| 404 | InvalidDependence.BindGA | The Specified operation is denied due to GA. | |
| 404 | InvalidDependence.SLB | The Specified operation is denied as your instance with alb or clb. | 由于实例绑定ALB或者CLB,该操作被拒绝。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。