Virtual machines

Create virtual machine

This method creates a virtual machine according to the specified parameters.

To create a virtual machine, follow these steps:

  1. Select a data center using the /v1/data-centers endpoint. The data center determines the provider and location of the virtual machine.

  2. Select an available hardware configuration for the virtual machine using the /v1/vms-configs endpoint.

  3. Select an SSH key for the Linux virtual machine using the /v1/ssh-keys endpoint.

  4. Select an operating system using the /v1/operating-systems endpoint.

  5. Choose one of the cloud network types: multi-cloud, isolated, or default. Choose the multi-cloud network type if you need to connect compute instances from different providers.

Providers support the following types of networks:

  • AWS - multi-cloud, isolated, default
  • Azure - multi-cloud, isolated, default
  • DigitalOcean - default
  • Gcore - default
  • GCP - multi-cloud, isolated, default
  • IONOS - default
  • OVHCloud - default
  • VMware - default
  • Nebius - default
  • Hetzner - default

You may choose not to specify a security group. In this case, the virtual machine will be added to the default security group.

post/v1/vms

Request

  • Base URL
    https://api.emma.ms/external
  • Auth
    HTTP bearer

Request body

namestring required

Virtual machine name

dataCenterIdstring required

ID of the provider's data center

osIdinteger required

ID of the operating system

cloudNetworkType'isolated' | 'multi-cloud' | 'default' required

Type of the cloud network

vCpuType'shared' | 'standard' | 'hpc' required

Type of virtual Central Processing Units (vCPUs)

vCpuinteger required

Number of virtual Central Processing Units (vCPUs)

ramGbinteger required

Capacity of the RAM in gigabytes

volumeType'ssd' | 'ssd-plus' required

Volume type

volumeGbinteger required

Capacity of the volume in gigabytes

acceleratorTypeIdstring

GPU accelerator type ID

acceleratorsnumber

Quantity of GPU accelerators

sshKeyIdinteger nullable

SSH-key ID

userPasswordstring nullable

User password for the Windows virtual machine. Not required for the AWS and GCP virtual machines.

securityGroupIdinteger

ID of the security group

subnetworkIdstring

ID of the subnetwork

privateIpstring

IP address within the subnetwork range

ipAddressing'ipv4' | 'dual_stack'

IP addressing, ipv4 or dual stack (ipv4 + ipv6)

initScriptstring nullable

Optional bash script to execute after the virtual machine is created. Supported for Linux operating systems only — providing initScript for a Windows osId returns 422.

installSystemKeyboolean nullable

Install the emma system SSH key on the virtual machine. Not supported for Windows operating system or VMware provider.

Example request

{
  "name": "vm-test1",
  "dataCenterId": "aws-us-west-1",
  "osId": 5,
  "cloudNetworkType": "multi-cloud",
  "vCpuType": "shared",
  "vCpu": 2,
  "ramGb": 4,
  "volumeType": "ssd",
  "volumeGb": 16,
  "acceleratorTypeId": "b3f5a4cb-4e3c-4c63-8c68-e1bd96b7ae1a",
  "accelerators": 4,
  "sshKeyId": 124,
  "userPassword": "m#P52s@ap$V",
  "securityGroupId": 208,
  "subnetworkId": "d6ffb3db-4940-4979-94f3-68b11a018d98",
  "privateIp": "192.168.0.2",
  "ipAddressing": "ipv4",
  "initScript": "#!/bin/bash\napt-get update && apt-get install -y curl"
}

Response

Virtual machine created

idinteger

ID of the virtual machine

createdAtstring

Date and time when the virtual machine was created

createdByNamestring

Name of the user who created the virtual machine

createdByIdinteger

ID of the user who created the virtual machine

modifiedAtstring

Date and time when the virtual machine was last edited

modifiedByNamestring

Name of the user who last edited the virtual machine

modifiedByIdinteger

ID of the user who last edited the virtual machine

namestring

Name of the virtual machine

projectIdinteger

Project ID

status'POWERED_ON' | 'POWERED_OFF' | 'BUSY' | 'DRAFT' | 'FAILED_CREATION'

Status of the virtual machine

vCpuinteger

Number of virtual Central Processing Units (vCPUs)

vCpuType'shared' | 'standard' | 'hpc'

Type of virtual Central Processing Units (vCPUs)

cloudNetworkType'isolated' | 'multi-cloud' | 'default'

Cloud network type

ramGbinteger

Capacity of the RAM in gigabytes

sshKeyIdinteger nullable

SSH key ID

userNamestring nullable

User name

userPasswordstring nullable

User password

systemKeyInstalledboolean

Indicates whether the emma system SSH key is installed on the virtual machine

Example response

{
  "id": 8100,
  "createdAt": "2021-11-26T14:54:11",
  "createdByName": "Automation User",
  "createdById": 123,
  "modifiedAt": "2021-11-26T14:54:11",
  "modifiedByName": "Automation User",
  "modifiedById": 123,
  "name": "vm-default-e08149hp",
  "projectId": 933,
  "status": "POWERED_ON",
  "provider": {
    "id": 22,
    "name": "Digital Ocean"
  },
  "location": {
    "id": 6,
    "name": "London",
    "country": "United Kingdom",
    "continent": "Asia",
    "region": "EMEA",
    "latitude": 51.50735,
    "longitude": -0.1277583
  },
  "dataCenter": {
    "id": "aws-ap-south-1",
    "name": "eu-north-1",
    "providerId": 5,
    "providerName": "DO",
    "locationId": 35,
    "locationName": "Pune"
  },
  "os": {
    "id": 35,
    "family": "Linux",
    "architecture": "x86-64",
    "type": "Ubuntu",
    "version": "22.04"
  },
  "vCpu": 1,
  "vCpuType": "shared",
  "cloudNetworkType": "multi-cloud",
  "ramGb": 2,
  "disks": [
    {
      "id": 5819,
      "sizeGb": 250,
      "typeId": 2,
      "type": "ssd",
      "isBootable": true,
      "deviceIdentifier": "/dev/sda"
    }
  ],
  "localDisks": [
    {
      "sizeTb": 5,
      "typeId": 2,
      "type": "ssd-plus"
    }
  ],
  "accelerator": {
    "acceleratorTypeId": "b3f5a4cb-4e3c-4c63-8c68-e1bd96b7ae1a",
    "acceleratorType": "NVIDIA A100",
    "accelerators": 4,
    "totalGpuMemoryGb": 320
  },
  "networks": [
    {
      "id": 9825,
      "ip": "10.106.0.2",
      "ipVersion": 4,
      "networkTypeId": 2,
      "networkType": "PRIVATE"
    },
    {
      "id": 9826,
      "ip": "134.122.100.131",
      "ipVersion": 4,
      "networkTypeId": 1,
      "networkType": "PUBLIC"
    },
    {
      "id": 9827,
      "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334",
      "ipVersion": 6,
      "networkTypeId": 1,
      "networkType": "PUBLIC"
    }
  ],
  "securityGroup": {
    "id": 208,
    "name": "default"
  },
  "subnetwork": {
    "id": "d6ffb3db-4940-4979-94f3-68b11a018d98",
    "name": "subnetwork-name"
  },
  "sshKeyId": 123,
  "userName": "root",
  "userPassword": "m#P52s@ap$V",
  "cost": {
    "unit": "MONTHS",
    "currency": "EUR",
    "price": 5.479952
  },
  "tags": [
    {
      "key": "env",
      "value": "dev"
    }
  ],
  "systemKeyInstalled": true,
  "workflowExecutionInfo": {
    "workflowTemplateId": 123,
    "workflowTemplateName": "install-lamp",
    "workflowExists": true,
    "versionName": "v3",
    "versionExists": true
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.