All Products
Search
Document Center

Elastic Compute Service:ResetDisk

Last Updated:Sep 15, 2026

Rolls back a disk to a previous state by using a disk snapshot.

Operation description

Before you call this operation, read Roll back a disk by using snapshots.

When you call this operation, take note of the following items:

  • The disk must be in the In Use (In_use) or Available (Available) state.

  • The instance to which the disk is attached must be in the Stopped (Stopped) state. You can call StopInstances to stop an instance.

  • The specified SnapshotId parameter must be a historical snapshot created from the disk specified by DiskId.

  • When you call DescribeInstances to query ECS instance information, if the response contains {"OperationLocks": {"LockReason" : "security"}}, all operations on the instance are prohibited.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ResetDisk

update

*Disk

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

*Snapshot

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

None None

Request parameters

Parameter

Type

Required

Description

Example

DiskId

string

Yes

The ID of the disk to be rolled back.

d-bp199lyny9b3****

SnapshotId

string

Yes

The ID of the snapshot to use for rolling back the disk.

s-bp199lyny9b3****

DryRun

boolean

No

Specifies whether to perform a dry run. Valid values:

  • true: performs a dry run without actually rolling back the disk. The system checks whether required parameters are specified, whether the request format is valid, and whether resource status constraints are met. If the check fails, the corresponding error message is returned. If the check succeeds, the error code DryRunOperation is returned.

  • false: performs a dry run and sends the request. If the check succeeds, the disk rollback operation is initiated.

Default value: false.

false

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

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

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 DiskCategory.OperationNotSupported The operation is not supported to the specified disk due to its disk category. The specified disk category does not support this operation.
400 InvalidRegionId.MalFormed The specified RegionId is not valid.
400 DryRunOperation Request validation has been passed with DryRun flag set. Your request is determined as valid when the DryRun parameter is set.
400 InternalError The requested services is not available now. Please try again later. An internal error has occurred. 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. The operation is not supported while the instance is locked for security reasons.
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. The operation is not supported while the snapshot service is not activated.
403 Operation.Conflict The operation may conflict with others. Please retry later.
403 UserNotInTheWhiteList The user is not in disk white list. You are not authorized to manage the disk. Try again when you are authorized.
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. The specified disk has incomplete snapshots.
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. The specified disk does not exist. Check whether the disk ID is correct.
404 Disk.NotFound The specified disk does not exist. The specified disk does not exist. Check whether the disk ID is correct.
404 InvalidSnapshotId.NotFound The specified SnapshotId does not exist.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The specified instanceId is invalid.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.