通過更換ECS執行個體系統硬碟的方式更換作業系統。更換後系統硬碟的雲端硬碟ID將發生變化,原雲端硬碟會被釋放。
介面說明
調用該介面前請您仔細閱讀更換系統硬碟(更換作業系統)。
更換系統硬碟時,您需要注意:
-
不支援變更系統硬碟計費方式。
-
不支援更換系統硬碟的雲端硬碟類型。
-
系統硬碟掛載的 ECS 執行個體不能有未支付的訂單。
-
執行個體的狀態必須為已停止(
Stopped)狀態。說明僅適用於Virtual Private Cloud 類型執行個體。如果 ECS 執行個體為隨用隨付計費模式,且開啟預設啟用節省停機模式,為防止地區範圍內的 ECS 執行個體庫存不足,引起的更換系統硬碟後無法重啟執行個體。您需要在停止該執行個體時設定為普通停機模式。具體操作,請參見 StopInstance 。
-
您可以通過參數
SystemDisk.Size重新指定系統硬碟的容量大小(不能低於原系統硬碟容量)。 -
ECS 執行個體被安全鎖定,即執行個體的
OperationLocks參數值包含"LockReason": "security",不支援更換系統硬碟。更多資訊,請參見安全鎖定時的 API 行為。
更換系統硬碟後,可通過 DescribeInstances 介面查詢更換系統硬碟的執行個體的狀態驗證是否更換成功。如果傳回值OperationLocks為空白,則表示更換系統硬碟的操作已完成。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
ecs:ReplaceSystemDisk |
update |
Disk
Image
*Instance
|
|
無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| InstanceId |
string |
是 |
指定執行個體的 ID。 說明
發起請求之前請確保目標執行個體狀態為 |
i-bp67acfmxazb4ph**** |
| ImageId |
string |
否 |
重設系統時使用的鏡像 ID。該參數為必填參數。 |
m-bp67acfmxazb4ph**** |
| SystemDisk.Size |
integer |
否 |
新的系統硬碟容量,單位為 GiB。取值範圍:
預設值:Max{40, 參數 ImageId 對應的鏡像大小}。 說明
超過 |
80 |
| ClientToken |
string |
否 |
保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken 只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證等冪性。 |
123e4567-e89b-12d3-a456-426655440000 |
| UseAdditionalService |
boolean |
否 |
是否使用阿里雲提供的虛擬機器系統配置(Windows:NTP、KMS;Linux:NTP、YUM)。 說明
掛載系統硬碟時(即裝置名稱為/dev/xvda)有效。 |
true |
| Password |
string |
否 |
是否重設 ECS 執行個體的使用者名稱密碼。長度為 8 至 30 個字元,必須同時包含大小寫英文字母、數字和特殊符號中的三類字元。特殊符號可以是:
其中,Windows 執行個體不能以斜線號(/)為密碼首字元。 預設值:保持不變。 說明
如果傳入 |
EcsV587! |
| PasswordInherit |
boolean |
否 |
是否使用鏡像預設的密碼。 預設值:false。 說明
使用該參數時,Password 參數必須為空白。同時您需要確保使用的鏡像已經設定了密碼。 |
false |
| KeyPairName |
string |
否 |
金鑰組名稱。 說明
該參數僅對 Linux 系統 ECS 執行個體生效。您可以為 ECS 執行個體綁定一個 SSH 金鑰對,作為登入憑證。使用了 SSH 金鑰對後,使用者名稱密碼的登入憑證方式將被禁用。 |
testKeyPairName |
| DiskId |
string |
否 |
說明
該參數已廢棄,為提高相容性,建議您使用 |
d-bp67acfmxazb4ph**** |
| Platform |
string |
否 |
說明
已棄用。 |
CentOS |
| Architecture |
string |
否 |
說明
已棄用。 |
i386 |
| SecurityEnhancementStrategy |
string |
否 |
更換系統硬碟後,是否免費使用Security Center服務。取值範圍:
預設值:Deactive。 |
Active |
| Encrypted |
boolean |
否 |
是否加密雲端硬碟。取值範圍:
預設值:false。 重要 當使用共用加密鏡像,建立基於加密快照的雲端硬碟時,必須指定該雲端硬碟的請求參數 Encrypted=true,以確保建立出的雲端硬碟使用的是被共用方自己的密鑰。 |
false |
| KMSKeyId |
string |
否 |
系統硬碟對應的 KMS 金鑰識別碼。 |
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"
}
異常返回樣本
JSON格式
{
"RequestId":"337568C5-64F3-4B76-8CDD-D3D8C57B5B8C",
"DiskId":"d-j6cam2z21u4ks3dj6flb"
}
錯誤碼
|
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. | 指定的鏡像不能用於指定的執行個體規格。 |
| 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,does not support this operation. | 包含了資料盤快照的鏡像,不支援此操作。 |
| 400 | InvalidDiskCategory.ValueNotSupported | The specified parameter "DiskCategory" is not valid. | 指定的參數雲端硬碟類型DiskCategory無效。 |
| 400 | InvalidKeyPairName.NotFound | The specified KeyPairName does not exist. | 指定的 KeyPairName 不存在。 |
| 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. | 指定的執行個體沒有掛載系統硬碟。請確保指定的執行個體已掛載了系統硬碟。您可以調用 DescribeInstances 查詢指定執行個體的資訊。 |
| 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 some unknown error. | |
| 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, system disk is transfering. | 當前資源的狀態不支援此操作,請再系統硬碟停止傳輸資料後重試。 |
| 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 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 | 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 is not support IoOptimized Instance. | |
| 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 creating is windows, cannot use ssh key pair to login. | |
| 403 | InvalidParameter.NotMatch | %s | 您輸入的參數無效,請檢查參數之間是否衝突。 |
| 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 | Create kms data encrypted key fail. If you need further assistance, you can contact the KMS Technical Support. | 使用KMS主要金鑰建立資料密鑰失敗,請聯絡KMS值班同學進一步排查。 |
| 403 | InvalidParameter.KMSKeyId.NotFound | The specified KMSKeyId does not exist. | |
| 403 | InvalidParameter.KMSKeyId.KMSUnauthorized | ECS service have no right to access your KMS. | ECS 服務無權訪問您的 KMS。 |
| 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 creating 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. | 當前操作不允許diskId和imageId同時為空白,請確保diskId或者imageId有一個不為空白。 |
| 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. | 當前地區不支援更換鏡像類型。 |
| 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. | 使用者主要金鑰(CMK)未授權ECS服務添加標籤許可權。 |
| 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. | 不支援同步支付,請選擇其他支付方式。 |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | 指定的執行個體ID無效。 |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的鏡像在該使用者帳號下不存在,請您檢查鏡像 ID 是否正確。 |
| 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. | 指定的資源不存在。 |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。