Logo
OpenScaler
API DocumentationElastic Servers

Create elastic server

POST
/v1/elastic-servers

Create an auto-scaling elastic server pool. An Elastic Server is a cluster of VMs that scale horizontally based on load. You only pay for the VMs you actually use, not the maximum number of nodes in the pool.

The request waits until the pool is ready, then returns the pool as JSON.

Progress is a separate Server-Sent Events stream. Subscribe with the same sequence_id from this request body at GET /v1/events/create-elastic-server/{sequence_id}.

Authorization

bearer_auth
AuthorizationBearer <token>

Authentication

Create an API token on Profile. Send it in the Authorization header:

Authorization: Bearer os1_...

Do not use the Keycloak web-session JWT as an API token. Keep the secret secure and do not share it.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

text/pain

application/json

application/json

curl -X POST "https://example.com/v1/elastic-servers" \  -H "Content-Type: application/json" \  -d '{    "name": "my-servers",    "description": "My elastic servers",    "region": "alg1",    "size": "s-1vcpu-1gb",    "project_id": "default",    "sequence_id": 123,    "distro": "debian-12",    "cloud_init_user_data": "#!/bin/bash\\napt update && apt install -y python3-flask\\n",    "scale_config": {      "autoscale": true,      "min_nodes": 1,      "max_nodes": 5,      "autoscaling_metrics": [        {          "type": "cpu",          "min_threshold": 30,          "max_threshold": 60        }      ],      "cooldown": 90,      "metrics_interval": 60    }  }'
{  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",  "name": "my-servers",  "description": "My elastic servers",  "user_id": "2abb7c25-a2d5-42ac-a776-e8ac5dfb16c3",  "project_id": "default",  "distro": "debian-12",  "region": "alg1",  "vcpus": 1,  "storageGB": 25,  "memoryMB": 1024,  "transferGB": 1000,  "size": "s-1vcpu-1gb",  "vpc_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",  "vpc_subnet": "10.0.20.0/24",  "scale_config": {    "autoscale": true,    "min_nodes": 1,    "max_nodes": 5,    "autoscaling_metrics": [      {        "type": "cpu",        "min_threshold": 30,        "max_threshold": 60      }    ],    "cooldown": 90,    "metrics_interval": 60  },  "paused": false,  "autoscale": true,  "created_at": "2024-06-01T12:00:00Z",  "updated_at": "2024-06-15T08:30:00Z"}
{  "errors": [    {      "message": "'vcpus' field must be an integer",      "field": "resource_id"    }  ]}
"Access denied"
{  "errors": [    {      "message": "User not initialized. Send POST /v1/init, then retry the request."    }  ]}
{  "errors": [    {      "message": "VM with ID 23 not found"    }  ]}