全部產品
Search
文件中心

Elastic Compute Service:ReplaceSystemDisk

更新時間:Aug 03, 2026

透過更換 ECS 執行個體系統磁碟的方式更換作業系統。更換後系統磁碟的雲端硬碟 ID 將發生變化,原雲端硬碟會被釋放。

介面說明

呼叫該介面前請您仔細閱讀更換系統磁碟(更換作業系統)

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ReplaceSystemDisk

update

Disk

acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}

Image

acs:ecs:{#regionId}:{#accountId}:image/{#imageId}

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

  • ecs:IsDiskEncrypted
  • ecs:IsSystemDiskEncrypted
  • ecs:PasswordInherit
  • ecs:PasswordCustomized
  • ecs:IsDiskByokEncrypted
  • ecs:IsSystemDiskByokEncrypted
  • ecs:LoginAsNonRoot
  • ecs:ImagePlatform

請求參數

名稱

類型

必填

描述

樣本值

InstanceId

string

指定執行個體的 ID。

i-bp67acfmxazb4ph****

ImageId

string

重置系統時使用的映像 ID。該參數為必填參數。

m-bp67acfmxazb4ph****

SystemDisk.Size

integer

新的系統磁碟容量,單位為 GiB。取值範圍:

80

ClientToken

string

保證請求冪等性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證冪等性

123e4567-e89b-12d3-a456-426655440000

UseAdditionalService

boolean

是否使用阿里雲提供的虛擬機器系統配置(Windows:NTP、KMS;Linux:NTP、YUM)。

true

Password

string

是否重置 ECS 執行個體的使用者名稱密碼。長度為 8 至 30 個字元,必須同時包含大小寫英文字母、數字和特殊符號中的三類字元。特殊符號可以是:

EcsV587!

PasswordInherit

boolean

是否使用映像預設的密碼。

false

KeyPairName

string

金鑰對名稱。

testKeyPairName

DiskId

string

說明

該參數已廢棄,為提高相容性,建議您使用 ImageId

d-bp67acfmxazb4ph****

Platform

string

說明

已棄用。

CentOS

Architecture

string

說明

已棄用。

i386

SecurityEnhancementStrategy

string

更換系統磁碟後,是否免費使用雲安全中心服務。取值範圍:

Active

Encrypted

boolean

是否加密雲端硬碟。取值範圍:

false

KMSKeyId

string

系統磁碟對應的 KMS 金鑰 ID。

e522b26d-abf6-4e0d-b5da-04b7******3c

EncryptAlgorithm

string

說明

該參數暫未開放使用。

hide

Arn

array<object>

該參數暫未開放使用。

object

RoleType

string

說明

該參數暫未開放使用。

null

Rolearn

string

說明

該參數暫未開放使用。

null

AssumeRoleFor

integer

說明

該參數暫未開放使用。

0

返回參數

名稱

類型

描述

樣本值

object

DiskId

string

新系統磁碟的雲端硬碟 ID。

d-bp67acfmxazb4ph****

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

{
  "DiskId": "d-bp67acfmxazb4ph****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 LoginAsNonRoot.ImageNotSupport The specified image does not support login as non-root. 此映像不支援 NonRoot 登入。
400 InvalidSystemDiskSize.ValueNotSupported The specified parameter SystemDisk.Size is invalid.
400 InvalidParameter.Conflict The specified image does not support the specified instance type. 目前操作不允許同時設定 diskId 和 imageId,請確保 diskId 或 imageId 有一個不為空。
400 InvalidSystemDiskSize.ImageNotSupportResize The specified image does not support resize. 映像不支援該系統磁碟大小。
400 InvalidSystemDiskSize The specified parameter SystemDisk.Size is invalid.
400 InvalidPassword.Malformed The specified parameter "Password" is not valid. 指定的參數 Password 不合法。
400 InvalidPasswordParam.Mismatch The input password should be null when passwdInherit is true. 啟用 PasswdInherit 後,使用者名稱密碼應該設定為空。
400 OperationDenied The specified image contains the snapshot of the data disk. This operation is not supported.
400 InvalidDiskCategory.ValueNotSupported The specified parameter "DiskCategory" is not valid. 指定資源上的磁碟類型不支援此操作。
400 InvalidKeyPairName.NotFound The specified KeyPairName does not exist. 金鑰對不存在。
400 DependencyViolation.IoOptimize The specified parameter InstanceId is not valid. 指定的執行個體 IO 最佳化設定不合法。
400 MissingParameter.Architecture Architecture should not be null. 參數 Architecture 不能為空。
400 InvalidArchitecture.Malformed Architecture is not valid. 您輸入的參數 Architecture 無效,請檢視該參數格式是否正確。
400 MissingParameter.Platform Platform should not be null. 參數 Platform 不能為空。
400 InvalidPlatform.Malformed Platform is not valid. 指定的平台無效。
400 InvalidDiskId.NotFound The specified disk do not exist. 指定的磁碟不存在。
400 InvalidDatadisk.DiskStatusViolation The operation is not permitted due to status of the Datadisk. 目前資料磁碟的狀態不支援此操作。
400 InvalidDatadisk.DiskCategoryViolation The operation is not permitted due to category of the Datadisk. 該資料磁碟的類型不支援該操作。
400 InvalidDatadisk.ChargeTypeViolation The operation is not permitted due to charge type of the Datadisk.
400 MissingParameter The input parameter "ImageId" that is mandatory for processing this request is not supplied.
400 InvalidInstance.NotFoundSystemDisk The specified instance has no system disk. 執行個體系統磁碟遺失。
400 InvalidParameter.DiskType The specified disk type which has kms key can't convert to system disk.
400 DISK_IN_DEDICATED_BLOCK_STORAGE_CLUSTER The disk in dedicated block storage cluster is not allowed to do this operation.
400 IncorrectDiskStatus.ReplicationStatusNotFound Disk replication status not found.
400 IncorrectDiskStatus.InReplication Disk already in replication.
400 InvalidInstanceType.NotSupported The specified instanceType is not supported by the image architecture. 指定的映像架構不支援此執行個體規格。
400 InvalidRegionId.NotSupportReplaceEncryptedSystemDisk The specified region not support replace encrypted system disk.
400 InvalidStorageClusterId.CapacityNotEnough The remaining capacity of the current dedicated storage cluster is less than the size of disk. 磁碟所在專屬儲存叢集的可用容量不足。
400 QuotaExceed.DiskCapacity The used capacity of disk type has exceeded the quota in the zone, %s. 指定磁碟類型的已用容量超出可用區配額限制,您可以前往配額中心查詢和申請提升磁碟容量配額。
400 AccountForbidden.ProductCreationLimited The commodity must be officially operated by Aliyun and in pay-as-you-go billing method. 集團上雲客戶只能購買按量付費的 ECS,且不能購買第三方的商品比如由映像市場提供的映像。請檢查參數,傳入符合條件的參數重試。
400 InternalError The requested services is not available now. Please try again later. 傳送請求時發生錯誤,請稍後重試。
400 InvalidDiskName.Malformed The specified parameter "SyatemDisk.DiskName or DataDisk.n.DiskName" is not valid. 參數中指定的磁碟名稱 DiskName 無效。
400 InvalidParameter.Encrypted Creating non-encrypted disks with encrypted snapshots is not supported. 不支援以加密快照建立非加密磁碟。
500 OperationDenied Internal Error.
500 InternalError The request processing has failed due to an internal error and you may retry later or contact support with the request ID.
403 LoginAsNonRoot.RegionNotSupport The specified region does not support login as non-root.
403 InvalidSystemDiskStatus.IsTransfering The current status of the resource does not support this operation. The system disk is transferring.
403 IncorrectDiskStatus The current disk status does not support this operation.
403 IncorrectInstanceStatus The current status of the resource does not support this operation.
403 InstanceLockedForSecurity The instance is locked due to security. 該執行個體由於安全原因被鎖定,您可以聯絡安全技術支援。
403 ImageNotSubscribed The specified image has not be subscribed.
403 ImageRemovedInMarket The specified marketplace image is not available. Or the specified user-defined image includes a product code because it is based on an image subscribed from the marketplace; and that marketplace image including the exact same product code has been removed.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 ChargeTypeViolation The operation is not permitted due to charge type of the instance.
403 DiskCreatingSnapshot The operation is denied due to a snapshot of the specified disk is not completed yet.
403 IoOptimized.NotSupported The specified image does not support IoOptimized instances.
403 ImageNotSupportInstanceType The specified image don not support the InstanceType instance.
403 QuotaExceed.BuyImage The specified image is from the image market. You have not bought it or your quota has been exceeded.
403 INST_HAS_UNPAID_ORDER The instance has unpaid order.
403 OperationDenied.InstanceCreating The specified instance is creating.
403 DependencyViolation.WindowsInstance The instance runs Windows and does not support SSH key pair login.
403 InvalidParameter.NotMatch %s 指定的規格僅支援部分特定的映像,您可以使用 DescribeImages API 查詢可用的映像。
403 ResourcesNotInSameZone The specified instance and disk are not in the same zone.
403 OperationDenied.UnpaidOrder The specified instance has unpaid order. 指定的執行個體 ID 已存在未支付訂單,您可以登入 ECS 管理主控台支付。
403 InvalidHostname.MismatchImage The hostname of the current instance can not be applied to the image you choose.
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance. 不符合開啟休眠選項的執行個體的相關限制,操作不被允許。
403 InvalidOperation.MultiAttachDisk Multi attach disk does not support this operation. 開啟多重掛載特性的雲端硬碟不支援該操作。
403 InvalidRegionId.NotSupportEncryptAlgorithm The current region does not support creating encrypted disks with EncryptAlgorithm.
403 InvalidRegionId.NotExists The region not exists.
403 InvalidEncryptAlgorithm The specified parameter EncryptAlgorithm is not valid.
403 InvalidEncrypted.NotMatchKmsKeyId The specified parameter Encrypted must be true when KmsKeyId is not empty.
403 InvalidEncrypted.NotMatchEncryptAlgorithm The specified parameter Encrypted must be true when EncryptAlgorithm is not empty.
403 InvalidParameter.KmsNotEnabled The specified operation need enable KMS.
403 InvalidParameter.DataEncryptedKeyCreateFailed Failed to create the KMS data encryption key. Please verify that the current KMS key has authorized the ECS service to use it. If the issue persists; contact KMS Technical Support.
403 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist.
403 InvalidParameter.KMSKeyId.KMSUnauthorized ECS service does not have permission to access your KMS key. Please verify that the specified KMS key has authorized the ECS service.
403 InvalidKMSKeyId.NotSymmetric The specified parameter KmsKeyId must be symmetric.
403 InvalidDiskId.NotSupportReplaceEncryptedSystemDisk The specified diskId not support replace encrypted system disk.
403 NotSupportSnapshotEncrypted.DiskCategory The specified disk category does not support creating encrypted system disks or encrypted data disks from snapshots. Check the DiskCategory or Encrypted parameter; or check your account for default encryption settings.
403 InvalidParameter.AllEmpty The current operation does not allow both diskId and imageId to be empty. Make sure that either diskId or imageId is not empty. 目前操作不允許 password 和 keyPairName 同時為空,請確保 password 或 keyPairName 其中一個不為空。
403 InvalidParameter.Conflict The current operation does not allow both diskId and imageId to be set. Make sure that either diskId or imageId is not empty. 目前操作不允許同時設定 diskId 和 imageId,請確保 diskId 或 imageId 有一個不為空。
403 OperationDenied The current region does not support changing the image type. 指定的 EIP 不可用或未獲授權。
403 OperationDenied.ImageNotValid The specified Image is disabled or deleted. Please check the status of the image.
403 OperationDenied.DiskNoStock The requested disk category is sold out in the specified zone. Please try a different disk category or another zone. 目前請求的磁碟類型在指定的可用區已經售罄。請換其他磁碟類型或其他可用區進行重試。
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK (Customer Master Key) must be in an active state. 使用者主金鑰(CMK)需要處於啟用狀態。
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK(Customer Master Key) lacks authorization to add tags to the ECS service. ECS 服務無權限加密/解密您的 CMK 金鑰。
403 InvalidEncrypted.NotMatchSnapshot The specified parameter Encrypted must be set to true when creating disks with encrypted snapshots. 當使用加密快照建立磁碟時,指定的參數 Encrypted 必須設定為 true。
403 InvalidEncrypted.NotMatchDiskDefaultEncryption Enabling disk default encryption prevents the creation of non-encrypted disks. 啟用雲端硬碟帳號預設加密後,無法建立非加密磁碟。
403 InvalidPayMethod.SyncPaymentNotSupport Synchronous payment is not supported. Use another payment method. 不支援同步付款,請選擇其他付款方式。
403 InvalidOperation.ImageSecureBootUnsupported The image does not support secure boot. 映像不支援安全啟動。
403 InvalidDiskCategory.NotSupported The disk category is not supported in the current zone. Please call DescribeAvailableResource to check supported categories.
403 OperationDenied.KMSKeyUnauthorized The operation is denied due to missing KMS key authorization. Please check the KMS key permissions and ensure the key is properly authorized for this operation.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體 ID 無效。
404 InvalidImageId.NotFound The specified ImageId does not exist. 沒有找到指定的映像,請確保映像在當前區域存在或映像狀態可用。
404 InvalidSystemDiskSize.MoreThanMaxSize The specified SystemDisk.Size parameter exceeds the maximum size.
404 InvalidSystemDiskSize.LessThanImageSize The specified parameter SystemDisk.Size is less than the image size.
404 InvalidSystemDiskSize.LessThanMinSize The specified parameter SystemDisk.Size is less than the min size.
404 NoSuchResource The specified resource is not found. 指定的資源不存在。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情