EC2 / Client / delete_volume

delete_volume#

EC2.Client.delete_volume(**kwargs)#

Deletes the specified EBS volume. The volume must be in the available state (not attached to an instance).

The volume can remain in the deleting state for several minutes.

For more information, see Delete an Amazon EBS volume in the Amazon Elastic Compute Cloud User Guide.

See also: AWS API Documentation

Request Syntax

response = client.delete_volume(
    VolumeId='string',
    DryRun=True|False
)
Parameters:
  • VolumeId (string) –

    [REQUIRED]

    The ID of the volume.

  • DryRun (boolean) – Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

Returns:

None

Examples

This example deletes an available volume with the volume ID of vol-049df61146c4d7901. If the command succeeds, no output is returned.

response = client.delete_volume(
    VolumeId='vol-049df61146c4d7901',
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}