全部產品
Search
文件中心

Elastic Compute Service:ResetDisk

更新時間:Sep 15, 2026

使用雲端硬碟快照,將雲端硬碟還原到之前某一特定的歷史狀態。

介面說明

呼叫該介面前,請您仔細閱讀使用快照還原雲端硬碟。

呼叫該介面時,您需要注意:

  • 雲端硬碟的狀態必須為使用中(In_use)或空閒(Available)的狀態。

  • 雲端硬碟掛載的執行個體的狀態必須為已停止(Stopped)。您可以呼叫 StopInstances 停止執行個體。

  • 指定的參數SnapshotId必須是由DiskId建立的歷史快照。

  • 透過 DescribeInstances 查詢 ECS 執行個體資訊時,如果返回資料中包含{"OperationLocks": {"LockReason" : "security"}},則禁止一切操作。

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ResetDisk

update

*Disk

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

*Snapshot

acs:ecs:{#regionId}:{#accountId}:snapshot/{#snapshotId}

無 無

請求參數

名稱

類型

必填

描述

樣本值

DiskId

string

是

待還原的雲端硬碟 ID。

d-bp199lyny9b3****

SnapshotId

string

是

需要還原的雲端硬碟某一階段的歷史快照 ID。

s-bp199lyny9b3****

DryRun

boolean

否

是否預檢本次請求。取值範圍:

  • true:傳送檢查請求,不會直接還原雲端硬碟。檢查項目包括是否填寫了必選參數、請求格式和資源狀態限制。如果檢查不通過,則返回對應錯誤資訊。如果檢查通過,則返回錯誤碼DryRunOperation。

  • false:傳送正常請求,通過檢查後直接發起雲端硬碟還原操作。

預設值:false。

false

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

F3CD6886-D8D0-4FEE-B93E-1B732396****

樣本

正常返回樣本

JSON格式

{
  "RequestId": "F3CD6886-D8D0-4FEE-B93E-1B732396****"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 DiskCategory.OperationNotSupported The operation is not supported to the specified disk due to its disk category. 目前磁碟類型不支援此操作。
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
400 DryRunOperation Request validation has been passed with DryRun flag set. 通過「DryRun」驗證,您的請求已通過驗證。
400 InternalError The requested services is not available now. Please try again later. 內部錯誤,請重試。
500 InternalError The request processing has failed due to some unknown error.
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 InvalidParameter.Mismatch The specified snapshot is not created from the specified disk.
403 InvalidSnapshot.TooOld The snapshot was created before 2013-07-15 and cannot be restored since the disk was first detached.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).
403 OperationDenied The specified snapshot dees not support ResetDisk.
403 InvalidSnapshotId.NotReady The specified snapshot has not completed yet.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 InvalidAccountStatus.SnapshotServiceUnavailable Snapshot service has not been opened yet. 快照服務未開通,操作無法執行。
403 Operation.Conflict The operation may conflict with others. Please retry later.
403 UserNotInTheWhiteList The user is not in disk white list. 使用者不在共用區塊儲存白名單中,請您提交工單申請白名單。
403 InvalidParameter.KMSKeyId.CMKUnauthorized The CMK has not authorized the ECS service to perform the KMS TagResource and UntagResource operations. Please verify the authorization and try again.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The CMK needs to be enabled.
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 IncorrectDiskStatus.HasUnfinishedSnapshot The current disk has unfinished snapshot. 目前磁碟有未完成快照。
403 InvalidOperation.DiskResetInProgress The operation cannot be performed because the disk has an ongoing reset task. Please try again later.
404 InvalidParameter.KMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.
404 InvalidDiskId.NotFound The specified disk does not exist. 指定的磁碟不存在。請您檢查磁碟 ID 是否正確。
404 Disk.NotFound The specified disk does not exist. 指定的磁碟不存在,請您檢查磁碟是否正確。
404 InvalidSnapshotId.NotFound The specified SnapshotId does not exist.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. 指定的執行個體不存在,請您檢查執行個體 ID 是否正確。

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

變更歷史

更多資訊,參考變更詳情。