Create VM
client.compute.vms.create(VMCreateParams { boot_volume, instance_type, name, 8 more } body, RequestOptionsoptions?): Operation { id, created_at, details, 6 more }
POST/v1/compute/vms
Create VM
import NirvanaLabs from '@nirvana-labs/nirvana';
const client = new NirvanaLabs({
apiKey: process.env['NIRVANA_LABS_API_KEY'], // This is the default and can be omitted
});
const operation = await client.compute.vms.create({
boot_volume: { size: 100, type: 'abs' },
instance_type: 'n1-standard-8',
name: 'my-vm',
os_image_name: 'ubuntu-noble-2025-10-01',
project_id: '123e4567-e89b-12d3-a456-426614174000',
public_ip_enabled: true,
region: 'us-sva-2',
ssh_key: {
public_key: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDBIASkmwNiLcdlW6927Zjt1Hf7Kw/PpEZ4Zm+wU9wn2',
},
subnet_id: '123e4567-e89b-12d3-a456-426614174000',
});
console.log(operation.id);{
"id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2025-01-01T00:00:00Z",
"details": {
"changes": {
"foo": {
"from": "string",
"to": "string"
}
}
},
"kind": "vm",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"resource_id": "123e4567-e89b-12d3-a456-426614174000",
"status": "pending",
"type": "create",
"updated_at": "2025-01-01T00:00:00Z"
}Returns Examples
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"created_at": "2025-01-01T00:00:00Z",
"details": {
"changes": {
"foo": {
"from": "string",
"to": "string"
}
}
},
"kind": "vm",
"project_id": "123e4567-e89b-12d3-a456-426614174000",
"resource_id": "123e4567-e89b-12d3-a456-426614174000",
"status": "pending",
"type": "create",
"updated_at": "2025-01-01T00:00:00Z"
}