Skip to content
Dashboard

What is a Firecracker VM and how does it work?

Content Engineer

Firecracker is an open-source virtual machine monitor (VMM) that uses Linux's Kernel-based Virtual Machine (KVM) to run virtual machines called microVMs. Each Firecracker VM boots its own guest kernel and sees only a minimal set of emulated devices. Amazon Web Services built Firecracker in Rust for AWS Lambda and AWS Fargate, and released it under Apache 2.0.

Developers often encounter Firecracker through serverless functions or AI sandboxes where a coding agent clones a repository and runs tests. These platforms must isolate workloads even if the code is malicious. Firecracker's design document treats guest vCPU threads as potentially hostile from the moment they start, regardless of who wrote or reviewed the code.

Copy link to headingHow does a Firecracker VM work?

With the KVM backend, each Firecracker process runs one microVM in host user space. It contains an API thread, a VMM thread, and one vCPU thread per guest CPU core. The vCPU threads use KVM to execute guest instructions, while the VMM thread handles the virtual devices.

Before starting the guest, you configure its kernel image, root filesystem, and resources through the Firecracker API. The default allocation is 1 vCPU with 128 MiB of RAM. An InstanceStart request then boots the configured guest.

Firecracker exposes a small set of virtual devices for networking, storage, communication between guest and host, and other essentials. These include virtio-net, virtio-block, virtio-vsock, a serial console, and an entropy device; the exact set depends on the architecture and configuration. Its minimal device model reduces the code and memory needed to support each microVM.

Firecracker combines virtualization with restrictions on its host process:

  1. KVM provides hardware virtualization to isolate the guest.

  2. Seccomp restricts the host system calls available to Firecracker. Default filters load on each thread before guest execution.

  3. The jailer configures resources such as cgroups and a chroot, drops privileges, and starts Firecracker as an unprivileged process. Production deployments need the jailer or equally restrictive process controls.

Firecracker also supports Nitro Sandboxes, which use the AWS Nitro System for isolation instead of KVM. The architecture, comparison table, and benchmarks in this article describe KVM-based microVMs.

Copy link to headingHow does a Firecracker microVM differ from a container or a traditional VM?

The difference starts with which kernel answers a program's system calls. In its explanation of how Firecracker works, AWS describes containers as giving code direct access to parts of the host kernel, and VMs as giving each workload its own guest kernel, isolated with hardware virtualization. Firecracker keeps the VM model with a smaller VMM. AWS said in 2020 that Firecracker's VMM had 50,000 lines of code, against more than 1.4 million in QEMU.

The table compares the three on the points that matter for running untrusted code.

Attribute

Ordinary container

Traditional VM

Firecracker microVM

Kernel serving the workload

Host's shared kernel

Own guest kernel

Own guest kernel

Main isolation mechanism

Kernel namespaces and cgroups

Hardware virtualization

Hardware virtualization through KVM, plus seccomp and the jailer around the VMM process

Virtual hardware

None of its own

Broad device model, as in QEMU, for many guest operating systems

Minimal device model for Linux and OSv guests

Designed for

Packaging and deploying applications

Desktop and cloud use cases

Multi-tenant container and function workloads

The categories blur in practice. Containers can run inside a microVM, where they share the guest's kernel and stay separated from the host's. Sandboxed runtimes such as gVisor put an application kernel between the container and the host. MicroVMs vs. containers covers when a hardened container is enough, and gVisor vs. microVMs compares the two stronger boundaries.

Copy link to headingHow fast does a Firecracker VM start?

Firecracker's specification lists these figures for a microVM with 1 vCPU and 128 MiB of RAM. Tests use M5D.metal with hyperthreading disabled and M6G.metal, with enough free host CPU and memory:

  • Boot time: Up to 125 ms from InstanceStart to the guest's /sbin/init. The test uses a minimal kernel and root filesystem with the serial console disabled.

  • VMM memory: Up to 5 MiB in this configuration, excluding the microVM metadata store. Many vsock connections can increase overhead.

Integration tests check both figures on each pull request. The boot measurement ends before your application is ready, so include application startup and any dependency installation when measuring your workload.

For density, AWS says thousands of microVMs fit on one server. The design document gives no fixed number and says the count is limited only by available hardware, since microVMs can oversubscribe host CPU and memory.

Copy link to headingWhat are Firecracker snapshots?

For KVM-based microVMs, Firecracker can save a paused guest and resume it in another Firecracker process. The snapshot stores guest memory and virtual hardware state. Disk images remain separate and must be managed alongside it. Nitro Sandboxes do not support snapshots.

During restoration, Firecracker maps the memory file and loads pages as needed. That file must remain available for the resumed microVM's lifetime. Full snapshots are supported; differential snapshots remain in developer preview. Restore time depends on the memory size, vCPU count, and number of emulated devices.

Safe restoration also requires these precautions:

  • Use the same hardware and software configuration that created the snapshot.

  • Expect packet loss and be prepared to reconnect network clients.

  • Avoid restoring the same snapshot repeatedly unless you regenerate state that must be unique, such as identifiers and cryptographic random state.

  • Authenticate and encrypt snapshot files that cross trust boundaries, because guest memory can contain secrets.

Copy link to headingWhat is Firecracker used for?

AWS built Firecracker for Lambda's combination of tenant isolation and rapid scaling. It started from Chromium OS's Rust VMM, crosvm, before the projects diverged. AWS announced Firecracker on November 26, 2018.

  • AWS Lambda and AWS Fargate. AWS said in 2018 that Lambda uses Firecracker for the sandboxes that run customer code, and that Fargate tasks had moved from dedicated EC2 VMs to Firecracker microVMs. In the NSDI 2020 paper, its AWS authors said the two services supported millions of production workloads and trillions of requests per month.

  • Fly.io. Application code runs in Firecracker microVMs.

  • E2B. E2B's security page says each E2B sandbox runs in its own Firecracker microVM with its own kernel, for untrusted and AI-generated code.

  • Container runtimes. The Firecracker README names Kata Containers and Flintlock as container runtimes that integrate Firecracker.

Copy link to headingWhy do AI sandboxes use Firecracker for coding agents?

An AI sandbox runs code that a model wrote or chose. Coding agents may also install dependencies with executable setup scripts and follow instructions embedded in repository files. Even if you trust the agent, its tools and permissions can expose it to code and instructions you have not reviewed.

Firecracker isolates a compromised guest from the host through virtualization. Seccomp and the jailer restrict the Firecracker host process as additional defenses, but they do not contain every exploit in KVM or the host kernel.

Operators can grant root access inside the guest without granting host root. With a suitable guest kernel and image, an agent can install system packages or run Docker for test databases while remaining inside the microVM's isolation boundary.

The small per-VM overhead makes a separate microVM practical for each task or user, including cloud agents. Jobs in the same microVM share a guest kernel even if file permissions keep their workspaces separate. Allocate separate microVMs when jobs need a virtualization boundary between them.

Copy link to headingWhat doesn't Firecracker do?

Firecracker performs no network traffic filtering. Its design document treats all guest egress as untrusted and says to filter it at the host level. An agent that reads a secret can send it to any reachable address unless you add egress rules on the host, or use a sandbox service whose network policy runs outside the microVM.

Firecracker's security depends on the Linux host configuration. Follow the project's production host recommendations, including the jailer or equally restrictive controls on the VMM process.

MicroVMs share a host's physical hardware. Mitigations reduce risks from side channels such as Spectre, but those risks remain.

During Vercel's 2026 Sandbox security challenge, a Linux networking flaw exposed host memory from production sandboxes. The researcher also demonstrated host code execution on their own KVM and Firecracker machines matching Vercel's configuration. The published findings distinguish those results and describe hardening measures, including patched kernels and jailed microVM processes.

Your application's permissions are outside the microVM's reach. Code inside it can use every credential and API you pass in, so scope credentials to the job and enforce authorization in the services that perform the action.

Firecracker v1.18.0 does not support GPU passthrough. Upstream VFIO passthrough work remains in progress.

Copy link to headingWhere does Vercel use Firecracker?

Vercel Sandbox fits when you want a Firecracker microVM for each coding agent or generated program, and don't want to operate KVM hosts, the jailer, and egress filtering yourself. Each sandbox runs in its own Firecracker microVM with a dedicated kernel. Processes inside can use sudo to run Docker, VPN clients, or FUSE filesystems, and the microVM boundary keeps them away from other sandboxes and the host.

Vercel also covers the network control that Firecracker leaves to the operator. The Sandbox firewall defaults to allow-all, deny-all blocks all outbound traffic including DNS, and user-defined policies allow only the destinations you name. Vercel enforces that policy on the host, outside the microVM, where code in the sandbox can't modify it.

Sandboxes boot Linux images. The default managed image, vercel/sandbox/universal, includes the current Node.js LTS, Python 3.14, and coding agents, and you can use a custom image from Vercel Container Registry. Sessions time out after 5 minutes by default, and the maximum session duration is 45 minutes on Hobby and 24 hours on Pro and Enterprise.

Since November 2023, Vercel's builds have run on Hive, a compute platform where each machine runs KVM with one Firecracker process for each microVM. Vercel Sandbox runs on the same platform.

Copy link to headingWho uses Vercel Sandbox?

Most Vercel Sandbox users run code they can't review before it executes, such as output from coding agents or code their own users deploy. Roo Code runs its AI coding agents in sandboxes and snapshots each environment, so later runs skip repository cloning, dependency installs, and service boot. Blackbox AI's Agents HQ sends tasks to several coding agents in parallel, each in its own sandbox.

Every Notion Worker runs on Vercel Sandbox. Workers are code that developers deploy to give Notion Custom Agents new abilities, such as syncing external data or calling an API. Eval harnesses use it too. Harbor, the harness behind Terminal-Bench, runs each trial in its own Firecracker microVM, and Scale AI's AgentEnv includes a Vercel provider from version 0.9.1334.

Copy link to headingCan you run Python in a Vercel Sandbox?

Yes. Python 3.14 comes with the default image, and the vercel/sandbox/python:3.14 managed image pins it with pip, venv, and uv. To create and control sandboxes from Python, install the vercel-sandbox package, the Python SDK, which requires Python 3.11 or newer. The KB guides show how to run untrusted Python code with files, processes, network policies, and snapshots, and how to add Python code execution to a TypeScript AI agent.

Copy link to headingHow do you get started with Vercel Sandbox?

Use the @vercel/sandbox SDK in your server code, or start OpenCode from your terminal with sandbox create opencode. The command requires Sandbox CLI 4.8.0 or later, Vercel sign-in, and separate OpenCode authentication.

For a specific use case:

Copy link to headingFrequently asked questions

Copy link to headingIs Firecracker the same as KVM?

No. KVM provides virtualization inside the Linux kernel. In a KVM-based deployment, Firecracker runs in host user space, configures the microVM through KVM, and supplies its virtual devices. Firecracker also supports a separate Nitro Sandbox mode on compatible AWS infrastructure.

Copy link to headingIs a Firecracker microVM a container?

No. Every Firecracker microVM boots a guest kernel of its own behind hardware virtualization, while an ordinary container uses the host's kernel. Containers can still run inside a Linux microVM, sharing that guest's kernel.

Copy link to headingCan you run Firecracker outside AWS?

Yes. KVM-based Firecracker microVMs run outside AWS on compatible x86_64 or aarch64 Linux hosts. They need hardware virtualization and read/write access to /dev/kvm. Follow the setup requirements and kernel support policy for your release.

Copy link to headingCan code escape a Firecracker microVM?

Yes. Vulnerabilities in Firecracker, KVM, or the host kernel can break isolation. The jailer and seccomp restrict the Firecracker process, but a host-kernel exploit can bypass those controls. Keep the host and guest kernels patched and apply the project's production hardening recommendations.

Copy link to headingDoes Firecracker filter a sandbox's network traffic?

No. Firecracker applies no filtering to traffic leaving a guest, and its design treats that traffic as untrusted. Operators add egress rules on the host, or use a managed sandbox such as Vercel Sandbox, whose firewall runs outside the microVM.

Copy link to headingCan I run agent evals in a Vercel Sandbox?

Yes. Harbor 0.22.0 and later can use Vercel Sandbox as its eval environment when you pass --env vercel to harbor run, which covers Terminal-Bench and other benchmarks in its registry, such as SWE-bench. AgentEnv 0.9.1334 and later, from Scale AI, places the agent and its task environment in separate sandboxes. Because each Harbor trial gets its own microVM, a run can go wider than one local machine allows.

Reference Architecture

Choose a stack and work through the decisions behind it, with curated documentation, guides, templates, and courses to help you build.

  • Agent stack: Build and operate agents with models, tools, and durable workflows.
  • Web applications: Choose rendering, data, authentication, and caching approaches.
  • Backends: Choose a runtime, connect services, and run background work.

Browse all stacks

Build with prompts

Build an app, extend an agent, or improve your project with ready-to-use prompts for your coding agent.

More Sandbox articles

Ready to deploy?