All Products
Search
Document Center

Elastic Compute Service:ResetDisk

Last Updated:Dec 02, 2026

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

Operation description

Before you call this operation, read Roll back a cloud disk by using a snapshot carefully.

When you call this operation, note the following items:

  • The cloud disk must be in the in use (In_use) or available (Available) state.

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

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

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

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 cloud disk to be rolled back.

d-bp199lyny9b3****

SnapshotId

string

Yes

The ID of the snapshot to which the cloud disk is rolled back.

s-bp199lyny9b3****

DryRun

boolean

No

Specifies whether to perform a dry run on the request. Valid values:

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

  • false: performs a normal request. If the request passes the check, the cloud 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 disk category of the specified disk does not support the current operation. Please check the operations supported by the disk category and try again.
400 InvalidRegionId.MalFormed The specified RegionId is not valid. Please verify the format of RegionId or call DescribeRegions to query the supported regions and try again.
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 request processing has failed due to an internal error and you may retry later or contact support with the request ID.
400 InvalidSnapshotId.Malformed The specified SnapshotId is not valid. Please verify the format of SnapshotId and try again.
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 IncorrectDiskStatus The current disk status does not support this operation. Please ensure the disk is in the In_use state and try again.
403 IncorrectInstanceStatus The current status of the instance does not support this operation. Please ensure the instance is in the Stopped state and try again.
403 InstanceLockedForSecurity Operation failed because the instance attached to this disk is locked for security reasons. Please open a ticket to contact our security team if you have any questions.
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 is still being created. Please wait until the snapshot creation completes and try again.
403 InvalidAccountStatus.SnapshotServiceUnavailable The snapshot service has not been activated. Please activate it and try again.
403 Operation.Conflict The resource is currently busy with a conflicting operation. Please wait for it to complete and try again.
403 UserNotInTheWhiteList The current account is not in the allowlist for this operation. Please submit a ticket to apply for access.
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 specified KMS key must be in an enabled state. Please enable the key in the KMS console and try again.
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 specified disk has an unfinished snapshot. Please wait for the snapshot creation to complete and try again.
403 InvalidOperation.DiskResetInProgress The operation cannot be performed because the disk has an ongoing reset task. Please try again later.
403 InvalidAccountStatus.NotEnoughBalance The operation is not allowed due to an overdue payment or insufficient balance. Please top up your account in the Billing Management console and try again. Your account balance is insufficient. Top up your account before you perform this operation.
403 IncorrectDiskStatus.Transferring The specified device is currently being transferred. Please try again after the transfer is complete.
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. Please verify the DiskId and the current region and try again.
404 Disk.NotFound The specified DiskId does not exist. Please verify the DiskId and the current region and try again.
404 InvalidSnapshotId.NotFound The specified SnapshotId does not exist. Please verify the SnapshotId and the current region and try again.
404 InvalidInstanceId.NotFound The instance to which the specified disk is attached does not exist. Please verify the DiskId and the current region and try again.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.