Create a virtual machine
This guide shows you how to create a virtual machine using the evroc CLI.
Prerequisites
Before creating a VM, you need:
- A boot disk with an operating system image
- At least one SSH public key (for access to the VM)
- (Optional) Additional data disks for storage
- (Optional) A Public IP for inbound internet access
- (Optional) Security groups for custom firewall rules
- (Optional) A placement group for high availability
Choose a resource profile
Select a resource profile that matches your workload's CPU, memory, and GPU requirements. Options include:
- General-purpose (a1a): Balanced CPU and memory
- Compute-optimized (c1a): Higher CPU-to-memory ratio
- Memory-optimized (m1a): Higher memory-to-CPU ratio
- GPU profiles (gn-l40s, gn-b200): For machine learning and HPC workloads
Note: GPU VMs support Ubuntu 24.04 only.
Create a VM
Create a VM by referencing your boot disk and specifying a resource profile:
evroc compute virtualmachine create myvm \
--zone=a \
--running=true \
--vm-virtual-resources-ref=a1a.s \
--disk=mybootdisk \
--boot-from=true \
--ssh-authorized-key="ssh-ed25519 AAAA..."
CLI parameters
--zone- (Required) Zone to create the VM in (e.g.,a)--running- Set totrueto start the VM immediately (default:true)--vm-virtual-resources-ref- (Required) Resource profile (can't be changed after creation)--disk- (Required) Reference to a disk (can be specified multiple times)--boot-from- (Required) Whether to boot from this disk (must be specified for each disk)--public-ip- (Optional) Reference to a Public IP--ssh-authorized-key- (Optional) SSH public key (can be specified multiple times)--security-group- (Optional) Security group to add the VM to (can be specified multiple times)--placement-group- (Optional) Placement group for the VM--cloud-init-user-data- (Optional) Cloud-init configuration (base64 or multi-line string)
Example with additional options
Create a VM with multiple disks, a Public IP, and custom security groups:
evroc compute virtualmachine create myvm \
--zone=a \
--running=true \
--vm-virtual-resources-ref=a1a.m \
--disk=mybootdisk \
--boot-from=true \
--disk=mydisk \
--boot-from=false \
--public-ip=mypublicip \
--ssh-authorized-key="ssh-ed25519 AAAA..." \
--security-group=web-sg \
--security-group=app-sg
Note: If you don't specify security groups, the VM will be added to the
default-allow-egresssecurity group, which blocks all inbound internet traffic. To enable SSH access from the internet, add thedefault-allow-sshsecurity group using--security-group=default-allow-ssh. See Security Groups for more information.
See Create a Virtual Machine in the API reference.
Verify the VM
Check that the VM was created and is running:
evroc compute virtualmachine list
Or:
evroc compute virtualmachine get myvm
The VM is ready when the Ready status is True and VirtualMachineStatus is Running.
See List Virtual Machines in the API reference.
Next steps
- Access the VM via SSH
- Attach additional disks
- Manage VM lifecycle (start, stop, update, delete)
- Use custom cloud-init for advanced configuration