Skip to content
  • Auto
  • Light
  • Dark

Create

Create Snapshot from a Volume
client.gpuDroplets.volumes.snapshots.create(stringvolumeID, SnapshotCreateParams { name, tags } body, RequestOptionsoptions?): SnapshotCreateResponse { snapshot }
post/v2/volumes/{volume_id}/snapshots

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

ParametersExpand Collapse
volumeID: string
body: SnapshotCreateParams { name, tags }
name: string

A human-readable name for the volume snapshot.

tags?: Array<string> | null

A flat array of tag names as strings to be applied to the resource. Tag names may be for either existing or new tags.

Requires tag:create scope.

ReturnsExpand Collapse
SnapshotCreateResponse { snapshot }
snapshot?: Snapshots { id, created_at, min_disk_size, 6 more }
id: string

The unique identifier for the snapshot.

created_at: string

A time value given in ISO8601 combined date and time format that represents when the snapshot was created.

formatdate-time
min_disk_size: number

The minimum size in GB required for a volume or Droplet to use this snapshot.

name: string

A human-readable name for the snapshot.

regions: Array<string>

An array of the regions that the snapshot is available in. The regions are represented by their identifying slug values.

resource_id: string

The unique identifier for the resource that the snapshot originated from.

resource_type: "droplet" | "volume"

The type of resource that the snapshot originated from.

Accepts one of the following:
"droplet"
"volume"
size_gigabytes: number

The billable size of the snapshot in gigabytes.

formatfloat
tags: Array<string> | null

An array of Tags the snapshot has been tagged with.

Requires tag:read scope.

Create Snapshot from a Volume
import Gradient from '@digitalocean/gradient';

const client = new Gradient();

const snapshot = await client.gpuDroplets.volumes.snapshots.create('7724db7c-e098-11e5-b522-000f53304e51', {
  name: 'big-data-snapshot1475261774',
});

console.log(snapshot.snapshot);
{
  "snapshot": {
    "id": "8fa70202-873f-11e6-8b68-000f533176b1",
    "created_at": "2020-09-30T18:56:14Z",
    "min_disk_size": 10,
    "name": "big-data-snapshot1475261774",
    "regions": [
      "nyc1"
    ],
    "resource_id": "82a48a18-873f-11e6-96bf-000f53315a41",
    "resource_type": "volume",
    "size_gigabytes": 10,
    "tags": [
      "aninterestingtag"
    ]
  }
}
Returns Examples
{
  "snapshot": {
    "id": "8fa70202-873f-11e6-8b68-000f533176b1",
    "created_at": "2020-09-30T18:56:14Z",
    "min_disk_size": 10,
    "name": "big-data-snapshot1475261774",
    "regions": [
      "nyc1"
    ],
    "resource_id": "82a48a18-873f-11e6-96bf-000f53315a41",
    "resource_type": "volume",
    "size_gigabytes": 10,
    "tags": [
      "aninterestingtag"
    ]
  }
}