# Firecracker's microVM metadata service (MMDS): what it is and how to use it safely

> How Firecracker's MMDS works: a host-written JSON store the guest reads over HTTP, V1 versus V2 session tokens, routing, size limits, what not to put in it, and the host firewall rules the docs ask for.

How Firecracker's MMDS works: a host-written JSON store the guest reads over HTTP, V1 versus V2 session tokens, routing, size limits, what not to put in it, and the host firewall rules the docs ask for.

November 27, 2026 · 5 min read · The Sandscale team

Cloud VMs have a metadata endpoint at `169.254.169.254` that tells the instance about itself. Firecracker has its own version, the microVM Metadata Service (MMDS). It is a small, useful feature, and also one that people tend to use for things it is not suited to. This post goes through how it works, according to Firecracker’s [MMDS user guide](https://github.com/firecracker-microvm/firecracker/blob/main/docs/mmds/mmds-user-guide.md) and [MMDS design doc](https://github.com/firecracker-microvm/firecracker/blob/main/docs/mmds/mmds-design.md) as of November 2026, and where its edges are.

It describes Firecracker, not any specific platform’s configuration.

## What MMDS is

MMDS is a mutable JSON data store inside the Firecracker process. The host writes to it through the Firecracker API; the guest reads from it over HTTP, at an IPv4 address that defaults to `169.254.169.254` and can be changed.

The guest’s requests never leave the Firecracker process. Firecracker runs a minimal HTTP/TCP/IPv4 stack, called Dumbo in the design doc, inside the network device emulation. When a frame from the guest is addressed to the MMDS IP, Firecracker answers it itself instead of writing it to the host TAP device.

## Turning it on

By default MMDS is not reachable from the guest. It has to be configured before boot, and it is tied to a network interface:

1. Attach a network interface (`PUT /network-interfaces/{id}`).
2. Configure MMDS (`PUT /mmds/config`) with the list of interface IDs that may reach it, and optionally an `ipv4_address` and a `version`.

Enabling MMDS without a network interface is an error. Inside the guest, you add a route so packets for the MMDS IP go out the right interface, for example `ip route add 169.254.170.2 dev eth0`.

## Writing data

The host puts JSON into the store with `PUT /mmds`, which replaces the contents, or `PATCH /mmds`, which applies an RFC 7396 JSON Merge Patch. Either works before boot or while the VM runs. `GET /mmds` from the host reads it back.

The store is bounded. Its size limit comes from the `--mmds-size-limit` flag, and if that is not set, from `--http-api-max-payload-size`, which defaults to 51200 bytes. The design doc warns that raising it means storing and serving more data through the API’s HTTP processing. MMDS is for small facts about the VM, not for files.

## Reading data from the guest: V1 and V2

There are two access methods.

**V1** is a plain `GET` to the MMDS IP, with the path as a JSON Pointer into the store (for example `/latest/meta-data`). It is deprecated and will be removed in the next major version. For compatibility it answers `GET` requests even with an invalid or missing token; two metrics, `mmds.rx_invalid_token` and `mmds.rx_no_token`, count those so you can tell whether guests are ready for V2.

**V2** is session based, modelled on AWS’s IMDSv2:

1. The guest sends `PUT /latest/api/token` with an `X-metadata-token-ttl-seconds` header between 1 and 21600. The request must not carry `X-Forwarded-For`.
2. MMDS answers with a token in plain text.
3. Every `GET` until the token expires must carry it in `X-metadata-token`.

The AWS-style header names (`X-aws-ec2-metadata-token-ttl-seconds`, `X-aws-ec2-metadata-token`) are accepted too, so tools written for EC2 metadata often work unchanged.

The version is set in `/mmds/config` with `"version": "V2"`. If you leave it out, the default is V1, so set it explicitly.

## What MMDS is good for

- **Identity and configuration the guest needs at boot.** A sandbox id, a role name, which region it is in, a hostname.
- **Small values that change while running.** A flag the host flips with `PATCH`, such as “drain and exit”.
- **Bootstrap pointers.** Where to fetch a larger config, if the guest has a network that allows it.

## What it is not good for

**Secrets for untrusted code.** Anything in MMDS can be read by any process in the guest that can reach the MMDS IP over an allowed interface. V2’s token stops some request-forgery tricks, such as a server in the guest being tricked into fetching a URL, but it does not stop code running in the guest from asking for a token itself. If the code in the guest is the thing you do not trust, such as code an AI agent wrote, then a secret in MMDS is a secret you gave to that code. For agent workloads, credentials belong behind a broker that hands out short-lived, narrowly scoped values per run, or nowhere near the guest at all.

**Bulk data.** The store is small by design, see above.

**A filtering boundary.** The design doc says plainly that operators should not rely on the MMDS stack to filter packets addressed to the MMDS IP out of the guest’s traffic. Guest traffic is untrusted and should be filtered on the host.

## The host-side rules the docs ask for

Two notes from the MMDS design doc and the [production host setup guide](https://github.com/firecracker-microvm/firecracker/blob/main/docs/prod-host-setup.md) belong in any Firecracker deployment:

- **Block the real cloud metadata service.** If your Firecracker hosts run on a cloud VM, guest packets to `169.254.169.254` that Firecracker does not answer itself, for example on an interface without MMDS, go to the TAP device like any other traffic and can reach the host’s own metadata service, along with whatever credentials it hands out. The production guide gives an `nft` rule that drops packets from `tap*` interfaces to that address, and an `iptables-nft` equivalent.
- **Do not count on the TX rate limiter for MMDS.** Frames answered by MMDS never reach the TAP device, so they are not charged to the interface’s TX rate limiter. Bound the CPU Firecracker spends answering them with a cgroup CPU quota instead.

The first one is the important one. A metadata endpoint reachable from untrusted code is a well-known path to cloud credentials, and Firecracker’s docs are clear that it does not filter traffic for you.

## Where Sandscale fits

On Sandscale you do not configure MMDS. Each sandbox is its own Firecracker microVM; you give it metadata through `labels` and `metadata` when you create it, and you give it secrets through [Vault](https://sandscale.dev/security/vault): the SDK’s `vaultEnv` option hands named Vault values to the sandbox’s environment only, and the values never pass through the SDK, its answer or an audit entry. That still puts the value in the guest, so the advice above applies: give a run only the secrets that run needs. [Keeping secrets out of agent prompts](https://sandscale.dev/blog/secrets-out-of-agent-prompts-vault-dlp) covers the pattern.

**On this page**

1. What MMDS is
2. Turning it on
3. Writing data
4. Reading data from the guest: V1 and V2
5. What MMDS is good for
6. What it is not good for
7. The host-side rules the docs ask for
8. Where Sandscale fits

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [November 27, 2026 · **A LlamaIndex.TS data agent that runs its Python in a Sandscale sandbox** · Use LlamaIndex.TS's agent workflow with tools that write and run Python in a Firecracker sandbox, built per sandbox so a run can only reach its own box. Upload data files, answer with the numbers, clean up. Type-checked.](https://sandscale.dev/blog/llamaindex-ts-agent-with-sandscale)
- [November 27, 2026 · **Adding the Sandscale MCP server to Codex: config.toml, OAuth login and approval modes** · Configure the remote or local Sandscale MCP server in OpenAI Codex, sign in with codex mcp login, and use enabled_tools, approval modes and tool timeouts to match what each tool does.](https://sandscale.dev/blog/sandscale-mcp-server-in-codex)

---
Source: https://sandscale.dev/blog/firecracker-mmds-explained
