Skip to main content

Create Workspace Module – Infra API

POST /workspace/create/vm (Not for Dev/Local Usage)

Creates a new VM on a random active host.

Request Body

{
"userEmail": "user@example.com"
}
  • userEmail: (string, required) The email address of the user requesting the VM. This is used for associating the VM with a workspace entry.

Sample Response

{
"vmId": "vm-8c6d0c9c"
}
  • vmId: The unique identifier of the newly created virtual machine.

GET /workspace/status/:vmId (Not for Dev/Local Usage)

Retrieves the status of the virtual machine.

Path Parameter

  • vmId: (string, required) The ID of the VM whose status is to be checked.

Sample Response

{
"status": "running",
"ipAddress": "172.20.10.5"
}
  • status: One of creating, running, stopped, failed, etc.
  • ipAddress: The internal or external IP address of the VM, if available.

Execution Behavior

  • Host Selection:

    • If a vmId is provided in a status request, the host linked to that VM is used.
    • If no valid host is found for creation, a random active host is selected from the pool.
  • SSH Key Injection:

    • The public SSH key (MASTER_PUBLIC_SSH_KEY) is injected into the VM during creation.
  • Status Tracking:

    • VM status is pulled from the remote host API.
    • The local database is updated with the latest status and IP address after each status check.