VM States and State Transitions
What you'll learn: How virtual machines move through different operational states and what transitions are possible between them.
Understanding VM Lifecycle States
Think of a VM's lifecycle like a car ignition: it doesn't just jump from "off" to "driving" instantly. Virtual machines progress through distinct states, each representing what the VM is currently doing.
The Five Primary VM States
Pending — Your VM is being created and initialized. Resources are being allocated, the operating system image is loading, and networking is being configured. You can't connect yet.
Running — The VM is fully operational and actively executing workloads. You can SSH or RDP into it, applications are processing requests, and you're being charged for compute time.
Stopping — The VM is shutting down gracefully. The operating system is saving state, closing connections, and unmounting volumes. This is a transition state.
Stopped — The VM is shut down but preserved. Think of it like sleep mode on your laptop—your configuration and storage remain intact, but no compute resources are consuming power. You pay only for storage.
Terminated — The VM is permanently deleted. All associated resources (except explicitly preserved volumes) are released. This is irreversible.
Valid State Transitions
Not all state changes are possible. You can't jump from stopped directly to terminated without going through specific commands. Here's the flow:
- Pending → Running (automatic after launch)
- Running → Stopping → Stopped (manual shutdown)
- Stopped → Pending → Running (restart)
- Running or Stopped → Terminated (deletion)
You cannot restart a terminated VM—it's gone forever.
Key Takeaway: VMs follow a defined lifecycle with five states (pending, running, stopping, stopped, terminated), and understanding valid transitions helps you manage resources efficiently and avoid unexpected data loss or charges.