Create a virtual machine
This guide shows you how to create a virtual machine using the evroc CLI.
Prerequisites
Section titled “Prerequisites”Before creating a VM, you need:
- A boot disk with an operating system image (or created from a snapshot)
- At least one SSH public key (for access to the VM)
- A subnet in the zone where you want to create 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
Section titled “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
Run evroc compute computeprofile list to see all available profiles and their specifications.
Note: GPU VMs support Ubuntu 24.04 or custom disk images.
Create a VM
Section titled “Create a VM”Create a VM by referencing your boot disk, specifying a resource profile, and choosing a subnet:
evroc compute virtualmachine create myvm \ --zone=a \ --subnet=default-se-sto-a \ --running=true \ --compute-profile-ref=a1a.s \ --disk=mybootdisk \ --boot-from=true \ --ssh-authorized-key="ssh-ed25519 AAAA..." \ --security-group=default-allow-ssh \ --security-group=default-allow-egress \ --security-group=default-allow-intra-vpcYou must specify a subnet when creating a VM. The subnet’s stack type is used if you don’t set a stack type on the VM.
CLI parameters
Section titled “CLI parameters”--zone- (Required) Zone to create the VM in (a,b, orc). These are the short forms of the full zone names (se-sto-a,se-sto-b,se-sto-c) - see Zone naming--subnet- (Required) Subnet to place the VM in. This subnet must be in the same zone as the VM.--stack-type- (Optional) IP stack type for the VM:dual-stackoripv6-only. Defaults to the subnet’s stack type--running- Set totrueto start the VM immediately (default:true)--compute-profile-ref- (Required) Compute profile (can be changed after creation if the VM is stopped)--disk- (Required) Reference to a disk (can be specified multiple times). These disks must be in the same zone.--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. This Placement group must in the same zone.--cloud-init-user-data- (Optional) Cloud-init configuration (base64 or multi-line string)
Example with additional options
Section titled “Example with additional options”Create a VM with multiple disks, a Public IP, a custom subnet and custom security groups:
evroc compute virtualmachine create myvm \ --zone=a \ --subnet=my-subnet \ --running=true \ --compute-profile-ref=a1a.m \ --disk=mybootdisk \ --boot-from=true \ --disk=mydisk \ --boot-from=false \ --public-ip=mypublicip \ --ssh-authorized-key="ssh-ed25519 AAAA..." \ --security-group=my-vpc-sg \ --security-group=my-egress-sgNote: If you don’t specify security groups, the VM’s firewall will drop all traffic. See Security Groups for information on how to configure the VM to handle network traffic.
See Create a Virtual Machine in the API reference.
Verify the VM
Section titled “Verify the VM”Check that the VM was created and is running:
evroc compute virtualmachine listOr:
evroc compute virtualmachine get myvmThe VM is ready when the Ready status is True and VirtualMachineStatus is Running.
See List Virtual Machines in the API reference.
Next steps
Section titled “Next steps”- Access the VM via SSH
- Attach additional disks
- Manage VM lifecycle (start, stop, update, delete)
- Restore a VM from a snapshot
- Use custom cloud-init for advanced configuration