Deletes a snapshot. If you call this operation to delete a snapshot that is being created, the snapshot creation task is canceled.
Operation description
Take note of the following items:
- If the snapshot does not exist, the request is ignored.
- If the snapshot has been used to create custom images, the snapshot cannot be deleted. You need to call the DeleteImage operation to delete the custom images before you can delete the snapshot.
- If the snapshot has been used to create disks and
Force
is not specified or is set tofalse
, the snapshot cannot be deleted directly. If you want to delete the snapshot, setForce
to true to forcibly delete the snapshot. The disks created from the snapshot cannot be re-initialized after the snapshot is forcibly deleted.
Debugging
Authorization information
There is currently no authorization information disclosed in the API.
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
SnapshotId | string | Yes | The snapshot ID. | s-bp1c0doj0taqyzzl**** |
Force | boolean | No | Specifies whether to forcibly delete the snapshot that has been used to create disks. Valid values:
Default value: false. | false |
Response parameters
Examples
Sample success responses
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. |
403 | SnapshotCreatedImage | The snapshot has been used to create user defined image(s). | The snapshot has been used to create custom images and cannot be deleted. The snapshot can be deleted only after the created custom images are deleted (DeleteImage). |
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 operation may conflicts with others, please retry later. | This operation conflicts with another operation. Try again later. |
403 | InvalidOperation.RelatedSnapshotNotFinished | The related standard snapshot is not finished. | - |
403 | SnapshotCreatedDisk | The snapshot that you are trying to delete is in use by one or more disks. | The snapshot that you are attempting to delete has been used to create one or more disks. |
404 | InvalidSnapshotId.NotFound | The specified snapshot is not found. | - |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error has occurred. Try again later. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-11-08 | The Error code has changed | see changesets | ||||||||||
|