Firecracker

On this page 7

Firecracker is an open-source virtual machine monitor that uses the Linux Kernel-based Virtual Machine (KVM) to create and run microVMs, which are minimal virtual machines that start in a fraction of a second and consume very little memory. In virtualization, it occupies the space between traditional hypervisor-managed virtual machines and containers, combining hardware-level isolation with container-like speed and density.

Amazon Web Services developed Firecracker in the Rust programming language and released it in 2018 under the Apache 2.0 license. It was designed for multi-tenant serverless computing, where thousands of short-lived functions from different customers must share one physical host without being able to reach each other, a core requirement across the Cloud subject.

How Firecracker creates and runs microVMs

Firecracker runs as one user-space process per microVM on a Linux host. The process opens the KVM device, allocates guest memory, configures virtual CPUs and then lets the processor execute guest code directly through hardware-assisted virtualization extensions such as Intel VT-x, AMD-V or the Arm virtualization extensions.

The key design choice is a deliberately minimal device model. Instead of emulating a full PC with a BIOS, PCI bus, USB controllers and graphics, Firecracker exposes only a handful of devices. Fewer emulated devices mean less code exposed to the guest, a smaller attack surface and a much shorter boot path.

The table below lists the devices a Firecracker microVM provides and the purpose of each.

DevicePurposeNotes
virtio-netNetwork interfaceBacked by a host TAP device
virtio-blockDisk storageBacked by a file on the host
virtio-vsockHost-guest communicationSocket channel without networking
Serial consoleBoot logs and debuggingOften disabled in production
Keyboard controllerGuest-initiated resetMinimal legacy device
Balloon deviceMemory reclamationReturns unused guest memory
Devices exposed to a Firecracker guest

The guest boots a Linux kernel directly, without firmware, so the time from API call to running init process is typically around 125 milliseconds in a tuned configuration. Each microVM adds less than 5 MiB of memory overhead for the monitor itself, which allows thousands of microVMs on a single large host.

Security model and the jailer

Firecracker relies on defense in depth: KVM provides the primary isolation boundary, and several Linux mechanisms contain the monitor process in case a guest escapes into it. Its implementation in Rust removes whole classes of memory-safety bugs common in older C-based emulators.

A companion program called the jailer prepares each Firecracker process before it starts. It places the process in its own namespaces, applies cgroup resource limits, changes the root directory and drops privileges. Firecracker then loads seccomp filters that permit only the small set of system calls it actually needs.

LayerMechanismWhat it protects against
Hardware virtualizationKVM with CPU extensionsGuest access to host memory
Minimal device modelFew virtio devicesBugs in emulated hardware
Seccomp filtersSystem call allowlistAbuse of the host kernel
Namespaces and chrootJailer setupAccess to other processes and files
CgroupsCPU, memory and I/O limitsNoisy neighbors and exhaustion
Isolation layers around a Firecracker microVM

This layered approach is why Firecracker is trusted for running untrusted customer code side by side. A container alone shares the host kernel directly, so a single kernel vulnerability can break isolation; a microVM adds a separate guest kernel in front of the host.

Firecracker compared with containers and traditional virtual machines

Firecracker sits between containers and full virtual machines on the spectrum of isolation and overhead. The comparison below shows typical characteristics; exact figures depend on kernel configuration, guest image size and host hardware.

PropertyContainerFirecracker microVMTraditional virtual machine
Isolation boundaryShared host kernelSeparate guest kernel on KVMSeparate guest kernel on hypervisor
Startup timeMillisecondsAbout 100 to 200 msSeconds to minutes
Memory overheadVery lowA few MiB plus guestTens to hundreds of MiB
Device supportHost devices via kernelMinimal virtio setBroad, including passthrough
Guest operating systemsSame kernel as hostLinux, and OSv unikernelsWindows, Linux and others
MicroVMs compared with containers and full virtual machines

Compared with general-purpose platforms such as QEMU, VMware ESXi or Hyper-V, Firecracker intentionally gives up features. It offers no graphical console, no live migration between hosts, no broad PCI passthrough and no support for Windows guests. These omissions are the price of its speed and small attack surface.

Where Firecracker is used

Firecracker was built to run AWS Lambda functions and AWS Fargate tasks, where each customer workload receives its own microVM. Outside AWS, it is used by sandboxing platforms, code execution services and container runtimes that need stronger isolation than namespaces alone.

The project integrates with container tooling through several paths. Kata Containers can use Firecracker as one of its virtual machine backends, and the firecracker-containerd project lets containerd launch container images inside microVMs, preserving familiar container workflows.

The following table maps common situations to whether Firecracker is a suitable choice.

SituationSuitabilityReason
Multi-tenant serverless functionsStrong fitFast start, high density, strong isolation
Running untrusted user codeStrong fitSeparate kernel per workload
Ephemeral CI build environmentsGood fitClean environment per job
GPU-heavy machine learningPoor fitNo general device passthrough
Long-lived enterprise serversPoor fitNo live migration or rich tooling
When Firecracker fits and when it does not

Snapshots, limitations and operational trade-offs

Firecracker supports microVM snapshots, which save guest memory and device state to files so a microVM can be restored in milliseconds instead of booting again. Platforms use this to pre-warm runtimes, for example loading a language interpreter once and restoring copies on demand.

Snapshots introduce a subtle risk: restored clones share identical state, including random number generator seeds and cryptographic material. Operators must reseed entropy and regenerate unique identifiers after restore, or several microVMs may produce the same supposedly random values.

  • Host requirement: Firecracker needs a Linux host with KVM access, which usually means bare metal or a cloud instance that allows nested virtualization.
  • Management is external: it ships no scheduler, image registry or orchestration layer, so operators build these or adopt a higher-level runtime.
  • Control interface: each microVM is configured through a REST API over a Unix socket, which suits automation but not manual administration.
  • CPU overcommit needs care: dense packing works well for bursty workloads but degrades latency when many microVMs are busy at once.

A plain-language summary

Firecracker is software that creates very small, very fast virtual computers inside one real server. Each of these mini computers has its own walls, so a program running in one cannot see or disturb the programs in the others.

Think of an apartment building where each tenant gets a fully lockable studio instead of sharing one open room. The studios are tiny and contain only the essentials, which is why new ones can be ready almost instantly. That combination of strong walls and speed is exactly what cloud services need when they run code from many different customers at the same time.

An example from practice

An online programming education platform lets students run code in the browser. Running each submission in a plain container worried the security team, because one kernel exploit could expose other students’ work.

The engineering team moved execution into Firecracker microVMs on bare-metal Linux hosts. Each submission receives a microVM with one vCPU, 256 MiB of memory and no outbound network access. To keep response times short, the team boots a microVM once with the language runtimes loaded, takes a snapshot and restores fresh copies from that snapshot for every new run, reseeding randomness after each restore.

A single 64-core host now handles several hundred concurrent sessions, each submission starts in well under a second, and every microVM is destroyed after use, so no state leaks between students.