ReplaceSystemDisk

Last Updated: May 22, 2018

Description

Replaces the system disk or the operating system of an ECS instance. When you call this interface, consider the following:

  • You cannot change the category of the system disk for your ECS instance.

  • If you replace the system disk, the disk ID of the system disk for your ECS instance is replaced.

  • The billing method of the system disk remains unchanged. The original system disk is released once the action is completed.

  • The instance must be in the Stopped status. If your VPC-Connected instance has the No fees for stopped instances (VPC-Connected) feature enabled, we recommend that you disable the feature when you stop the instance to guarantee a successful restart attempt. For more information, see StopInstance.

  • The ECS instance cannot have an unpaid order.

  • If the specified instance is locked, the OperationLocks of the instance cannot be "LockReason" : "security".

  • You can specify the size of the new system disk by specifying the parameter SystemDisk.Size. The SystemDisk.Size must be equal to or greater than max{20, [size of the current system disk]}. Extra fees are charged for the size that exceeds max{20, [the volume of current system disk]}.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: ReplaceSystemDisk.
InstanceId String Yes The ID of the specified instance.
ImageId String Yes The ID of the image used when you replace the system disk.
Password String No Password of your ECS instance.
  • It can be [8, 30] characters in length and must contain the three types of characters, letters, digits, and special symbols.
  • Special symbols include ( ) ' ~ ! @ # $ % ^ & * − + = | { } [ ] : ; ‘ < > , . ? /
  • If you specify the Password parameter, use HTTPS to call the API to avoid password breach.
PasswordInherit Boolean No Whether or not to use the password pre-configured in the image you select. When PasswordInherit is specified, the Password must be null. For a secured access, make sure that the selected image has password configured.
KeyPairName String No Key pair name.
  • For a Windows instance, ignore this parameter, and the default value is null. If a value is set for the KeyPairName parameter, the parameter Password is still effective.
  • For a Linux instance, the password of username is disabled if a value is set for the KeyPairName parameter.
SystemDisk.Size Integer No Size of the new system disk, measured in GB.
Valid range: [Max{20, [the size of the specified image file]}, 500]
Default value: Max{40, [the size of the specified image file]}
ClientToken String No Used to guarantee the idempotence of the request. The value is generated by the client. The client token must be unique among all requests and contain up to 64 ASCII characters. For more information, see the appendix How to ensure idempotence.
SecurityEnhancementStrategy String No Whether or not to activate the security enhancement feature and install network security software for free. Optional values:
  • Active: Enable the security enhancement feature and install network security software for free. Only applicable to the Alibaba Cloud public images.
  • Deactive: Disable the security enhancement feature and no network security software installation. Applicable to all kinds of images.

Response parameters

Name Type Description
DiskId String Indicates the disk ID of the new system disk

Examples

Request example

  1. https://ecs.aliyuncs.com/?Action=ReplaceSystemDisk
  2. &InstanceId=i-23jggx34b
  3. &ImageId=m-myimage11
  4. &<Common Request Parameters>

Response example

XML format

  1. <ReplaceSystemDiskResponse>
  2. <DiskId>d-23jbf2v5m</DiskId>
  3. <RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
  4. </ReplaceSystemDiskResponse>

JSON format

  1. {
  2. "DiskId": "d-23jbf2v5m",
  3. "RequestId": "F3CD6886-D8D0-4FEE-B93E-1B73239673DE"
  4. }

Error codes

Error code Error message HTTP status code Meaning
InvalidParameter.Conflict The specified image does not support the specified instance type. 400 The specified image cannot run in the specified instance type.
InvalidPassword.Malformed The specified parameter “Password” is not valid. 400 The specified Password is invalid.
InvalidPasswordParam.Mismatch The input password should be null when passwdInherit is true. 400 When PasswordInherit is specified, the Password must be null.
InvalidSystemDiskSize The specified parameter SystemDisk.Size is invalid. 400 The specified SystemDisk.Size is invalid.
InvalidSystemDiskSize.ImageNotSupportResize The specified image does not support resize. 400 You cannot specify the SystemDisk.Size for the specified ImageId.
InvalidSystemDiskSize.ValueNotSupported The specified parameter SystemDisk.Size is invalid. 400 The specified SystemDisk.Size is invalid.
OperationDenied The specified image contains the snapshot of the data disk,does not support this operation. 400 You cannot change the system disk of the specified instance when the specified image is created by using a snapshot that contains data of data disks.
ChargeTypeViolation The operation is not permitted due to charge type of the instance. 403 You cannot change the system disk for the specified instance because of its billing method.
DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet. 403 A snapshot is being created for the specified disk, please try again later.
ImageNotSubscribed The specified image has not be subscribed. 403 You must subscribe the specified image before the action.
ImageNotSupportInstanceType The specified image don not support the InstanceType instance. 403 The specified image cannot run in the specified category of the instance.
ImageRemovedInMarket The specified market image is not available, Or the specified user defined image includes product code because it is based on an image subscribed from marketplace, and that image in marketplace includeing exact the same product code has been removed. 403 The specified ImageId is no longer available in the cloud market.
IncorrectInstanceStatus The current status of the resource does not support this operation. 403 The status of the ECS instance must be Stopped.
INST_HAS_UNPAID_ORDER The instance has unpaid order. 403 An unpaid order exists for the specified instance.
InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). 403 The specified instance has an overdue payment.
InstanceLockedForSecurity The instance is locked due to security. 403 The specified instance is locked for security reasons.
IoOptimized.NotSupported The specified image is not support IoOptimized Instance. 403 The specified ImageId must be able to run in an I/O optimized instance.
QuotaExceed.BuyImage The specified image is from the image market,You have not bought it or your quota has been exceeded. 403 You must purchase the specified ImageId before the action. You have reached the maximum number of available images purchased by you.
InvalidImageId.NotFound The specified ImageId does not exist. 404 The specified ImageId does not exist.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified InstanceId does not exist.
InvalidSystemDiskSize.LessThanImageSize The specified parameter SystemDisk.Size is less than the image size. 404 The specified SystemDisk.Size cannot be smaller than the size of the former system disk.
InvalidSystemDiskSize.LessThanMinSize The specified parameter SystemDisk.Size is less than the min size. 404 The specified SystemDisk.Size cannot be smaller than 40 GB.
InvalidSystemDiskSize.MoreThanMaxSize The specified SystemDisk.Size parameter exceeds the maximum size. 404 The specified SystemDisk.Size cannot exceed 500 GB.
NoSuchResource The specified resource is not found. 404 The specified resource does not exist.
OperationDenied Internal Error. 500 Internal error, please try again later.
Thank you! We've received your feedback.