The pitch is clean: a durable function that survives for a year, orchestrating disposable VMs that boot in milliseconds, for running code you do not trust. Both halves are real. The thing to work out before building on it is that they do not share a clock, and the shorter one is eight hours.
“The maximum total lifespan of the MicroVM, including both running and suspended time. Lambda terminates the MicroVM when this duration is exceeded.”
Executive summary
The announcement is “AWS Lambda now supports orchestrating MicroVMs with Lambda durable functions”, in developer preview for TypeScript and Python, with event source triggering from Amazon SQS or Amazon EventBridge and an optional worker library that runs inside the MicroVM image to receive tasks, send heartbeats and report results.
The durable half is documented as “With AWS Lambda durable functions, you can build resilient multi-step applications and AI workflows that can execute for up to one year while maintaining reliable progress despite interruptions”, and the economics of long waits are the reason to use it: “During wait operations, your function suspends without incurring compute charges.”
The MicroVM half is capped. maximumDurationInSeconds accepts a range of 1 to 28,800
seconds, which is eight hours, and the word that matters in its definition is
total — the ceiling counts suspended time too.
What changed
| Piece | What it now does |
|---|---|
| Durable functions extension | Durable operations for running work on MicroVMs and managing their lifecycle |
| Parallelism | One durable function can orchestrate multiple MicroVMs in parallel |
| Worker library | Optional, runs inside the image: task reception, heartbeats, result reporting |
| Triggers | Amazon SQS or Amazon EventBridge as event sources |
| Languages | TypeScript and Python, in developer preview |
The language list is worth noting against the base SDK, which the documentation says is available for JavaScript, TypeScript, Python, Java, Go, Rust and C#. The MicroVM extension is two of those seven, and it is a preview.
Architecture
One year against eight hours
| Layer | Maximum | Counts idle time? |
|---|---|---|
| Durable execution | Up to one year | No — waits suspend without compute charges |
| MicroVM total lifespan | 28,800 s (8 hours) | Yes — running and suspended time both count |
| MicroVM idle before suspend | 28,800 s maximum | — |
| Suspended before termination | Configurable | — |
The ratio is about 1,095 to one. That is not a criticism of either limit; it is the fact that decides the shape of anything built on this pairing. A durable function that models a MicroVM as a worker it can hand tasks to over the life of the execution is correct for the first eight hours and wrong afterwards, and the transition is not gradual: “MicroVM has been terminated. This is a terminal state. The MicroVM cannot be resumed or restarted.”
Suspending does not buy time
This is the part most likely to be assumed away. Suspension is presented, correctly, as a cost control: a suspended MicroVM preserves memory and disk state and stops accruing compute charges. The natural inference is that a mostly-idle sandbox can be kept around cheaply for a long job.
It cannot, because the ceiling counts both states. Eight hours of wall clock is eight hours whether the MicroVM spent it serving requests or parked. Suspension changes the bill, not the deadline.
There is a second, independent timer: a configured number of “seconds a MicroVM remains in the suspended state before Lambda terminates it”. So a long-running orchestration has two ways to lose a sandbox it was not actively using, and both end in the same terminal state.
The retry that is not there
The announcement lists automatic retries among durable functions' built-in features, and within a step that is exactly right. At the level of the execution it inverts:
“Unlike asynchronous invocations of functions without durable execution, Lambda does not automatically retry durable executions on failure.”
An ordinary asynchronous Lambda invocation is retried by the service. A durable one is not. The documented consequence is that a dead-letter queue stops being a nicety: without one, the event that triggered a permanently failed execution is gone. Lambda sends the original triggering event to the DLQ when an execution reaches FAILED, STOPPED or TIMED_OUT after an asynchronous invocation, and that is the only copy.
This is a reasonable design — blind retries of a workflow that has already consumed eight hours of MicroVM time would be worse — but it is the opposite of the Lambda behaviour most people have internalised.
Replay is the programming model, and a deploy can break it
Durable functions work by re-running your code: “During replay, your code runs from the beginning but skips over completed checkpoints, using stored results instead of re-executing completed operations.”
That imposes a constraint on deployments rather than only on code: “If you rename a step or alter its behavior while executions are in progress, those executions can fail to resume or produce incorrect results.”
Combine that with the one-year ceiling and the exposure is clear. In-flight means anything started up to a year ago, so a refactor that renames a step is not a change to future behaviour — it is a change to executions already running. The documented mitigation is to invoke with version numbers or aliases so executions pin to the code they started on, and to ensure new versions can handle state from older ones.
What the sandbox actually isolates
The isolation story is strong where it counts. Each MicroVM “runs an Amazon Linux 2023 operating system with operating system capabilities, providing near-instant launch and resume”, and the endpoint is closed by default: “All requests to a MicroVM endpoint require a JWE authentication token. There is no unauthenticated access option.”
The gap is not in the runtime boundary. It is in the snapshot the sandboxes are stamped from:
“If your application generates unique content during the build (such as unique IDs, secrets, or network connections), that content is shared across all MicroVMs run from the same image version.”
For a web service that is a curiosity. For the use case this launch names — untrusted or agent-generated code in isolated sandboxes — it is the thing to check first, because every tenant's sandbox inherits whatever the build produced. A credential fetched during image build is one credential across every sandbox, and the per-tenant isolation the architecture promises does not extend to it.
The documented remedy is to generate unique content after start, through the /run hook,
and to pass per-sandbox configuration at run time rather than at image time:
“Unlike environment variables (which are set at image level and shared across all MicroVMs
from that image), the run hook payload is unique to each MicroVM.” It is
“A string payload (max 16 KB) delivered to the /run lifecycle hook when the MicroVM
starts”, which is enough for identifiers and Secrets Manager paths and not enough for the
secrets themselves.
Routing is by port, not by path
One more thing that matters specifically because the workload is untrusted: “Lambda routes inbound requests based on their port and does not filter them by URL path.”
Lifecycle hooks live on a known path under /aws/lambda-microvms/runtime/v1/. If a token
permits the port the hooks listen on, the holder of that token can call them — suspend, resume,
terminate, or re-run the initialisation hook. The guidance is explicit:
“For production workloads, host lifecycle hooks on a dedicated port separate from your
application port.” Tokens should then exclude the hook port from their allowed ports.
Two failure modes to handle in the orchestrator
Both are stated plainly and both will happen under load. On start: “If your /run hook fails or times out, the MicroVM may transition directly to TERMINATING without ever reaching RUNNING.” On resume: “If resume does not succeed, Lambda returns 502 Bad Gateway to the caller.”
A durable function orchestrating MicroVMs has to treat both as ordinary branches rather than as
exceptions, because a step that assumes run-microvm produces a reachable endpoint will
checkpoint a success it did not get.
Business value
The combination is genuinely new. Before it, running untrusted code in a strong sandbox meant either containers with a weaker boundary, or EC2 with a startup time and a lifecycle you managed yourself. MicroVMs give VM-level isolation with snapshot restore; durable functions give an orchestrator that survives its own interruptions. Together they cover the case where a job is long, parallel, and must not share a kernel with its neighbours.
The named use cases are coherent with that: software factories, security scanners, and CI/CD for untrusted or agent-generated code. All three are fan-out workloads where the per-job environment is disposable and the orchestration is the hard part. A single durable function orchestrating MicroVMs in parallel replaces a queue, a worker pool and the state machine you would otherwise write.
The vertical scaling model also fits the shape: provision each MicroVM for baseline usage, “with the flexibility to vertically scale to 4x of configured baseline during peak activity”, paying the baseline rate while running and only for active use above it.
Security considerations
Three things to settle before this carries untrusted code.
First, the build-time snapshot. Audit the image build for anything unique it produces, because that
uniqueness becomes a shared constant across every sandbox from that image version. Move it to the
/run hook.
Second, the hook port. Routing by port rather than path means a token that covers the hook port is a lifecycle control-plane token. Separate ports, and scope tokens to the application port only.
Third, the token model itself, which is the strong part. There is no unauthenticated option, tokens are scoped to specific ports and carry a configurable expiry, and egress is a connector you choose rather than a default. For a sandbox, the defaults point the right way.
Worth stating plainly: nothing here is a statement about whether the Firecracker boundary holds. It is the same virtualization underneath Lambda functions. The findings above are about configuration that travels into every sandbox, which is where a per-tenant isolation story is most likely to leak.
Cost considerations
No pricing is in the announcement, and the documentation points at the Lambda pricing page rather than quoting rates, so there is no figure here worth repeating. The cost model is documented: running MicroVMs incur compute charges, suspended MicroVMs incur snapshot storage charges but not compute charges, and terminated MicroVMs incur no charges.
The durable half has its own shape: waits suspend without compute charges, so a workflow that spends most of a year waiting is cheap to hold open. The asymmetry from the architecture section reappears as a cost asymmetry — the orchestrator is cheap to keep alive for a year, and the sandbox is not available to keep for more than eight hours at any price.
The lever that actually matters is the idle policy. Suspending idle MicroVMs moves them off compute
charges onto snapshot storage, and suspendedDurationSeconds terminates them rather than
leaving them billing for storage indefinitely.
Operational considerations
Capacity is an account-level memory quota across all MicroVMs in RUNNING or
SUSPENDED state in a Region, adjustable through Service Quotas. The error to expect is
ServiceQuotaExceededException from run-microvm, and the documented responses
are to terminate idle MicroVMs or raise the quota. Suspended MicroVMs still count, which is the
non-obvious part: an aggressive idle policy reduces cost without freeing capacity, and only
termination does both.
For the durable side, the monitoring guidance is concrete: structured logging with execution IDs and
step names, CloudWatch alarms on error rates and execution duration, EventBridge rules on FAILED,
STOPPED and TIMED_OUT status changes, and an alarm on the DLQ's
ApproximateNumberOfMessagesVisible.
And it is a developer preview, in two languages, with GitHub repositories for samples and feedback. That is the right status for something whose programming model has a replay constraint and whose two halves have clocks three orders of magnitude apart.
Tradeoffs
| Design choice | What you get | What it costs |
|---|---|---|
| Counting suspended time against the lifespan | A hard bound on how long any sandbox can exist | Suspension cannot be used to stretch a long job |
| TERMINATED as a terminal state | No ambiguity about whether state survived | The orchestrator must rebuild, not reconnect |
| No automatic retry of durable executions | No blind replay of expensive workflows | A DLQ is mandatory or the triggering event is lost |
| Replay as the durability mechanism | Ordinary sequential code, no DSL | Renaming a step can break executions up to a year old |
| Snapshot-based near-instant launch | Sandboxes that start fast enough to be per-request | Build-time uniqueness is shared across every sandbox |
| Routing by port, not path | Arbitrary protocols: HTTP/2, gRPC, WebSockets, SSE | Lifecycle hooks need their own port and token scope |
Implementation guidance
Decide first whether any single unit of work can exceed eight hours. If it can, the MicroVM is not the unit of work — it is a lease. Model the durable function as acquiring, using and releasing sandboxes, with the expiry as a first-class state rather than an error, and checkpoint enough about the work in progress that a fresh MicroVM can pick it up.
Attach a dead-letter queue before the first asynchronous invocation, not after the first loss. Pin invocations to a version or alias so a deploy cannot change the code a running execution replays through. Keep step names stable, and treat renaming one as a migration.
On the image, move anything per-tenant out of the build. Identifiers and Secrets Manager paths go through the run hook payload; the secrets themselves get fetched after start. Put lifecycle hooks on their own port from the beginning, because moving them later means reissuing every token.
Then handle the two failure branches explicitly: a MicroVM that never reaches RUNNING
because the run hook failed, and a 502 from a resume that did not succeed.
Best practices
- Treat eight hours as the sandbox's hard ceiling, including any time it spends suspended.
- Attach a DLQ to every durable function invoked asynchronously; Lambda will not retry the execution.
- Invoke by version or alias, and never rename a step while executions are in flight.
- Generate per-sandbox values in the
/runhook, never during the image build. - Host lifecycle hooks on a dedicated port and exclude it from application tokens.
- Terminate rather than only suspend when you need capacity back — suspended MicroVMs still count against the quota.
- Handle a MicroVM that never reaches
RUNNING, and a 502 on resume, as normal branches.
Who should adopt this and when
Now, in a preview capacity, if you are already running untrusted or model-generated code and your current isolation is a container. That is the case this is built for, and the sandbox boundary is a genuine upgrade.
Now, also, if you have a fan-out workload of independent jobs that each need a real operating system — package installs, filesystem mounts, arbitrary ports — and each job finishes inside a shift.
Not yet, if your orchestration is in Java, Go, Rust or C#; the extension is TypeScript and Python. Not yet either if your unit of work regularly exceeds eight hours, unless you are prepared to build the lease-and-resume machinery, because that is the part this does not give you.
Key takeaways
- Durable functions run up to a year; a MicroVM's total lifespan caps at 28,800 seconds, and that ceiling counts suspended time as well as running time.
- Suspension is a cost control, not a time extension, and a separate suspended-duration timer can terminate an idle sandbox before the eight hours are up.
TERMINATEDis terminal — the MicroVM cannot be resumed or restarted, so the orchestrator rebuilds rather than reconnects.- Lambda does not automatically retry a durable execution, unlike an ordinary asynchronous invocation. A DLQ is the only thing holding the triggering event.
- Replay means a renamed step can break executions that started as long as a year ago. Pin to a version or alias.
- Anything unique generated during the image build is shared by every MicroVM from that image version — the one property a per-tenant sandbox cannot inherit by accident.
- Inbound routing is by port and not by path, so lifecycle hooks belong on their own port with tokens scoped away from it.
Official AWS references
- AWS Lambda now supports orchestrating MicroVMs with Lambda durable functions — the announcement, the developer preview status and language support, the named use cases, the optional worker library and the SQS and EventBridge event sources
- Running and using MicroVMs — the
maximumDurationInSecondsrange and that it covers running and suspended time, the idle policy fields and the 28,800-second idle maximum, the suspended-duration termination timer, the 16 KB run hook payload and that it is unique per MicroVM where environment variables are not, the JWE token requirement with no unauthenticated option, port-based routing and the dedicated-port guidance for lifecycle hooks, and the 502 on a failed resume - AWS Lambda MicroVMs core concepts — Amazon Linux 2023 and the per-tenant environment, the Firecracker snapshot build process, the warning that build-time unique content is shared across all MicroVMs from an image version, the full lifecycle states and transitions, that
TERMINATEDis terminal, and that a failed run hook can skipRUNNINGentirely - Lambda durable functions — the one-year execution ceiling, the checkpoint and replay mechanism and that replay re-runs code from the beginning while skipping completed checkpoints, that waits suspend without compute charges, and the SDK language list
- Best practices for Lambda durable functions — that Lambda does not automatically retry durable executions unlike ordinary asynchronous invocations, the DLQ requirement and the terminal states that trigger it, the version and alias pinning guidance, and the warning that renaming or altering a step breaks in-progress executions
- AWS Lambda MicroVMs — the isolation and networking capabilities, the account-level memory quota and the 4x vertical scaling model, and the cost model for running, suspended and terminated MicroVMs
- AWS Durable Execution SDK Developer Guide — further reading on the SDK programming reference and language-specific guides; no claims in this post are drawn from it
Comments