DigitalOcean.Volumes reference
Volume
Section titled “Volume”Source:
packages/digitalocean/src/Volume.ts
A DigitalOcean Block Storage Volume: a network disk that attaches to one
droplet in the same region. Growing sizeGigabytes and changing tags
update the volume in place; any other change replaces it, which loses
its data, so take a snapshot first.
Alchemy tags every volume it creates with an alchemy: ownership tag
and an alchemy:generation: tag, so an interrupted deploy resumes on the
volume it already created. A same-named volume without the ownership tag
is Unowned and needs --adopt.
Volume: Creating a Volume
Section titled “Volume: Creating a Volume”A formatted volume
const data = yield* DigitalOcean.Volume("data", { region: "sfo3", sizeGigabytes: 100, filesystemType: "ext4",});Restore from a snapshot
const restored = yield* DigitalOcean.Volume("restored", { region: "sfo3", sizeGigabytes: 100, snapshotId: "3f1b8a8e-2c1f-11ef-9c3b-0a58ac14a0e5",});Volume: Attaching to a Droplet
Section titled “Volume: Attaching to a Droplet”const host = yield* DigitalOcean.Droplet("app", { region: "sfo3", size: "s-1vcpu-1gb", image: "ubuntu-24-04-x64",});const data = yield* DigitalOcean.Volume("data", { region: "sfo3", sizeGigabytes: 50, filesystemType: "ext4",});yield* DigitalOcean.VolumeAttachment("data-on-app", { volumeId: data.volumeId, dropletId: host.dropletId,});Volume: Growing a Volume
Section titled “Volume: Growing a Volume”// Raising sizeGigabytes from 50 resizes the volume without replacing it.const data = yield* DigitalOcean.Volume("data", { region: "sfo3", sizeGigabytes: 200, filesystemType: "ext4",});VolumeAttachment
Section titled “VolumeAttachment”Source:
packages/digitalocean/src/VolumeAttachment.ts
Attaches a Block Storage Volume to a droplet. Destroying the attachment detaches the volume; the volume and its data stay. A volume attaches to one droplet at a time, and both must be in the same region.
The volume appears in the droplet as /dev/disk/by-id/scsi-0DO_Volume_<name>.
Mount it from the droplet’s cloud-init or your own configuration.
VolumeAttachment: Attaching a Volume
Section titled “VolumeAttachment: Attaching a Volume”const host = yield* DigitalOcean.Droplet("app", { region: "sfo3", size: "s-1vcpu-1gb", image: "ubuntu-24-04-x64",});const data = yield* DigitalOcean.Volume("data", { region: "sfo3", sizeGigabytes: 50, filesystemType: "ext4",});yield* DigitalOcean.VolumeAttachment("data-on-app", { volumeId: data.volumeId, dropletId: host.dropletId,});VolumeSnapshot
Section titled “VolumeSnapshot”Source:
packages/digitalocean/src/VolumeSnapshot.ts
A point-in-time snapshot of a block storage Volume, taken when the resource
is created. Restore it by creating a Volume from snapshotId.
VolumeSnapshot: Taking a Snapshot
Section titled “VolumeSnapshot: Taking a Snapshot”const snap = yield* DigitalOcean.VolumeSnapshot("nightly", { volumeId: data.volumeId,});