curl --request POST \
--url https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"flavor": "g1-standard-1-2",
"interfaces": [
{
"floating_ip": {
"source": "new"
},
"network_id": "ddc28e44-2acb-499b-985b-831f29432e1c",
"subnet_id": "2731a56e-a5c9-44be-80c2-02c57c594573",
"type": "subnet"
},
{
"floating_ip": {
"existing_floating_id": "57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a",
"source": "existing"
},
"network_id": "53609647-2619-420a-b046-59905c8e3370",
"subnet_id": "e3c6ee77-48cb-416b-b204-11b492cc776e3",
"type": "subnet"
},
{
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"subnet_id": "382a83e5-1b38-49f9-bd83-730353b29ed4",
"type": "subnet"
},
{
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"type": "any_subnet"
},
{
"type": "external"
}
],
"names": [
"my-instance-1"
],
"volumes": [
{
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
},
{
"size": 5,
"source": "new-volume",
"type_name": "standard"
},
{
"snapshot_id": "7cca40d7-a843-4e9f-ae08-62b9a394b1ab",
"source": "snapshot"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances"
payload = {
"flavor": "g1-standard-1-2",
"interfaces": [{
"floating_ip": { "source": "new" },
"network_id": "ddc28e44-2acb-499b-985b-831f29432e1c",
"subnet_id": "2731a56e-a5c9-44be-80c2-02c57c594573",
"type": "subnet"
}, {
"floating_ip": {
"existing_floating_id": "57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a",
"source": "existing"
},
"network_id": "53609647-2619-420a-b046-59905c8e3370",
"subnet_id": "e3c6ee77-48cb-416b-b204-11b492cc776e3",
"type": "subnet"
}, {
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"subnet_id": "382a83e5-1b38-49f9-bd83-730353b29ed4",
"type": "subnet"
}, {
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"type": "any_subnet"
}, { "type": "external" }],
"names": ["my-instance-1"],
"volumes": [
{
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
},
{
"size": 5,
"source": "new-volume",
"type_name": "standard"
},
{
"snapshot_id": "7cca40d7-a843-4e9f-ae08-62b9a394b1ab",
"source": "snapshot"
}
]
}
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({
flavor: 'g1-standard-1-2',
interfaces: [
{
floating_ip: {source: 'new'},
network_id: 'ddc28e44-2acb-499b-985b-831f29432e1c',
subnet_id: '2731a56e-a5c9-44be-80c2-02c57c594573',
type: 'subnet'
},
{
floating_ip: {
existing_floating_id: '57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a',
source: 'existing'
},
network_id: '53609647-2619-420a-b046-59905c8e3370',
subnet_id: 'e3c6ee77-48cb-416b-b204-11b492cc776e3',
type: 'subnet'
},
{
network_id: '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
subnet_id: '382a83e5-1b38-49f9-bd83-730353b29ed4',
type: 'subnet'
},
{network_id: '783b36b4-3ef4-48ac-879d-5b3ea53180d8', type: 'any_subnet'},
{type: 'external'}
],
names: ['my-instance-1'],
volumes: [
{size: 10, source: 'image', type_name: 'ssd_hiiops'},
{size: 5, source: 'new-volume', type_name: 'standard'},
{snapshot_id: '7cca40d7-a843-4e9f-ae08-62b9a394b1ab', source: 'snapshot'}
]
})
};
fetch('https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances', 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/v2/pricing/{project_id}/{region_id}/instances",
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([
'flavor' => 'g1-standard-1-2',
'interfaces' => [
[
'floating_ip' => [
'source' => 'new'
],
'network_id' => 'ddc28e44-2acb-499b-985b-831f29432e1c',
'subnet_id' => '2731a56e-a5c9-44be-80c2-02c57c594573',
'type' => 'subnet'
],
[
'floating_ip' => [
'existing_floating_id' => '57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a',
'source' => 'existing'
],
'network_id' => '53609647-2619-420a-b046-59905c8e3370',
'subnet_id' => 'e3c6ee77-48cb-416b-b204-11b492cc776e3',
'type' => 'subnet'
],
[
'network_id' => '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
'subnet_id' => '382a83e5-1b38-49f9-bd83-730353b29ed4',
'type' => 'subnet'
],
[
'network_id' => '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
'type' => 'any_subnet'
],
[
'type' => 'external'
]
],
'names' => [
'my-instance-1'
],
'volumes' => [
[
'size' => 10,
'source' => 'image',
'type_name' => 'ssd_hiiops'
],
[
'size' => 5,
'source' => 'new-volume',
'type_name' => 'standard'
],
[
'snapshot_id' => '7cca40d7-a843-4e9f-ae08-62b9a394b1ab',
'source' => 'snapshot'
]
]
]),
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/v2/pricing/{project_id}/{region_id}/instances"
payload := strings.NewReader("{\n \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\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/v2/pricing/{project_id}/{region_id}/instances")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances")
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 \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"currency_code": "USD",
"discount_details": {
"discount": "0.5",
"resource": "ssd_hiiops"
},
"discount_percent": "10.50",
"per_gb": {
"egress_traffic_baremetal": 1.3,
"egress_traffic_virtual": 0.5
},
"per_hour": {
"external_ip": 14.4,
"flavor": 576,
"floating_ip": 36,
"volumes": {
"cold": 78,
"ssd_hiiops": 20,
"ssd_lowlatency": 10,
"standard": 10,
"ultra": 78
}
},
"per_month": {
"external_ip": 14.4,
"flavor": 576,
"floating_ip": 36,
"volumes": {
"cold": 78,
"ssd_hiiops": 20,
"ssd_lowlatency": 10,
"standard": 10,
"ultra": 78
}
},
"price_without_discount_per_month": "800.00",
"tax_percent": 0,
"total_price_per_hour": "1.02",
"total_price_per_month": "734.4",
"vm_count": 1
}Preview instance price
Preview billing price of the server instance
curl --request POST \
--url https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"flavor": "g1-standard-1-2",
"interfaces": [
{
"floating_ip": {
"source": "new"
},
"network_id": "ddc28e44-2acb-499b-985b-831f29432e1c",
"subnet_id": "2731a56e-a5c9-44be-80c2-02c57c594573",
"type": "subnet"
},
{
"floating_ip": {
"existing_floating_id": "57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a",
"source": "existing"
},
"network_id": "53609647-2619-420a-b046-59905c8e3370",
"subnet_id": "e3c6ee77-48cb-416b-b204-11b492cc776e3",
"type": "subnet"
},
{
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"subnet_id": "382a83e5-1b38-49f9-bd83-730353b29ed4",
"type": "subnet"
},
{
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"type": "any_subnet"
},
{
"type": "external"
}
],
"names": [
"my-instance-1"
],
"volumes": [
{
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
},
{
"size": 5,
"source": "new-volume",
"type_name": "standard"
},
{
"snapshot_id": "7cca40d7-a843-4e9f-ae08-62b9a394b1ab",
"source": "snapshot"
}
]
}
'import requests
url = "https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances"
payload = {
"flavor": "g1-standard-1-2",
"interfaces": [{
"floating_ip": { "source": "new" },
"network_id": "ddc28e44-2acb-499b-985b-831f29432e1c",
"subnet_id": "2731a56e-a5c9-44be-80c2-02c57c594573",
"type": "subnet"
}, {
"floating_ip": {
"existing_floating_id": "57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a",
"source": "existing"
},
"network_id": "53609647-2619-420a-b046-59905c8e3370",
"subnet_id": "e3c6ee77-48cb-416b-b204-11b492cc776e3",
"type": "subnet"
}, {
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"subnet_id": "382a83e5-1b38-49f9-bd83-730353b29ed4",
"type": "subnet"
}, {
"network_id": "783b36b4-3ef4-48ac-879d-5b3ea53180d8",
"type": "any_subnet"
}, { "type": "external" }],
"names": ["my-instance-1"],
"volumes": [
{
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
},
{
"size": 5,
"source": "new-volume",
"type_name": "standard"
},
{
"snapshot_id": "7cca40d7-a843-4e9f-ae08-62b9a394b1ab",
"source": "snapshot"
}
]
}
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({
flavor: 'g1-standard-1-2',
interfaces: [
{
floating_ip: {source: 'new'},
network_id: 'ddc28e44-2acb-499b-985b-831f29432e1c',
subnet_id: '2731a56e-a5c9-44be-80c2-02c57c594573',
type: 'subnet'
},
{
floating_ip: {
existing_floating_id: '57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a',
source: 'existing'
},
network_id: '53609647-2619-420a-b046-59905c8e3370',
subnet_id: 'e3c6ee77-48cb-416b-b204-11b492cc776e3',
type: 'subnet'
},
{
network_id: '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
subnet_id: '382a83e5-1b38-49f9-bd83-730353b29ed4',
type: 'subnet'
},
{network_id: '783b36b4-3ef4-48ac-879d-5b3ea53180d8', type: 'any_subnet'},
{type: 'external'}
],
names: ['my-instance-1'],
volumes: [
{size: 10, source: 'image', type_name: 'ssd_hiiops'},
{size: 5, source: 'new-volume', type_name: 'standard'},
{snapshot_id: '7cca40d7-a843-4e9f-ae08-62b9a394b1ab', source: 'snapshot'}
]
})
};
fetch('https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances', 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/v2/pricing/{project_id}/{region_id}/instances",
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([
'flavor' => 'g1-standard-1-2',
'interfaces' => [
[
'floating_ip' => [
'source' => 'new'
],
'network_id' => 'ddc28e44-2acb-499b-985b-831f29432e1c',
'subnet_id' => '2731a56e-a5c9-44be-80c2-02c57c594573',
'type' => 'subnet'
],
[
'floating_ip' => [
'existing_floating_id' => '57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a',
'source' => 'existing'
],
'network_id' => '53609647-2619-420a-b046-59905c8e3370',
'subnet_id' => 'e3c6ee77-48cb-416b-b204-11b492cc776e3',
'type' => 'subnet'
],
[
'network_id' => '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
'subnet_id' => '382a83e5-1b38-49f9-bd83-730353b29ed4',
'type' => 'subnet'
],
[
'network_id' => '783b36b4-3ef4-48ac-879d-5b3ea53180d8',
'type' => 'any_subnet'
],
[
'type' => 'external'
]
],
'names' => [
'my-instance-1'
],
'volumes' => [
[
'size' => 10,
'source' => 'image',
'type_name' => 'ssd_hiiops'
],
[
'size' => 5,
'source' => 'new-volume',
'type_name' => 'standard'
],
[
'snapshot_id' => '7cca40d7-a843-4e9f-ae08-62b9a394b1ab',
'source' => 'snapshot'
]
]
]),
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/v2/pricing/{project_id}/{region_id}/instances"
payload := strings.NewReader("{\n \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\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/v2/pricing/{project_id}/{region_id}/instances")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/cloud/v2/pricing/{project_id}/{region_id}/instances")
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 \"flavor\": \"g1-standard-1-2\",\n \"interfaces\": [\n {\n \"floating_ip\": {\n \"source\": \"new\"\n },\n \"network_id\": \"ddc28e44-2acb-499b-985b-831f29432e1c\",\n \"subnet_id\": \"2731a56e-a5c9-44be-80c2-02c57c594573\",\n \"type\": \"subnet\"\n },\n {\n \"floating_ip\": {\n \"existing_floating_id\": \"57be69f6-6f6a-4f03-a4ad-8eb86c69ec0a\",\n \"source\": \"existing\"\n },\n \"network_id\": \"53609647-2619-420a-b046-59905c8e3370\",\n \"subnet_id\": \"e3c6ee77-48cb-416b-b204-11b492cc776e3\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"subnet_id\": \"382a83e5-1b38-49f9-bd83-730353b29ed4\",\n \"type\": \"subnet\"\n },\n {\n \"network_id\": \"783b36b4-3ef4-48ac-879d-5b3ea53180d8\",\n \"type\": \"any_subnet\"\n },\n {\n \"type\": \"external\"\n }\n ],\n \"names\": [\n \"my-instance-1\"\n ],\n \"volumes\": [\n {\n \"size\": 10,\n \"source\": \"image\",\n \"type_name\": \"ssd_hiiops\"\n },\n {\n \"size\": 5,\n \"source\": \"new-volume\",\n \"type_name\": \"standard\"\n },\n {\n \"snapshot_id\": \"7cca40d7-a843-4e9f-ae08-62b9a394b1ab\",\n \"source\": \"snapshot\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"currency_code": "USD",
"discount_details": {
"discount": "0.5",
"resource": "ssd_hiiops"
},
"discount_percent": "10.50",
"per_gb": {
"egress_traffic_baremetal": 1.3,
"egress_traffic_virtual": 0.5
},
"per_hour": {
"external_ip": 14.4,
"flavor": 576,
"floating_ip": 36,
"volumes": {
"cold": 78,
"ssd_hiiops": 20,
"ssd_lowlatency": 10,
"standard": 10,
"ultra": 78
}
},
"per_month": {
"external_ip": 14.4,
"flavor": 576,
"floating_ip": 36,
"volumes": {
"cold": 78,
"ssd_hiiops": 20,
"ssd_lowlatency": 10,
"standard": 10,
"ultra": 78
}
},
"price_without_discount_per_month": "800.00",
"tax_percent": 0,
"total_price_per_hour": "1.02",
"total_price_per_month": "734.4",
"vm_count": 1
}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
Body
Pricing details for creating instances with version 2 interfaces.
The flavor of the instance.
"g1-standard-1-2"
Subnet IPs and floating IPs
Instance will be attached to default external network
- NewInterfaceExternalSerializerPydantic
- NewInterfaceSpecificSubnetFipSerializerPydantic
- NewInterfaceAnySubnetFipSerializerPydantic
- NewInterfaceReservedFixedIpFipSerializerPydantic
Show child attributes
Show child attributes
{
"interface_name": "eth0",
"ip_family": "ipv4",
"type": "external"
}
A list of instance name templates. Either this or names must be specified.
["my-instance-{ip_octets}"]
A list of instance names. Either this or name_templates must be specified.
["my-instance-1"]
A list of volumes to be created or used.
Show child attributes
Show child attributes
[
{
"image_id": "b5b4d65d-945f-4b98-ab6f-332319c724ef",
"size": 10,
"source": "image",
"type_name": "ssd_hiiops"
},
{
"size": 5,
"source": "new-volume",
"type_name": "standard"
}
]
Response
OK
Billing response v2 preview schema for server instance.
Currency code (3-letter code per ISO 4217).
AZN, EUR, USD "USD"
Discount details per resource.
Show child attributes
Show child attributes
{
"discount": "0.5",
"resource": "ssd_hiiops"
}
Actual discount as a relative value.
"10.50"
"5.00"
Pricing details per category charged per GB.
Show child attributes
Show child attributes
{
"egress_traffic_baremetal": 1.3,
"egress_traffic_virtual": 0.5
}
Prices per category charged per hour.
Show child attributes
Show child attributes
{
"external_ip": 0.02,
"flavor": 0.8,
"floating_ip": 0.05,
"volumes": {
"cold": 0.1083,
"ssd_hiiops": 0.0278,
"standard": 0.0139
}
}
Prices per category charged per month.
Show child attributes
Show child attributes
{
"external_ip": 14.4,
"flavor": 576,
"floating_ip": 36,
"volumes": {
"cold": 78,
"ssd_hiiops": 20,
"standard": 10
}
}
Price status for the UI.
error, hide, show "show"
"hide"
Total price VAT inclusive per month without discount.
"800.00"
Tax rate applied to the subtotal, represented as a percentage
0
17
12
Total price VAT inclusive per hour.
"1.02"
Total price VAT inclusive per month.
"734.4"
Number of virtual machine instances being created.
1
10
Was this page helpful?