DigitalOcean-public.v2-new_Block Storage Actions
Initiate A Block Storage Action By Volume Name
To initiate an action on a block storage volume by Name, send a POST request to ~/v2/volumes/actions. The body should contain the appropriate attributes for the respective action.
Attach a Block Storage Volume to a Droplet
| Attribute | Details |
|---|---|
| type | This must be attach |
| volume_name | The name of the block storage volume |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |
Each volume may only be attached to a single Droplet. However, up to fifteen volumes may be attached to a Droplet at a time. Pre-formatted volumes will be automatically mounted to Ubuntu, Debian, Fedora, Fedora Atomic, and CentOS Droplets created on or after April 26, 2018 when attached. On older Droplets, additional configuration is required.
Remove a Block Storage Volume from a Droplet
| Attribute | Details |
|---|---|
| type | This must be detach |
| volume_name | The name of the block storage volume |
| droplet_id | Set to the Droplet's ID |
| region | Set to the slug representing the region where the volume is located |
post/v2/volumes/actions
Query parameters
per_pageinteger
Number of items returned per page
pageinteger
Which 'page' of paginated results to return.
Request body
Example request
{
"type": "attach",
"region": "nyc3",
"droplet_id": 11612190,
"tags": [
"base-image",
"prod"
]
}Response
The response will be an object with a key called action. The value of this will be an object that contains the standard volume action attributes
Example response
{
"action": {
"type": "create",
"resource_id": 3164444,
"id": 36804636,
"status": "completed",
"started_at": "2020-11-14T16:29:21Z",
"completed_at": "2020-11-14T16:30:06Z",
"resource_type": "droplet",
"region": {
"name": "New York 3",
"slug": "nyc3",
"features": [
"private_networking",
"backups",
"ipv6",
"metadata",
"install_agent",
"storage",
"image_transfer"
],
"available": true,
"sizes": [
"s-1vcpu-1gb",
"s-1vcpu-2gb",
"s-1vcpu-3gb",
"s-2vcpu-2gb",
"s-3vcpu-1gb",
"s-2vcpu-4gb",
"s-4vcpu-8gb",
"s-6vcpu-16gb",
"s-8vcpu-32gb",
"s-12vcpu-48gb",
"s-16vcpu-64gb",
"s-20vcpu-96gb",
"s-24vcpu-128gb",
"s-32vcpu-192g"
]
},
"region_slug": "nyc3"
}
}