Skip to content

Firecracker — microVMs for serverless and multi-tenant isolation

Run Firecracker microVMs as a hypervisor-grade isolation layer for short-lived workloads, with millisecond boot times, KVM-backed security, and a JSON-over-Unix API.

Firecracker is a virtual machine monitor written in Rust that boots a Linux microVM in under 125 milliseconds, uses about 5 MiB of memory for the hypervisor itself, and ships exactly one device emulation backend (virtio for net/block/vsock) — nothing else. It is what AWS Lambda runs each function invocation in, and it is the right tool whenever you need hypervisor-grade isolation for workloads that traditional VMs are too heavy for and containers are too leaky for.

How to verify

A working Firecracker host responds to these probes:

firecracker --version
lsmod | grep kvm
ls -la /dev/kvm
file /var/lib/firecracker/kernel/vmlinux
curl --unix-socket /tmp/firecracker.sock http://localhost/

/dev/kvm must be present and readable by the user. The control plane is a JSON-over-HTTP API exposed on a Unix socket the VMM creates at startup.

What’s happening

A microVM is a VM with the surface area cut down to the absolute minimum. Firecracker omits everything not needed for cloud workloads: no PCI bus, no USB, no graphics, no legacy BIOS, no ACPI. It boots directly into a Linux kernel via the kernel boot protocol, with the guest kernel and rootfs read from local files. The only devices the guest sees are virtio-net, virtio-block, virtio-vsock, and a serial console.

This minimalism delivers two operational properties. First, the attack surface is tiny — VMM exploits like Venom or QEMU escape CVEs target device emulation code that simply does not exist in Firecracker. Second, the boot time is dominated by the guest kernel itself: with a stripped-down vmlinux and a small rootfs, full boot to userspace happens in 50-100 ms. That makes Firecracker viable as a per-request isolation boundary in a way QEMU is not.

The trade-off: you bring your own guest kernel, rootfs, and orchestrator. There is no live migration, no PCI passthrough, no GPU support, no high-availability story built in. AWS wraps Firecracker in their own orchestrator for Lambda; on-premises, you typically wrap it in Kata Containers or a custom Rust orchestrator on top of the API.

The mental model

Picture Firecracker as a Rust binary that talks to KVM:

your control script
   │ HTTP PUT /machine-config
   │ HTTP PUT /boot-source
   │ HTTP PUT /drives/rootfs
   │ HTTP PUT /network-interfaces/eth0
   │ HTTP PUT /actions  (InstanceStart)
   ▼
firecracker (~5 MiB, single process)
   ├── KVM ioctls → guest kernel running as a vCPU thread
   └── virtio backends (block, net, vsock) on the host side

The host kernel sees Firecracker as a process. The guest kernel sees an emulated machine with three devices. Nothing connects the two except the virtio queues and the KVM ioctl interface — both well-audited paths.

Operational notes

  • Kernel choice matters. A standard distro kernel is too big and boots too slowly. Build a stripped vmlinux with only the drivers you need (virtio_net, virtio_blk, virtio_vsock, ext4, tmpfs) and you will hit the under-125-ms boot target. The default Amazon Linux kernel ships pre-built for this.
  • Rootfs is just a file. Firecracker mounts a flat ext4 file as the guest’s root device. Build it with debootstrap, mkosi, or by copying an OCI image’s rootfs and adding init. Read-only base + tmpfs overlay is the classic pattern for ephemeral workloads.
  • Networking via TAP. Each microVM gets a host-side tap device. You bridge or route them as needed — Firecracker does not manage networking, only the device wiring. For per-request workloads, the orchestrator pre-allocates a pool of taps.
  • Snapshots and resumes. Firecracker can snapshot a running microVM to disk and resume it later, with restoration times in low milliseconds. This is the key primitive Lambda uses for “warm starts”: resume a paused VM rather than booting fresh.
  • vCPU oversubscription. Unlike traditional VMs, Firecracker microVMs are cheap enough that you can run hundreds per host. CPU oversubscription ratios of 5-10x are common; memory is the harder constraint.
  • Vsock for control. The guest-host control channel is virtio-vsock rather than virtio-net. Your agent inside the guest talks to a Unix socket on the host through the vsock — no network involvement at all.

Common pitfalls

  • Trying to boot a generic cloud-init Ubuntu image. The kernel command line and device naming Firecracker exposes are different from what a normal cloud image expects. Use the Firecracker-specific image format.
  • Running with --no-seccomp. The seccomp filter blocks the syscalls Firecracker should never make; disabling it gives the VMM the syscall surface it was designed not to have. Never disable in production.
  • Forgetting that the API socket has no auth. Anyone who can connect to /tmp/firecracker.sock controls the VM. Always restrict the socket’s permissions and run one VMM per dedicated process namespace.
  • Building rootfs files larger than they need to be — every microVM holds the rootfs in page cache, so a 500 MiB rootfs across 200 VMs is 100 GiB of RAM. Keep them under 50 MiB where possible.
  • Expecting standard container debugging tools to work. There is no docker exec equivalent — you reach into the guest via vsock or by mounting the rootfs file from the host while the VM is paused.

Stack Harbor uses Firecracker for client workloads that need hypervisor isolation per request — see clustered environments for how we run Firecracker behind Kata Containers as the runtime for multi-tenant CI workloads, sandboxed code execution, and per-tenant function isolation.