curl --request POST \
--url https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd",
"attachment_tag": "boot"
}
'import requests
url = "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach"
payload = {
"instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd",
"attachment_tag": "boot"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({instance_id: '169942e0-9b53-42df-95ef-1a8b6525c2bd', attachment_tag: 'boot'})
};
fetch('https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instance_id' => '169942e0-9b53-42df-95ef-1a8b6525c2bd',
'attachment_tag' => 'boot'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach"
payload := strings.NewReader("{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}"
response = http.request(request)
puts response.read_body{
"bootable": false,
"created_at": "2019-05-29T05:32:41+0000",
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"is_root_volume": false,
"name": "volume-1",
"project_id": 1,
"region": "Luxembourg",
"region_id": 1,
"size": 50,
"status": "available",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"volume_type": "standard",
"attachments": [
{
"attachment_id": "f2ed59d9-8068-400c-be4b-c4501ef6f33c",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227",
"attached_at": "2019-07-26T14:22:03+0000",
"device": "/dev/vda",
"flavor_id": "g1-standard-1-2",
"instance_name": "instance-1",
"server_id": "8dc30d49-bb34-4920-9bbd-03a2587ec0ad"
}
],
"creator_task_id": "d74c2bb9-cea7-4b23-a009-2f13518ae66d",
"limiter_stats": {
"MBps_base_limit": 50,
"MBps_burst_limit": 200,
"iops_base_limit": 1000,
"iops_burst_limit": 5000
},
"snapshot_ids": [
"<string>"
],
"task_id": "<string>",
"updated_at": "2019-05-29T05:39:20+0000",
"volume_image_metadata": {
"checksum": "ba3cd24377dde5dfdd58728894004abb",
"container_format": "bare",
"disk_format": "raw",
"image_id": "723037e2-ec6d-47eb-92de-6276c8907839",
"image_name": "cirros-gcloud",
"min_disk": "1",
"min_ram": "0",
"size": "46137344"
}
}Attach volume
Attach a volume to an instance. The volume must be in an available state to be attached.
curl --request POST \
--url https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd",
"attachment_tag": "boot"
}
'import requests
url = "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach"
payload = {
"instance_id": "169942e0-9b53-42df-95ef-1a8b6525c2bd",
"attachment_tag": "boot"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({instance_id: '169942e0-9b53-42df-95ef-1a8b6525c2bd', attachment_tag: 'boot'})
};
fetch('https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'instance_id' => '169942e0-9b53-42df-95ef-1a8b6525c2bd',
'attachment_tag' => 'boot'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach"
payload := strings.NewReader("{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/volumes/{project_id}/{region_id}/{volume_id}/attach")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"instance_id\": \"169942e0-9b53-42df-95ef-1a8b6525c2bd\",\n \"attachment_tag\": \"boot\"\n}"
response = http.request(request)
puts response.read_body{
"bootable": false,
"created_at": "2019-05-29T05:32:41+0000",
"id": "726ecfcc-7fd0-4e30-a86e-7892524aa483",
"is_root_volume": false,
"name": "volume-1",
"project_id": 1,
"region": "Luxembourg",
"region_id": 1,
"size": 50,
"status": "available",
"tags": [
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
],
"volume_type": "standard",
"attachments": [
{
"attachment_id": "f2ed59d9-8068-400c-be4b-c4501ef6f33c",
"volume_id": "67baa7d1-08ea-4fc5-bef2-6b2465b7d227",
"attached_at": "2019-07-26T14:22:03+0000",
"device": "/dev/vda",
"flavor_id": "g1-standard-1-2",
"instance_name": "instance-1",
"server_id": "8dc30d49-bb34-4920-9bbd-03a2587ec0ad"
}
],
"creator_task_id": "d74c2bb9-cea7-4b23-a009-2f13518ae66d",
"limiter_stats": {
"MBps_base_limit": 50,
"MBps_burst_limit": 200,
"iops_base_limit": 1000,
"iops_burst_limit": 5000
},
"snapshot_ids": [
"<string>"
],
"task_id": "<string>",
"updated_at": "2019-05-29T05:39:20+0000",
"volume_image_metadata": {
"checksum": "ba3cd24377dde5dfdd58728894004abb",
"container_format": "bare",
"disk_format": "raw",
"image_id": "723037e2-ec6d-47eb-92de-6276c8907839",
"image_name": "cirros-gcloud",
"min_disk": "1",
"min_ram": "0",
"size": "46137344"
}
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Path Parameters
Project ID
1
Region ID
1
Volume ID
"726ecfcc-7fd0-4e30-a86e-7892524aa483"
Body
Response
OK
Indicates whether the volume is bootable.
false
The date and time when the volume was created.
"2019-05-29T05:32:41+0000"
The unique identifier of the volume.
"726ecfcc-7fd0-4e30-a86e-7892524aa483"
Indicates whether this is a root volume.
false
The name of the volume.
"volume-1"
Project ID.
1
The region where the volume is located.
"Luxembourg"
The identifier of the region.
1
The size of the volume in gibibytes (GiB).
50
The current status of the volume.
attaching, available, awaiting-transfer, backing-up, creating, deleting, detaching, downloading, error, error_backing-up, error_deleting, error_extending, error_restoring, extending, in-use, maintenance, reserved, restoring-backup, retyping, reverting, uploading "available"
List of key-value tags associated with the resource. A tag is a key-value pair that can be associated with a resource, enabling efficient filtering and grouping for better organization and management. Some tags are read-only and cannot be modified by the user. Tags are also integrated with cost reports, allowing cost data to be filtered based on tag keys or values.
Show child attributes
Show child attributes
[
{
"key": "my-tag",
"read_only": false,
"value": "my-tag-value"
}
]
The type of volume storage.
"standard"
List of attachments associated with the volume.
Show child attributes
Show child attributes
The ID of the task that created this volume.
"d74c2bb9-cea7-4b23-a009-2f13518ae66d"
Quality of Service (QoS) parameters for this volume.
Show child attributes
Show child attributes
List of snapshot IDs associated with this volume.
The UUID of the active task that currently holds a lock on the resource. This lock prevents concurrent modifications to ensure consistency. If null, the resource is not locked.
The date and time when the volume was last updated.
"2019-05-29T05:39:20+0000"
Image metadata for volumes created from an image.
Show child attributes
Show child attributes
{
"checksum": "ba3cd24377dde5dfdd58728894004abb",
"container_format": "bare",
"disk_format": "raw",
"image_id": "723037e2-ec6d-47eb-92de-6276c8907839",
"image_name": "cirros-gcloud",
"min_disk": "1",
"min_ram": "0",
"size": "46137344"
}
Was this page helpful?