All Products
Search
Document Center

Elastic Compute Service:ResetDisk

Last Updated:Dec 27, 2024

Rolls back a cloud disk to a snapshot from an earlier point in time.

Operation description

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

  • The disk must be in the In Use (In_Use) or Unattached (Available) state.
  • The Elastic Compute Service (ECS) instance to which the disk is attached must be in the Stopped (Stopped) state. You can call the StopInstances operation to stop an instance.
  • The snapshot specified by the SnapshotId parameter must be created from the disk specified by the DiskId parameter.
  • When you call the DescribeInstances operation to query instance information and the response contains {"OperationLocks": {"LockReason" : "security"}}, then this indicates that the instance is locked for security reasons and no operations can be performed on the instance.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ResetDiskupdate
*Disk
acs:ecs:{#regionId}:{#accountId}:disk/{#diskId}
*Snapshot
acs:ecs:{#regionId}:{#accountId}:snapshot/{#snapshotId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DiskIdstringYes

The ID of the disk that you want to roll back.

d-bp199lyny9b3****
SnapshotIdstringYes

The ID of the snapshot that you want to use to roll back the disk.

s-bp199lyny9b3****
DryRunbooleanNo

Specifies whether to check the validity of the request without actually making the request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and resource state limits. If the request fails the dry run, an error code is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false: performs a dry run and performs the actual request. If the request passes the dry run, the rollback operation is performed.

Default value: false

false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

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

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400DiskCategory.OperationNotSupportedThe operation is not supported to the specified disk due to its disk category.The specified disk category does not support this operation.
400InvalidRegionId.MalFormedThe specified RegionId is not valid.The specified region does not exist.
400DryRunOperationRequest validation has been passed with DryRun flag set.Your request is determined as valid when the DryRun parameter is set.
403IncorrectDiskStatusThe current disk status does not support this operation.The disk is in a state that does not support the current operation. Make sure that the disk is available and that your account has no overdue payments.
403IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403InstanceLockedForSecurityThe instance is locked due to security.The operation is not supported while the instance is locked for security reasons.
403InvalidParameter.MismatchThe specified snapshot is not created from the specified disk.An encrypted snapshot cannot be used to roll back an unencrypted disk.
403InvalidParameter.MismatchNon-encrypted disk can not be reset by encrypted snapshot.-
403InvalidSnapshot.TooOldThe snapshotId is created before 2013-07-15, it cannot be restored since the first time the disk detached.Snapshots created before July 15, 2013 do not support this operation.
403InstanceExpiredOrInArrearsThe specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode).The subscription instance has expired. You must renew the instance before you can proceed.
403OperationDeniedThe specified snapshot dees not support ResetDisk.The specified snapshot cannot be used to reset the disk.
403InvalidSnapshotId.NotReadyThe specified snapshot has not completed yet.The specified snapshot is being created.
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
403InvalidAccountStatus.SnapshotServiceUnavailableSnapshot service has not been opened yet.The operation is not supported while the snapshot service is not activated.
403Operation.ConflictThe operation may conflicts with others.The operation conflicts with other operations.
403UserNotInTheWhiteListThe user is not in disk white list.You are not authorized to manage the disk. Try again when you are authorized.
403InvalidParameter.KMSKeyId.CMKUnauthorizedThe CMK needs to be added ECS tag.-
403InvalidParameter.KMSKeyId.CMKNotEnabledThe CMK needs to be enabled.The customer master key (CMK) is not enabled when KMSKeyId is specified for an encrypted disk. You can call the DescribeKey operation of KMS to query information about the specified CMK.
403InvalidParameter.KMSKeyId.KMSUnauthorizedECS service have no right to access your KMS.ECS is not authorized to access your KMS resources.
403IncorrectDiskStatus.HasUnfinishedSnapshotThe current disk has unfinished snapshot.-
403InvalidOperation.DiskResetInProgressThe operation cannot be performed because the disk has an ongoing reset task, please try again later.The current operation cannot be performed because there is a reset task in progress on the disk, please try again later.
404InvalidParameter.KMSKeyId.NotFoundThe specified KMSKeyId does not exist.The specified KMSKeyId parameter does not exist.
404InvalidDiskId.NotFoundThe specified disk does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404Disk.NotFoundThe specified disk does not exist.The specified disk does not exist. Check whether the disk ID is correct.
404InvalidSnapshotId.NotFoundThe specified SnapshotId does not exist.The specified snapshot ID does not exist.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-12-02API Description Update. The Error code has changedView Change Details
2024-11-23The Error code has changedView Change Details
2023-08-25The Error code has changedView Change Details