Skip to main content

volume_snapshots

Creates, updates, deletes, gets or lists a volume_snapshots resource.

Overview

Namevolume_snapshots
TypeResource
Iddigitalocean.compute.volume_snapshots

Fields

The following fields are returned by SELECT queries:

You will get back a JSON object that has a snapshot key. This will contain the standard snapshot attributes

NameDatatypeDescription
idstringThe unique identifier for the snapshot. (example: 6372321)
namestringA human-readable name for the snapshot. (example: web-01-1595954862243)
resource_idstringThe unique identifier for the resource that the snapshot originated from. (example: 200776916)
created_atstring (date-time)A time value given in ISO8601 combined date and time format that represents when the snapshot was created. (example: 2020-07-28T16:47:44Z)
min_disk_sizeintegerThe minimum size in GB required for a volume or Droplet to use this snapshot.
regionsarrayAn array of the regions that the snapshot is available in. The regions are represented by their identifying slug values.
resource_typestringThe type of resource that the snapshot originated from. (example: droplet)
size_gigabytesnumber (float)The billable size of the snapshot in gigabytes.
tagsarrayAn array of Tags the snapshot has been tagged with.

Requires tag:read scope.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
volume_snapshots_get_by_idselectsnapshot_idTo retrieve the details of a snapshot that has been created from a volume, send a GET request to /v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID.

volume_snapshots_listselectvolume_idper_page, pageTo retrieve the snapshots that have been created from a volume, send a GET request to /v2/volumes/$VOLUME_ID/snapshots.

volume_snapshots_createinsertvolume_id, data__nameTo create a snapshot from a volume, sent a POST request to /v2/volumes/$VOLUME_ID/snapshots.
volume_snapshots_delete_by_iddeletesnapshot_idTo delete a volume snapshot, send a DELETE request to
/v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID.

A status of 204 will be given. This indicates that the request was processed
successfully, but that no response body is needed.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
snapshot_idstringThe unique identifier for the snapshot. (example: fbe805e8-866b-11e6-96bf-000f53315a41)
volume_idstring (uuid)The ID of the block storage volume. (example: 7724db7c-e098-11e5-b522-000f53304e51)
pageintegerWhich 'page' of paginated results to return. (example: 1)
per_pageintegerNumber of items returned per page (example: 2)

SELECT examples

To retrieve the details of a snapshot that has been created from a volume, send a GET request to /v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID.

SELECT
id,
name,
resource_id,
created_at,
min_disk_size,
regions,
resource_type,
size_gigabytes,
tags
FROM digitalocean.compute.volume_snapshots
WHERE snapshot_id = '{{ snapshot_id }}' -- required;

INSERT examples

To create a snapshot from a volume, sent a POST request to /v2/volumes/$VOLUME_ID/snapshots.

INSERT INTO digitalocean.compute.volume_snapshots (
data__name,
data__tags,
volume_id
)
SELECT
'{{ name }}' --required,
'{{ tags }}',
'{{ volume_id }}'
RETURNING
snapshot
;

DELETE examples

To delete a volume snapshot, send a DELETE request to
/v2/volumes/snapshots/$VOLUME_SNAPSHOT_ID.

A status of 204 will be given. This indicates that the request was processed
successfully, but that no response body is needed.

DELETE FROM digitalocean.compute.volume_snapshots
WHERE snapshot_id = '{{ snapshot_id }}' --required;