Skip to content
News

Cloud & infrastructure

Orchestrating AWS Lambda MicroVMs with Durable FunctionsSandboxes and Checkpoints Guide

A guide to AWS's Nov 25, 2026 Developer Preview for orchestrating Firecracker MicroVMs with Lambda Durable Functions, covering single jobs, stateful sessions, idle suspend, and IAM/timeout pitfalls.

#aws-lambda#microvm#durable-functions#sandbox#serverless

Orchestrating AWS Lambda MicroVMs with Durable Functions — Sandboxes and Checkpoints Guide

Q. How can I safely run AI-generated code in an isolated serverless sandbox for long-running workflows? With the new MicroVM extension for AWS Lambda Durable Functions (Developer Preview, announced November 25, 2026), a single Lambda durable function can launch, suspend, and terminate isolated Firecracker MicroVMs while handling checkpoints and retries automatically.

⚠️ Accuracy guardrail: This article is based on AWS's official announcement (November 25, 2026) and the AWS Durable Execution SDK repositories for TypeScript and Python as of November 27, 2026. Because the extension is currently in Developer Preview (experimental API), package interfaces may change before general availability. Check the official AWS Lambda pricing page for region-specific rates and SLA terms.

30-second summary

  • Announcement: AWS released a Developer Preview extension (js-extensions, python-extensions) for orchestrating Lambda MicroVMs directly from Lambda Durable Functions (November 25, 2026).
  • Two execution modes: Supports single isolated jobs (microvm) and stateful multi-step sessions (microvmSession) that share files and memory, without billing Lambda function compute while waiting on the MicroVM.
  • Resilience & scale: The SDK handles checkpoints, automatic retries, and token refreshes for workflows lasting up to one year, and supports parallel execution via map() as well as SQS and EventBridge triggers.
  • Key caveats: AWS advises against production use during preview, and session jobs require a function timeout of at least 71 seconds due to HTTP request retry windows.

AWS Lambda Durable Functions MicroVM official announcement

Why combine Durable Functions with Lambda MicroVMs

Executing untrusted user- or AI-generated code safely requires both VM-level containment and long-lived workflow state. Standard Lambda invocations are stateless and capped at 15 minutes, making them awkward for multi-step pipelines that clone repositories, run tests, and pause for human approval.

Conversely, Firecracker-powered Lambda MicroVMs offer near-instant launch and resume with up to 8 hours of preserved memory and disk state, but previously left developers to manage VM lifecycles, auth token refreshes, retries, and cleanup themselves. This extension brings MicroVM lifecycle orchestration directly into Durable Functions' one-year checkpointing engine.

Alongside recent serverless automation updates such as activating Cloudflare subscriptions via CLI and MCP, AWS's move signals a clear push to standardize isolated agent execution boundaries on serverless primitives.

Advertisement

Two modes: single-job microvm vs. stateful microvmSession

Choose between isolated one-off runs and shared-state sessions depending on whether steps need the same disk and memory. Both TypeScript (@aws/durable-execution-sdk-js-extensions) and Python (aws-durable-execution-sdk-python-extensions) expose the same primitives.

Feature microvm (Single job) microvmSession / microvm_session (Session)
Execution flow Launch MicroVM → run 1 job → wait → terminate Keep 1 MicroVM → run multiple vm.invoke() calls
Shared state None between jobs Shares files, processes, and memory (up to 8 hours)
Idle suspend Not supported (terminates on completion) Supports autoSuspendOnIdle and suspendAfter (snapshot storage billing only)
Best for Per-PR security scans, parallel per-commit builds Build → approval wait → test → deploy pipelines, agent sandboxes

AWS Lambda Durable Functions MicroVM architecture summary diagram

In Python, running a single isolated job looks like this. While the MicroVM executes, the durable function invocation ends, so no Lambda function compute is billed during the wait:

import os
from aws_durable_execution_sdk_python.config import Duration
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_execution
from aws_durable_execution_sdk_python_extensions.compute.microvm import MicrovmConfig, microvm

CONFIG = MicrovmConfig(
    image_identifier=os.environ["MICROVM_IMAGE_ARN"],
    execution_role_arn=os.environ["MICROVM_ROLE_ARN"],
    timeout=Duration.from_hours(1),
    heartbeat_timeout=Duration.from_minutes(5),
)

@durable_execution
def handler(event: dict, context: DurableContext) -> dict:
    return microvm(context, "build", job_input={"repo": event["repo"]}, config=CONFIG)

Idle suspension and deterministic error handling

For workflows with human approvals or long pauses, suspendAfter and heartbeat_timeout control both cost and reliability. Leaving a MicroVM active during a pause incurs compute charges, whereas setting suspendAfter: true or autoSuspendOnIdle: true preserves memory and disk state while billing only for snapshot storage.

  • Auto-resume requirement: The SDK never calls ResumeMicrovm itself; the service resumes on the next request only if idle_policy sets "autoResumeEnabled": True. Omitting it causes MicrovmDeliveryError after a suspend.
  • Typed error hierarchy: Every failure subclasses MicrovmError (MicrovmJobFailedError, MicrovmTimeoutError, MicrovmLaunchError, MicrovmDeliveryError, MicrovmNotRunningError), keeping error branching deterministic across replays.
  • Worker library: Inside the MicroVM image, an optional compute worker (aws-durable-execution-sdk-js-compute-worker or python-compute-worker) receives jobs, sends heartbeats, and reports results.

Developer workstation reviewing cloud workflow topology

Permissions and timeout pitfalls before you test

The official GitHub READMEs highlight several configuration traps that can cause silent failures or unexpected billing during setup.

  1. Set function timeout to at least 71 seconds: Every session job goes over HTTP and requires at least 11 seconds left plus a 60-second retry window. Lambda's default 3-second timeout causes every session job to fail.
  2. Invoke a published version or alias: Never invoke $LATEST, so workflow replays always execute against the exact same code version.
  3. Do not omit lambda:TerminateMicrovm: Without termination permission on the function's execution role, finished MicroVMs keep running and billing until their maximum duration.
  4. Callback permissions on the MicroVM role: The executionRoleArn needs SendDurableExecutionCallbackSuccess, Failure, and Heartbeat on the function ARN.

If you are pairing sandboxed code execution with managed document retrieval, combining this pattern with Google Agent Retrieval managed ingestion helps keep storage, retrieval, and untrusted execution cleanly separated.

Toris's take

For solo builders and teams experimenting with AI coding sandboxes or isolated CI/CD runners on AWS, this preview is well worth a PoC right now. Getting Firecracker VM isolation and durable checkpointing in a few dozen lines of TypeScript or Python removes the need to maintain custom cluster or sandbox orchestration.

Because the API is explicitly marked Developer Preview (Experimental), keep it in internal CI/CD experiments or agent prototypes rather than production workloads until AWS finalizes the SDK contract and SLA.

Frequently asked questions

Q. How does this bypass Lambda's 15-minute execution limit? Each durable function invocation still finishes within 15 minutes, but the SDK checkpoints progress and resumes on MicroVM callbacks or timers for up to one year. Individual MicroVM sessions retain memory and disk state for up to 8 hours.

Q. Am I billed for Lambda function compute while the MicroVM is running? No. According to the official SDK documentation, the durable function invocation ends while the MicroVM works, so no Lambda function compute is billed during the wait (MicroVM compute and snapshot storage rates apply separately).

Q. Can I use this in production today? No. Both AWS's announcement and the GitHub SDK repositories warn that the extension is in Developer Preview (experimental) and should not be used for production workloads.

Sources

Advertisement