Virtual Machines (EC2, Compute Engine, Azure VMs)
Part of the Cloud Computing Roadmap
In short
A virtual machine is the most basic thing you can rent: a whole computer, minus the box. Almost every other compute service is built on top of it, so this is where you start.
The foundational cloud compute primitive — a virtual server you configure and manage yourself, giving you the most control (and the most operational responsibility) of any compute option.

Think of it like this
Rooms in a PG building
One big building, many rooms. Each room has its own lock, bed and light switch, and you can't wander into your neighbour's. The building is a physical server. Each room is a VM, and you're king of your room.
Watch it happen
One physical host, many VMs
1/4A real machine in a data centre with lots of CPU cores and RAM.
The big ideas
What you need to know
A full computer
You pick the OS image, CPU, RAM and disk. You get root or admin access and install anything.
Images are templates
An image (AMI on AWS) is a snapshot of a disk with an OS. Every VM boots from one.
You maintain it
OS patches, security updates, monitoring agents and backups of the VM are your job.
Pay while it runs
A stopped VM stops compute charges, but its attached disks still cost money until deleted.
See it in code
Walk through the code
1aws ec2 run-instances \2 --image-id resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64 \3 --instance-type t3.micro \4 --key-name my-key \5 --security-group-ids sg-0123456789abcdef0 \6 --tag-specifications 'ResourceType=instance,Tags=[{Key=env,Value=dev}]'7 8aws ec2 terminate-instances --instance-ids i-0abc123def45678901/4Pick the image. The resolve:ssm trick fetches the current AMI ID for you.
The SSM path always resolves to the latest Amazon Linux 2023 image, so you don't copy AMI IDs that change by region.
Save yourself the pain
Common mistakes
Oops
Stopping a VM and assuming the bill is now zero.
Do this instead
Stopped VMs still pay for attached disks and any reserved public IPs. Terminate what you don't need.
Oops
Treating a VM like a pet you fix by hand forever.
Do this instead
Script its setup (user data, Ansible, an image) so you can rebuild a fresh one in minutes.
Your mission
Launch, log in, tear down
Quick check
You stop an EC2 instance for the weekend. What do you still pay for?
Go deeper
- 1Launch a free-tier virtual machine and connect to it via SSH.
- 2Learn the basic lifecycle: launch, stop, start, terminate, and what each does to billing.
- 3Compare the VM launch process across at least 2 cloud providers to see the conceptual overlap.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.