Spot instances

Create spot instance

This method creates a spot instance according to the specified parameters.

A Spot Instance is a specialized compute instance that allows you to access and utilize unused instance capacity at a steeply discounted rate. Spot price is charged on an hourly basis.

To create a spot instance, follow these steps:

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

  2. Select an available hardware configuration for the spot instance using the /v1/spots-configs endpoint.

To create a GPU spot instance, include acceleratorTypeId and accelerators fields in the request body. Obtain these values from the selected configuration in the GET /v1/spots-configs response.

  1. Select an SSH key for the Linux spot instance using the /v1/ssh-keys endpoint.

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

  3. 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.

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

A price field of a spot instance is required.

The spot instance market operates on a bidding system. Your specified price acts as your bid in this market. If your bid is higher than the current spot price, your instance request will likely be fulfilled. However, if the market price exceeds your bid, your instance may not be launched or could be terminated if already running.

post/v1/spot-instances

Request

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

Request body

namestring required

Name of the spot instance

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 the 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

sshKeyIdinteger nullable

SSH-key ID

userPasswordstring nullable

User password

securityGroupIdinteger

ID of the security group

acceleratorTypeIdstring nullable

GPU accelerator type identifier. Obtain from the acceleratorTypeId field in the GET /v1/spots-configs response. Required when creating a GPU spot instance.

acceleratorsnumber nullable

Number of GPU accelerators. Must match the value from the selected configuration in GET /v1/spots-configs. Required when acceleratorTypeId is specified.

pricenumber required

Offer price of the spot instance

initScriptstring nullable

Optional bash script to execute after the spot instance 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 spot instance. Not supported for Windows operating system or VMware provider.

Example request

{
  "name": "spot-default",
  "dataCenterId": "aws-us-west-1",
  "osId": 35,
  "cloudNetworkType": "multi-cloud",
  "vCpuType": "shared",
  "vCpu": 4,
  "ramGb": 2,
  "volumeType": "ssd",
  "volumeGb": 16,
  "sshKeyId": 124,
  "userPassword": "m#P52s@ap$V",
  "securityGroupId": 208,
  "acceleratorTypeId": "7bf9d828-e3e8-496f-9901-9045640bb287",
  "accelerators": 1,
  "price": 0.002635,
  "initScript": "#!/bin/bash\napt-get update && apt-get install -y curl"
}

Response

Spot instance 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'

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

SSH key ID

userNamestring

User name

userPasswordstring

Administrator password in the Windows operating system

systemKeyInstalledboolean

Indicates whether the emma system SSH key is installed on the spot instance

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": "GCP"
  },
  "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": "GCP",
    "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,
      "name": "volume-12fg45t",
      "sizeGb": 250,
      "typeId": 2,
      "type": "ssd",
      "isBootable": true,
      "deviceIdentifier": "/dev/sda"
    }
  ],
  "networks": [
    {
      "id": 9826,
      "ip": "10.106.0.2",
      "networkTypeId": 2,
      "networkType": "PRIVATE"
    },
    {
      "id": 9825,
      "ip": "134.122.100.131",
      "networkTypeId": 1,
      "networkType": "PUBLIC"
    }
  ],
  "securityGroup": {
    "id": 208,
    "name": "default"
  },
  "sshKeyId": 123,
  "userName": "root",
  "userPassword": "jsa7235!Hjk",
  "cost": {
    "unit": "HOURS",
    "currency": "EUR",
    "price": 0.002952,
    "minPrice": 0.002952,
    "maxPrice": 0.003152
  },
  "localDisks": [
    {
      "sizeTb": 5,
      "typeId": 2,
      "type": "ssd-plus"
    }
  ],
  "accelerator": {
    "acceleratorTypeId": "53b7db26-4a1b-42f7-97a5-592edd685c5a",
    "acceleratorType": "T4",
    "accelerators": 1,
    "totalGpuMemoryGb": 16
  },
  "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.