AWS Lambda: orchestrating MicroVMs with Durable Functions
AWS previews MicroVM orchestration in Lambda durable functions. Run untrusted or agent code in VM-isolated sandboxes within year-long serverless flows.
AWS released a developer preview extension to orchestrate MicroVMs with Lambda durable functions. The combo lets you run isolated tasks or open sessions where multiple tasks share files and memory, with checkpointing, retries, and lifecycle management for up to one year. It targets user- or agent-generated code in VM-isolated sandboxes, triggered by SQS or EventBridge, without babysitting a whole cluster.
What happened
The extension adds durable operations to launch work on MicroVMs and manage their lifecycle. You can run single tasks or start a session and send multiple tasks that share state. The durable function coordinates everything: it checkpoints progress, retries failures, and refreshes MicroVM tokens when needed.
One handy detail: there is an optional worker library that runs inside the MicroVM image to receive tasks, send heartbeats, and report results. You can orchestrate multiple MicroVMs in parallel from a single durable function. MicroVMs provide VM-level isolation, near-instant launch/resume, and state preservation across steps.
Availability: developer preview in the Durable Execution SDK for TypeScript and Python. Not for production. It’s in all Regions where Lambda durable functions and Lambda MicroVMs are available.
Why it matters
This brings stronger isolation into a durable serverless flow. Translation: less custom glue for sandboxes and less infra wrangling to execute untrusted or AI-generated code. If you’ve been eyeing MicroVMs for agents, it’s a natural move. We’ve seen similar ideas elsewhere, like AI agents on isolated microVMs.
It also aligns with pushing serverless toward longer workloads. I covered when Lambda doubled its timeout to 30 minutes. Here we’re talking about orchestrations living up to a year, with tasks and sessions preserving state across steps.
Architecture and trade-offs
- Security: VM-level isolation for third-party, user, or agent code. Great for security scanners, software factories, and CI/CD jobs you want sandboxed.
- Cost: simpler than bringing up full VMs or managing clusters. Watch orchestration costs, session overhead, and state storage. Tag and measure from day one.
- Operational simplicity: built-in checkpointing, retries, and token handling. Less bespoke orchestration code, more focus on business logic.
Versus containers, the win is VM isolation plus durable-function-managed lifecycle. The potential loss is observability when crossing the function ↔ microVM boundary.
Monitoring and lifecycle: what to watch
- Worker heartbeats inside the MicroVM: latency and drops.
- Retries per task and session; separate environmental from functional failures.
- MicroVM token refreshes and expirations.
- Session duration, shared memory/files, and cleanup on close.
- Image versioning, result traceability, and immutable logs for audit.
If you lean on stateful sessions, set hard limits: session TTL, max artifact size, and garbage-collection policies. For untrusted code, harden images and avoid unpredictable dynamic deps.
What I would do
- Run a tight PoC with three cases: user/agent code sandbox, a security scanner, and a CI job that needs privileged tooling.
- Control policies: max time per task and session, retry budgets, circuit breakers, and consistent aborts.
- Minimum viable observability: heartbeat metrics, retries, artifact sizes, and per-task/session cost.
- Security: hardened images, secrets outside the image, and validate outputs before leaving the MicroVM.
If you’re pushing AI on Lambda, this also rhymes with the broader compute push, like when Lambda added GPU inference. The line between serverless and “having VMs” keeps blurring—great for capability, new headaches for platform governance.
My take: it’s worth experimenting. You’ll likely cut platform complexity and raise the isolation bar. But reevaluate monitoring, lifecycle, and costs as if this were a brand-new product in your platform. PS: yes, we now have VMs inside serverless; the tech circle of life.