A virtual machine (VM) looks like a whole computer to the software inside it, but it is a slice of a real server. A program called a hypervisor runs on the physical host, divides its CPU cores and memory into slices and keeps each VM isolated from the others. You ask for one with an API call.
Illustrative numbers: a host with 32 vCPUs and 128 GB of memory can carry 8 VMs of 4 vCPUs and 16 GB each (8 x 4 = 32, 8 x 16 = 128). Providers sell different shapes, called instance types, in families: general purpose, compute-heavy, memory-heavy, and some with GPUs.
💡Good to know
A vCPU is a virtual CPU the hypervisor schedules onto real cores. Treat the sizes here as examples.