AWS Lambda MicroVMs

Firecracker-based serverless sandboxes (GA June 2026) with suspend/resume up to 8h. Control plane via @aws-sdk/client-lambda-microvms; you bake a small runner into the image.

Installation

@aws-sdk/client-lambda-microvms is an optional peer dependency, used for the control plane (launch / suspend / resume / terminate). The data plane (exec, files) is plain fetch to the microVM's endpoint.

pnpm add sbox-sdk @aws-sdk/client-lambda-microvms

How it works

AWS Lambda MicroVMs give you isolation, lifecycle, and a dedicated HTTPS endpoint — but the in-VM exec/filesystem protocol is defined by your image. So this adapter speaks a tiny "runner" protocol over the endpoint, and you bake a reference runner into your MicroVM image once.

  1. Build a MicroVM image from a Dockerfile + the reference runner, upload to S3, and call CreateMicrovmImage → note the image ARN.
  2. The adapter calls RunMicrovm (launch from that ARN), CreateMicrovmAuthToken (JWE), then Suspend/Resume/Terminate.
  3. Each op is an HTTPS request to the microVM endpoint with X-aws-proxy-auth + X-aws-proxy-port headers, routed to the runner's POST /sbox/exec, /sbox/fs/read, /sbox/fs/write.

The reference runner (a dependency-free Node server) ships in the package at sbox-sdk/src/aws-lambda/runner/server.mjs, Dockerfile, and a README with the exact build & create-microvm-image commands. The runner runs inside the isolated MicroVM; executing arbitrary commands is its purpose.

Usage

import { createSandboxClient } from "sbox-sdk";
import { awsLambda } from "sbox-sdk/aws-lambda";

const client = createSandboxClient({
  provider: awsLambda({
    imageIdentifier:
      "arn:aws:lambda:us-east-1:123456789012:microvm-image:sbox-runner",
    region: process.env.AWS_REGION!,
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    },
  }),
});

const sandbox = await client.create();
const res = await sandbox.commands.run("echo hello");
await sandbox.files.write("/tmp/data.txt", "hi");

await sandbox.pause(); // SuspendMicrovm — memory + disk preserved (up to 8h)
await sandbox.resume(); // ResumeMicrovm
await sandbox.destroy(); // TerminateMicrovm

credentials and region resolve through the standard AWS SDK chain (environment variables, shared config, or an instance/task role) when those options are omitted.

template overrides the image ARN per create(); otherwise the imageIdentifier option is used.

Authentication

Standard AWS credentials + a MicroVM image ARN.

Authentication variables for the aws-lambda adapter.
OptionEnv varRequiredDescription
imageIdentifierrequiredARN of the MicroVM image (or pass `template` per `create()`).
regionAWS_REGIONrequiredAWS region the MicroVMs run in.
credentials.accessKeyIdAWS_ACCESS_KEY_IDrequiredAWS access key id.
credentials.secretAccessKeyAWS_SECRET_ACCESS_KEYrequiredAWS secret access key.
credentials.sessionTokenAWS_SESSION_TOKENoptionalSession token for temporary credentials.

Credentials and region resolve through the standard AWS SDK chain (environment variables, shared config, or an instance/task role) when the `credentials` / `region` options are omitted.

Options

Prop

Type

Capabilities

CapabilityLevelNotes
list / regionnative
pausenativeSuspend preserves memory + disk
stopunsupportedonly run / suspend / terminate
streamingemulatedrunner returns buffered output
filesUploadnativevia the runner
exposePortnativeendpoint + X-aws-proxy-port + JWE
codeInterpreterunsupported
snapshot / forkunsupportedthe image is the build-time snapshot

preservesMemoryOnPause is true; previewModel is tunnel.

On this page