DeleteSnapshot

更新时间:
复制 MD 格式

Deletes a specified snapshot. If you call this operation to delete a snapshot that is being created, the associated snapshot creation task is also 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 to false, the snapshot cannot be deleted directly. If you want to delete the snapshot, set Force to true to forcibly delete the snapshot. The disks created from the snapshot cannot be re-initialized after the snapshot is forcibly deleted.

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:DeleteSnapshot

delete

*Snapshot

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

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 the snapshot that has been used to create cloud disks. Valid values:

  • true: force deletes the snapshot. After the snapshot is force deleted, the cloud disks created from the snapshot cannot be re-initialized.

  • false: does not force delete the snapshot.

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 response

JSON format

{
    "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

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 A previous snapshot creation is in process. A previous snapshot creation task is in process. Please try again later.
500 InternalError The request processing has failed due to some unknown error.
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. The snapshot associated with the current snapshot has not completed. Please try again later.
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 for the lock to expire before retrying. The current operation is not supported because the snapshot is locked. Please wait for the lock to expire before retrying.
404 InvalidSnapshotId.NotFound The specified snapshot is not found. The specified Snapshot does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.