Last updated: 06/26/2026
A virtual machine (VM) is a software-based computer that provides an isolated environment on host hardware. Virtual machines can run programs and operating systems, store data, connect to networks, and do other computing functions. Much of the technology we benefit from today, such as cloud computing and artificial intelligence, is rooted in the concept of the virtual machine, which allows operating systems and software to be separated from a physical machine. For instance, VMs in cloud computing are used to virtualize the resources of cloud service providers’ servers, enabling the multi-tenant cloud architecture that allows customers to share resources while being isolated from one another.
Virtual machines use virtualization technology to create virtual hardware—or a virtual version of a computer on a physical machine. The physical machine on which the VMs run is called the host machine, and the VMs running on the host are called guest machines.
A lightweight software layer called a hypervisor divides the host machine's physical hardware resources, such as CPUs, GPUs, TPUs, memory (RAM), storage, and networks. The hypervisor then allocates these resources to each guest VM. This allows you to run multiple "guest" operating systems concurrently and in isolation on a single "host" machine. For example, Google Compute Engine uses a KVM-based hypervisor to efficiently manage and allocate resources to the virtual machines you create.
Each guest VM runs on an isolated partition on the host, completely separated from other guests. You can host multiple VMs on a single host machine, often a server. The hypervisor enhances overall efficiency and flexibility by abstracting the physical resources of the host machine into a pool. These resources can then be provisioned and dynamically allocated to guest VMs based on their specific requirements.
Generally speaking, there are two types of virtual machines: process VMs and system VMs.
A process VM, also called an application virtual machine or managed runtime environment (MRE), creates a virtual environment of an OS while an app or single process is running and destroys it as soon as you exit. Process VMs enable creating a platform-independent environment that lets an app or process run the same way on any platform. A concrete example of this is the Node.js server on Cloud Run.Cloud Run provides a fully managed environment where your application runs within a container, abstracted from the underlying infrastructure.
A system VM (sometimes called hardware virtual machines) simulates a complete operating system, allowing multiple OS environments to live on the same machine. Typically, this is the type of VM people are referring to when they talk about “virtual machines.” System VMs can run their own OS and applications, and a hypervisor monitors and distributes the physical host machine’s resources between system VMs.
More recently, you may have also heard people discussing virtual machines in the cloud or a cloud VM. Cloud virtual machines are simply virtual machines that run on virtual servers in the cloud. Many cloud service providers let you create and run cloud virtual machines on their infrastructure, allowing you to use their powerful servers as host machines and leverage other software-defined services such as memory and network storage. These cloud VMs are commonly categorized by their resource optimization:
A virtual machine is a software emulation of a physical computer, whereas a virtual desktop is a user interface that allows access to a desktop environment hosted on a remote server. The key difference between them is that a virtual machine emulates an entire computer, whereas a virtual desktop provides remote access to a desktop environment.
Virtual machines are generally safe as they provide isolation between the host system and the virtual machine, which reduces the risk of malware spreading. However, their safety depends on proper configuration, regular updates, and appropriate security practices. If they are not managed correctly, virtual machines can still be vulnerable to attacks, making it essential to follow security best practices.
Yes, a virtual machine takes up storage space on the host system. The amount of storage used depends on the size of the virtual hard disk, the operating system, and any installed applications. Furthermore, virtual machines can be configured to dynamically allocate storage as needed or to use a fixed amount of storage.
While both VMs and containers are used to isolate applications, they do it in fundamentally different ways. A virtual machine virtualizes the entire physical hardware stack, including the operating system. This makes each VM a self-contained, isolated environment, but it also means that VMs tend to be larger and take up more resources.
By contrast, containers are more lightweight because they virtualize only the OS layer. Instead of bundling a full operating system with each application, a container shares the host's OS kernel. This makes containers to use fewer resources than VMs and start up faster while remaining isolated. This makes containers attractive for new application development. Since many of the applications developed over the last 10 years were written for containers, many workloads including e-commerce, back-office, and AI are “container native.
VMs are the basic building blocks of virtualized computing resources and play a primary role in creating any application, tool, or environment—both in the cloud or on-premises.
Here are a few of the more common ways businesses use virtual machines:
Multiple physical machines can be reconfigured as a VM and run on a host alongside other VMs, allowing organizations to reduce sprawl. VMs have been proven over time to be capable of running even the most performance sensitive applications.
A central IT organization can provision and manage VMs for each business unit and functional area, speeding access to resources while improving corporate visibility.
VMs can serve as isolated environments for testing and development that include full functionality but have no impact on the surrounding infrastructure.
VMs can easily be turned off or on, migrated, and adapted, providing maximum flexibility for development and deployment.
The flexibility and portability that VMs provide are key to increasing the velocity of migration initiatives.
Replicating systems in cloud environments using VMs can provide an extra layer of security and certainty. Cloud environments can also be continuously updated.
VMs provide the foundation for creating a cloud environment alongside an on-premises one, bringing flexibility without abandoning legacy systems.
VMs allow you to run different operating systems on a single physical machine. For example, you can run a Windows Server VM on Google Cloud's Compute Engine, even if your primary development environment uses Linux. Google Cloud provides a variety of OS images to support diverse needs.
Replicating systems in cloud environments using VMs can provide an extra layer of security and certainty. Cloud environments can also be continuously updated.
Virtual machines offer many benefits, particularly if you opt for a cloud VM, including the following:
Scalability
Cloud-based VMs make it easier to scale your applications, increasing availability and performance. You can increase your capacity according to demand without having to invest in your own physical servers.
Portability
A virtual machine is a single software package with hardware resources, an operating system, and all its applications. You can easily move VMs from one server to another, or even from on-premises hardware into cloud environments.
Reduced footprint and costs
VMs allow you to run multiple virtual environments from a single machine, helping reduce your physical infrastructure footprint, electricity bill, and maintenance and management costs.
Faster provisioning
VMs can be easily duplicated, enabling businesses to spin up new, identical environments without having to set them up from scratch.
Reliability
Virtual machines and their components exist virtually and remain isolated from other guest VMs. If VM crashes, the other guest VMs will remain operational, and the physical host machine won't be affected.
Better security
Virtual machines allow you to run multiple operating systems without impacting the host operating system. VMs let you create safe, virtual environments to test apps or even study security vulnerabilities without high risk to the host machine. Modern VM offerings, such as Google Cloud's Confidential VMs, provide encryption-in-use for data being processed in memory using a hardware-based Trusted Execution Environment (TEE).
There are, however, some considerations to keep in mind when running VMs. One of the biggest potential challenges of virtual machines is that running multiple operating systems and a hypervisor layer can come with a performance cost if the host machine isn’t robust enough. In addition, virtual hardware may not be as efficient as the physical hardware of a physical machine. Finally, most cloud providers offer virtual machines that are fixed in the CPU and memory they provide, leading to inefficient usage of resources.
Many of these concerns though can be overcome by choosing to use VMs offered by a cloud service provider. Cloud VMs provide many advantages over traditional VMs since they offer organizations access to the computing power of an entire data center’s worth of computers, rather than a single machine. In addition, Google Compute Engine virtual machines sizes offer custom machine types. Rather than selecting from predefined machine types that might include excess capacity, you can tailor the CPU-to-memory ratio specifically for your workloads, so you only pay for resources you actually use. This targeted approach minimizes waste and can significantly reduce your cloud spend, especially when migrating from on-premises to Google Cloud or from other cloud providers. Compute Engine also delivers virtual machine types optimized for specific customer needs for enterprise workloads, high memory configurations, or demanding workloads like machine learning or high performance computing.
Google Cloud also offers shielded virtual machines for extra security and verifiable integrity of your VM instances. Google Cloud shielded virtual machines leverage advanced platform security capabilities and controls that protect enterprise workloads from threats like remote attacks, privilege escalation, and malicious insiders.
For certain applications, developers may choose to bypass traditional VMs entirely. Modern deployment models like container orchestration (Google Kubernetes Engine - GKE) and serverless computing (Cloud Run) are powerful alternatives for specific use cases, allowing teams to bypass VM operating system management, improving deployment speed, and often achieving greater cost savings.
If you're ready to start using virtual machines, Google Cloud offers them through Compute Engine. Compute Engine provides flexible, self-managed VM instances hosted on Google's infrastructure. Here’s a high-level overview of how to create and connect to a VM on Compute Engine:
You need a Google Cloud project with billing enabled. New users can sign up for a free trial.
This API is required to create and manage VMs. You can enable it in the Google Cloud Console or using the gcloud CLI.
You can create VM instances using the Google Cloud Console or the gcloud CLI.
SSH (Linux VMs): Securely connect to your Linux instances using SSH.
Using the gcloud CLI: The gcloud compute ssh command provides a convenient way to connect from your local terminal
Using OS Login (Recommended): For enhanced security and streamlined SSH key management, especially across multiple VMs or teams, consider enabling OS Login. OS Login integrates SSH access control with Google Cloud IAM. With OS Login enabled, SSH keys are linked to your Google identity, and access is managed using IAM permissions rather than by distributing keys to instance metadata.
To enable OS Login, set the enable-oslogin metadata key to TRUE on your project or individual instances.

Solution
Solution
Start building on Google Cloud with $300 in free credits and 20+ always free products.