ReplaceSystemDisk

Last Updated: Dec 12, 2017

Description

This interface allows you to replace the system disk of an ECS instance. By changing the system disk, you can change the operating system of your ECS instance. Consider the following when you call this interface:

  • 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.
  • When replacing the system disk, the billing method of the system disk is not replaced. The original system disk is deleted after replacement.
  • The ECS instance must be Stopped when you change its system disk.
  • The ECS instance cannot have an unpaid order.
  • If your ECS instance is in OperationLocks, the reason cannot be "LockReason" : "security".
  • You can specify the volume of the system disk by specifying the parameter SystemDisk.Size, and SystemDisk.Size must be equal to or greater than max{40, [the volume of former system disk]}. Extra billing is incurred for the part that SystemDisk.Size exceeds max{40, [the volume of former 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 replacing the system.
Password String No Password of your ECS instance.
  • It can be [8, 30] characters in length and must contain the three types of characters, uppercase, or lowercase letters, digits, and special symbols.
  • Special symbols includes ( ) ' ~ ! @ # $ % ^ & * − + = | { } [ ] : ; ‘ < > , . ? /
  • If the Password parameter passes, use HTTPS to call the API to avoid password breach.
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 String No The volume of the new system disk, in the unit of GB. Valid range:
  • [Max{40, [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 to activate the security enhancement feature or not. Optional values:
  • Active: applies for the public image
  • Deactive: applies for all kinds of image

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. <ResetDiskResponse>
  2. <DiskId>d-23jbf2v5m</DiskId>
  3. <RequestId>F3CD6886-D8D0-4FEE-B93E-1B73239673DE</RequestId>
  4. </ResetDiskResponse>

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 be used on the specified instance type.
InvalidParameter.Conflict The specified image does not support the specified instance type. 400 The specified image does not support the creation of an instance with this specification.
MissingParameter The input parameter InstanceId that is mandatory for processing this request is not supplied. 400 You must specify the InstanceId parameter.
MissingParameter The input parameter ImageId that is mandatory for processing this request is not supplied. 400 ImageId parameter is not specified.
ChargeTypeViolation The operation is not permitted due to charge type of the instance. 403 The billing method of the specified instance does not support replacing the system disk.
DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet. 403 Creation of a snapshot of the specified system disk is in progress.
ImageNotSubscribed The specified image is not subscribed. 403 You have not subscribed to the specified image in the marketplace.
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 the marketplace, and that image in marketplace with the same product code has been removed. 403 The specified image is unavailable now in the marketplace.
IncorrectInstanceStatus The current status of the resource does not support this operation. 403 The current status of the resource does not support this operation.
InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in overdue payment (afterpay mode). 403 Payment is overdue for the specified instance.
InstanceLockedForSecurity The instance is locked due to security. 403 The instance is locked for the sake of security.
IoOptimized.NotSupported The specified image does not support IoOptimized Instance type. 403 The specified image must support the IoOptimized instance type.
InvalidImageId.NotFound The specified ImageId does not exist. 404 The specified image does not exist.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified instance does not exist.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified instance does not exist.
OperationDenied Internal Error. 500 Internal error.
Thank you! We've received your feedback.