Attach interface
curl --request POST \
--url https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "external",
"ip_family": "dual",
"security_groups": [
{
"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"
},
{
"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"
}
],
"ddos_profile": {
"profile_template": 29,
"fields": []
}
}
'import requests
url = "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface"
payload = {
"type": "external",
"ip_family": "dual",
"security_groups": [{ "id": "4536dba1-93b1-492e-b3df-270b6b9f3650" }, { "id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa" }],
"ddos_profile": {
"profile_template": 29,
"fields": []
}
}
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({
type: 'external',
ip_family: 'dual',
security_groups: [
{id: '4536dba1-93b1-492e-b3df-270b6b9f3650'},
{id: 'cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa'}
],
ddos_profile: {profile_template: 29, fields: []}
})
};
fetch('https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface', 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/instances/{project_id}/{region_id}/{instance_id}/attach_interface",
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([
'type' => 'external',
'ip_family' => 'dual',
'security_groups' => [
[
'id' => '4536dba1-93b1-492e-b3df-270b6b9f3650'
],
[
'id' => 'cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa'
]
],
'ddos_profile' => [
'profile_template' => 29,
'fields' => [
]
]
]),
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/instances/{project_id}/{region_id}/{instance_id}/attach_interface"
payload := strings.NewReader("{\n \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\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/instances/{project_id}/{region_id}/{instance_id}/attach_interface")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface")
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 \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}Instances
Attach interface
Attach interface to instance
POST
/
cloud
/
v1
/
instances
/
{project_id}
/
{region_id}
/
{instance_id}
/
attach_interface
Attach interface
curl --request POST \
--url https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"type": "external",
"ip_family": "dual",
"security_groups": [
{
"id": "4536dba1-93b1-492e-b3df-270b6b9f3650"
},
{
"id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa"
}
],
"ddos_profile": {
"profile_template": 29,
"fields": []
}
}
'import requests
url = "https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface"
payload = {
"type": "external",
"ip_family": "dual",
"security_groups": [{ "id": "4536dba1-93b1-492e-b3df-270b6b9f3650" }, { "id": "cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa" }],
"ddos_profile": {
"profile_template": 29,
"fields": []
}
}
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({
type: 'external',
ip_family: 'dual',
security_groups: [
{id: '4536dba1-93b1-492e-b3df-270b6b9f3650'},
{id: 'cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa'}
],
ddos_profile: {profile_template: 29, fields: []}
})
};
fetch('https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface', 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/instances/{project_id}/{region_id}/{instance_id}/attach_interface",
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([
'type' => 'external',
'ip_family' => 'dual',
'security_groups' => [
[
'id' => '4536dba1-93b1-492e-b3df-270b6b9f3650'
],
[
'id' => 'cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa'
]
],
'ddos_profile' => [
'profile_template' => 29,
'fields' => [
]
]
]),
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/instances/{project_id}/{region_id}/{instance_id}/attach_interface"
payload := strings.NewReader("{\n \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\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/instances/{project_id}/{region_id}/{instance_id}/attach_interface")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v1/instances/{project_id}/{region_id}/{instance_id}/attach_interface")
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 \"type\": \"external\",\n \"ip_family\": \"dual\",\n \"security_groups\": [\n {\n \"id\": \"4536dba1-93b1-492e-b3df-270b6b9f3650\"\n },\n {\n \"id\": \"cee2ca1f-507a-4a31-b714-f6c1ffb4bdfa\"\n }\n ],\n \"ddos_profile\": {\n \"profile_template\": 29,\n \"fields\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"tasks": [
"d478ae29-dedc-4869-82f0-96104425f565"
]
}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
Region ID
Instance ID
Body
application/json
- Option 1
- Option 2
- Option 3
- Option 4
Instance will be attached to default external network
Advanced DDoS protection.
Show child attributes
Show child attributes
Example:
{ "profile_template": 29, "fields": [] }
Interface name
Maximum string length:
37Which subnets should be selected: IPv4, IPv6 or use dual stack.
Available options:
dual, ipv4, ipv6 Each group will be added to the separate trunk.
Required range:
0 <= x <= 3List of security group IDs
Show child attributes
Show child attributes
Must be 'external'. Union tag
Response
200 - application/json
Created task
List of task IDs representing asynchronous operations. Use these IDs to monitor operation progress:
GET /v1/tasks/{task_id}- Check individual task status and details Poll task status until completion (FINISHED/ERROR) before proceeding with dependent operations.
Example:
["d478ae29-dedc-4869-82f0-96104425f565"]
Was this page helpful?
⌘I