POST
/
cloud
/
v2
/
instances
/
{project_id}
/
{region_id}
Python
from gcore import Gcore

client = Gcore(
    api_key="My API Key",
)
task_id_list = client.cloud.instances.create(
    project_id=1,
    region_id=1,
    flavor="g2-standard-32-64",
    interfaces=[{
        "type": "external"
    }],
    volumes=[{
        "size": 20,
        "source": "new-volume",
    }],
)
print(task_id_list.tasks)
{
  "tasks": [
    "d478ae29-dedc-4869-82f0-96104425f565"
  ]
}

Authorizations

Authorization
string
header
required

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
integer
required

Project ID

Examples:

1

region_id
integer
required

Region ID

Examples:

1

Body

application/json
flavor
string
required

The flavor of the instance.

Examples:

"g2-standard-32-64"

interfaces
Interfaces · array
required

A list of network interfaces for the instance. You can create one or more interfaces - private, public, or both.

Minimum length: 1
volumes
Volumes · array
required

List of volumes that will be attached to the instance.

Minimum length: 1
allow_app_ports
boolean

Set to true if creating the instance from an apptemplate. This allows application ports in the security group for instances created from a marketplace application template.

configuration
object | null

Parameters for the application template if creating the instance from an apptemplate.

name
string

Instance name.

Examples:

"my-instance"

name_template
string

If you want the instance name to be automatically generated based on IP addresses, you can provide a name template instead of specifying the name manually. The template should include a placeholder that will be replaced during provisioning. Supported placeholders are: {ip_octets} (last 3 octets of the IP), {two_ip_octets}, and {one_ip_octet}.

password
string

For Linux instances, 'username' and 'password' are used to create a new user. When only 'password' is provided, it is set as the password for the default user of the image. For Windows instances, 'username' cannot be specified. Use the 'password' field to set the password for the 'Admin' user on Windows. Use the 'user_data' field to provide a script to create new users on Windows. The password of the Admin user cannot be updated via 'user_data'.

security_groups
MandatoryIdSchema schema · object[]

Specifies security group UUIDs to be applied to all instance network interfaces.

servergroup_id
string<uuid4>

Placement group ID for instance placement policy.

Supported group types:

  • anti-affinity: Ensures instances are placed on different hosts for high availability.
  • affinity: Places instances on the same host for low-latency communication.
  • soft-anti-affinity: Tries to place instances on different hosts but allows sharing if needed.
ssh_key_name
string | null

Specifies the name of the SSH keypair, created via the /v1/ssh_keys endpoint.

Examples:

"my-ssh-key"

tags
object

Key-value tags to associate 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.

user_data
string

String in base64 format. For Linux instances, 'user_data' is ignored when 'password' field is provided. For Windows instances, Admin user password is set by 'password' field and cannot be updated via 'user_data'. Examples of the user_data: https://cloudinit.readthedocs.io/en/latest/topics/examples.html

username
string

For Linux instances, 'username' and 'password' are used to create a new user. For Windows instances, 'username' cannot be specified. Use 'password' field to set the password for the 'Admin' user on Windows.

Response

200 - application/json

OK

tasks
string[]
required

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.

Examples:
["d478ae29-dedc-4869-82f0-96104425f565"]