DeleteSnapshot
Deletes a specified snapshot. You can also call this operation to delete a snapshot that is being created, which cancels the snapshot creation task.
Operation description
When you call this operation, take note of the following items:
If the specified snapshot ID does not exist, the request is ignored.
If the snapshot has been used to create a custom image, it cannot be deleted. You must delete the custom image (DeleteImage) before you can delete the snapshot.
If the snapshot has been used to create a cloud disk and the Force parameter is not specified or is set to false, the snapshot cannot be directly deleted. If you are sure that you want to delete the snapshot, set Force to true to force delete the snapshot. After the snapshot is force deleted, the corresponding cloud disk cannot be reinitialized.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DeleteSnapshot |
delete |
*Snapshot
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SnapshotId |
string |
Yes |
The snapshot ID. |
s-bp1c0doj0taqyzzl**** |
| Force |
boolean |
No |
Specifies whether to force delete a snapshot that has been used to create a cloud disk. Valid values:
Default value: false. |
false |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MissingParameter | The input parameter SnapshotId that is mandatory for processing this request is not supplied. | The SnapshotId parameter is required. |
| 400 | IncorrectDiskStatus.CreatingSnapshot | The specified snapshot is still being created. Please wait until the snapshot creation completes 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 | SnapshotCreatedImage | The specified snapshot has been used to create custom images. Please delete the related images and try again. | |
| 403 | SnapshotCreatedDisk | The snapshot has been used to create disk(s). | The specified snapshot has been used to create disks, and cannot be deleted when the Force parameter is left empty or set to false. If you do want to delete the snapshot, set the Force parameter to true to force delete the snapshot. The disks created from the snapshot cannot be re-initialized after the snapshot is force deleted. |
| 403 | Operation.Conflict | The resource is currently busy with a conflicting operation. Please wait for it to complete and try again. | |
| 403 | InvalidOperation.RelatedSnapshotNotFinished | The related standard snapshot is not finished. Please wait until the snapshot creation completes and try again. | |
| 403 | InvalidOperation.DeleteSharedSnapshotUnsupported | The current snapshot shares authorization with other users. Please revoke the shared authorization through resource management first. | The current snapshot is used by other users with the shared authorization. Use Resource Management to revoke the authorization before performing the operation. |
| 403 | InvalidOperation.ResourceManagedByCloudProduct | The current operation is not supported because the resource is managed by a cloud product. Please contact the relevant cloud product to confirm the reason. | This operation is not supported because the resource is managed by cloud products. Contact the corresponding cloud product to confirm the reason. |
| 403 | InvalidOperation.SnapshotIsLocked | The current operation is not supported because the snapshot is locked. Please wait until the lock expires and try again. | |
| 403 | InvalidStatus.SnapshotWarmingUp | The specified snapshot has an active warming-up task and cannot be deleted. Please wait for the warming-up task to complete and try again. | |
| 404 | InvalidSnapshotId.NotFound | The specified SnapshotId does not exist. Please verify the SnapshotId and the current region and try again. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.