2 Virtual Machines
Learn how virtual machines are structured, provisioned, connected, and operated securely in local and cloud environments.
Virtual machines and their architecture
A is a software-defined computer that runs its own operating system on shared physical hardware. VMs are commonly used in data centers and cloud computing because they provide configurable compute resources and isolation between workloads.
A VM includes more than its running guest operating system: its configuration also describes its resources and attached devices. In cloud environments, a VM is often called an . Its chosen size determines available compute capacity, while its image, network interfaces, and disks are configured as related resources.
How the manages resources
A manages the physical processor, memory, and devices, presenting each VM with virtual versions of those resources. A runs directly on the hardware, whereas a runs as software within a host operating system.
In either arrangement, the guest operating system runs as though it had its own processor, memory, network adapters, and disks. The schedules access to real hardware and keeps VM resources separated. Virtual devices may be emulated or may use faster virtualization-aware drivers and communication paths.
Images as reusable starting points
A is a reusable starting point, usually containing an operating system and potentially preinstalled software or settings. For example, an Amazon Machine Image (AMI) specifies software needed to boot an EC2 and includes information about its attached block devices. One image can launch multiple VMs with a consistent baseline.
Treat images as maintained software artifacts: use trusted sources, update and test them, and avoid embedding personal credentials or unique secrets in a reusable image. Keep per-VM configuration in or configuration-management systems where it can be reviewed and reproduced.
a virtual machine
is the process of creating a VM and preparing it to run a workload. A typical workflow is:
Select an image and VM size appropriate to the operating system and workload.
Configure access, networking, and boot and data disks.
Create the VM from those settings.
Apply startup configuration, such as creating accounts, installing packages, setting keys, and mounting data disks.
Verify the VM, then monitor and maintain it.
Cloud-init or a platform-specific agent can apply settings during startup. Automated, version-controlled configuration makes deployments more repeatable and reduces manual setup.
Networking and access boundaries
A (often called a NIC or vNIC) connects a VM to a network. In a local environment, it connects through a virtual switch; in a cloud, it attaches to a virtual network and subnet. IP addressing, routes, and network rules determine which systems the VM can reach and which systems can reach it.
Expose only the ports and paths required by the workload. For example, a web server may accept public HTTPS traffic while management access is restricted to a private administrative network or managed access service. Firewalls or cloud security groups should enforce these boundaries.
Disk roles and data persistence
A VM typically has a containing its operating system and may have one or more data disks for application files or databases. A virtual disk can be backed by local host storage or remote storage. These choices affect performance and availability, as well as whether data remains available after a VM is stopped, deleted, or moved. Cloud platforms distinguish persistent managed disks from some forms of temporary local storage.
Plan disk capacity and performance for the workload. Format and mount data disks as part of , and make backups independently of the . A snapshot or reusable image can help with recovery or replication, but should not be assumed to replace a tested backup and restore plan.
Operating virtual machines reliably
Good VM operations combine appropriate resource sizing, repeatable configuration, secure access, monitoring, failure planning, and lifecycle management.
Right-size resources: Start with a reasonable CPU, memory, and disk allocation; adjust based on observed workload needs.
Automate and document: Version VM configuration and startup tasks so replacement VMs can be created consistently.
Secure access: Use least-privilege accounts and keys, restrict management networks, and apply guest operating-system security updates.
Monitor health and capacity: Track availability, CPU, memory, disk space, and I/O; investigate sustained resource pressure.
Plan for failure: Back up important data, test restoration, and use redundancy or availability features where the workload requires them.
Manage lifecycle and cost: Remove unused VMs and disks, maintain approved images, and review resource use regularly.
For example, a small web application might use one with a standard operating system and web server, a private virtual NIC with narrowly defined inbound rules, and a persistent . Automated installs the application and mounts the disk; monitoring and backups support ongoing operation.