VM
Virtual Machine
Virtual machine. Virtualization on top of a physical server. Heavier than containers.
Virtual Machine
Virtual machine. Virtualization on top of a physical server. Heavier than containers.
A VM (Virtual Machine) is a complete computer system created on top of physical hardware through a hypervisor. Each VM has its own operating system, kernel, and system libraries, and operates independently like a physical server.
Hypervisors are divided into Type 1 (Bare-metal: VMware ESXi, Microsoft Hyper-V, KVM) and Type 2 (Hosted: VirtualBox, VMware Workstation). In cloud environments, Type 1 is used, and it manages hardware resources directly.
VMs provide complete hardware isolation, ensuring strong security in multi-tenant environments. However, because each VM runs its own OS, the resource overhead is larger than that of containers (several GB vs. tens of MB), and boot time is also longer (several minutes vs. several seconds).
In cloud services, VMs are offered as EC2 (AWS), Compute Engine (GCP), Azure VM, and so on. They are suitable for cases that require legacy applications, licensing constraints, or complete OS control.
# Terraform: AWS EC2 인스턴스 생성
resource "aws_instance" "web_server" {
ami = "ami-0c55b159cbfafe1f0" # Amazon Linux 2
instance_type = "t3.medium"
vpc_security_group_ids = [aws_security_group.web.id]
subnet_id = aws_subnet.public.id
root_block_device {
volume_size = 50
volume_type = "gp3"
encrypted = true
}
user_data = <<-EOF
#!/bin/bash
yum update -y
yum install -y docker
systemctl start docker
systemctl enable docker
EOF
tags = {
Name = "web-server"
Environment = "production"
}
}
# Auto Scaling Group
resource "aws_autoscaling_group" "web" {
name = "web-asg"
vpc_zone_identifier = aws_subnet.private[*].id
target_group_arns = [aws_lb_target_group.web.arn]
min_size = 2
max_size = 10
desired_capacity = 3
launch_template {
id = aws_launch_template.web.id
version = "$Latest"
}
health_check_type = "ELB"
health_check_grace_period = 300
}
---
# GCP: gcloud CLI로 VM 생성
gcloud compute instances create my-vm \
--machine-type=e2-medium \
--zone=asia-northeast3-a \
--image-family=ubuntu-2204-lts \
--image-project=ubuntu-os-cloud \
--boot-disk-size=50GB \
--boot-disk-type=pd-ssd \
--tags=http-server,https-server
Infrastructure: "We'll keep the legacy applications on VMs, and new microservices will go with containers."
Development: "Doesn't using VMs and containers together make management complicated?"
Infrastructure: "Kubernetes nodes ultimately run on top of VMs too. We can containerize the legacy applications gradually."
Interviewer: "Please explain the difference between a VM and a container."
Candidate: "A VM runs its own independent OS on top of a hypervisor, providing complete isolation. A container shares the host OS kernel and provides process-level isolation. VMs suit multi-tenant environments where security is important, while containers suit microservices where fast deployment and efficiency are important."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
Reviewer: "You set the EC2 instance type to t3.micro, but that may not be enough for production."
Author: "For now, I'll upgrade to t3.medium and also enable unlimited mode for CPU credits."
Cause: During S3 operations, more servers than intended were removed by mistake, affecting the EC2 instance API
Impact: Thousands of services, including Slack, Trello, and Quora, were down for 4 hours, and the EC2 console was inaccessible
Resolution: Restarted the entire S3 subsystem and recovered sequentially
Lesson: Do not depend on a single AZ/region; a Multi-AZ or Multi-Region architecture is essential
Cause: "Delete on Termination" was enabled when the EC2 instance was terminated, so the EBS volume containing important data was deleted along with it
Impact: Permanent loss of three months' worth of uploaded user files
Resolution: Partially recovered from backups; the rest was accepted as lost
Lesson: Set termination protection for EBS volumes, automate regular snapshots, and keep a separate backup in S3
Q1. What is the key difference between a VM and a container?
Q2. What is a characteristic of a Type 1 hypervisor?
Q3. What should you be aware of when using Spot/Preemptible instances?
If this page has any errors or you would like to add something, please let us know!