ModifyInstanceVpcAttribute

Last Updated: Jan 29, 2018

Description

Modifies the attributes of a Virtual Private Cloud (VPC). When you call this interface, consider the following:

  • For more information about the APIs for VPC, see API Reference of VPC.
  • The ECS instance must be in the Stopped status before the VSwitch can be changed.
  • A new instance must have been started and stopped before you call this interface.
  • The VPC attributes of an instance that have been modified once must have been started and stopped before you call this interface again.
  • When VPC attributes are modified for a specified VSwitchId, the VSwitchId must belong to the same VPC.
  • The current VSwitch and new VSwitch of the specified instance must belong to the same zone.
  • When VSwitchId is specified and PrivateIpAddress is not specified, the system automatically allocates a private IP address for your ECS instance.
  • When both VSwitchId and PrivateIpAddress are specified, the specified PrivateIpAddress must be in the network segment of the specified VSwitch. You must specify the VSwitchId when you modify the PrivateIpAddress of your instance.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: ModifyInstanceVpcAttribute.
InstanceId String Yes The specified instance ID.
VSwitchId String Yes ID of a new VSwitch. Only VSwitches in the same zone can be changed.
PrivateIpAddress String No New private IP addresses of your instance. You must specify the VSwitchId when you modify the PrivateIpAddress of your instance.

Response parameters

All parameters are common response parameters. For more information, see Common parameters.

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=ModifyInstanceVpcAttribute
  2. &InstanceId=35F20777-0DFF-C152-41FA-BCE0EA0B2FD7
  3. &VSwitchId=[vswitchid]
  4. &<Common Request Parameters>

Response example

XML format

  1. <ModifyInstanceAttributeResponse>
  2. <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
  3. </ModifyInstanceAttributeResponse>

JSON format

  1. {
  2. "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
  3. }

Error codes

Error code Error message HTTP status code Meaning
IncorrectInstanceStatus The current status of the instance does not support this operation. 400 Only an instance in Stopped status supports this operation.
InvalidPrivateIp.Changing Previous action is not finished yet. 400 The private IP address cannot be modified because the previous modification is not finished yet.
InvalidPrivateIp.Changing Specified private IP address is not in the CIDR block of the virtual switch. 400 The private IP address is being modified by the instance (the private IP address can be modified only when the instance is stopped).
InvalidPrivateIpAddress.Duplicated Specified private IP address is duplicated. 400 The specified private IP address is already in use.
InvalidPrivateIpAddress.Malformed Specified private IP address is malformed. 400 The specified private IP address is invalid.
InvalidPrivateIpAddress.Mismatch Specified private IP address is not in the CIDR block of virtual switch. 400 The specified private IP address is not in the network segment of the specified VSwitch.
InvalidVSwitchId.Mismatch Specified instance and virtual switch are not in the same zone. 400 The specified instance and VSwitch are not in the same zone.
OperationDenied Specified operation is denied as your instance is not in the VPC. 400 The instance is not in the VPC.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified ECS instance does not exist.
InvalidVSwitchId.NotFound Specified virtual switch does not exist. 404 The specified VSwitch ID does not exist.
InvalidVSwitchId.NotFound Specified virtual switch is not found in the current VPC. 404 The specified VSwitch of the instance cannot be modified because it is not found in the current VPC.
Thank you! We've received your feedback.