Lambda Durable Functions + MicroVMs: Hands-On with the Developer Preview
By Fabio Douek
Human-led, AI-assisted. Research and implementation done with AI tools, led, tested and edited by me. How posts are labeled
EventAWS re:Invent 2026: times, streams and recordings →Nov 30 to Dec 4, 2026
Jump to section
- Overview
- Architecture
- Setup
- Step 1: Roles, a bucket and a queue
- Step 2: The worker image
- Step 3: The durable function
- The Demo: A Repo Scanner That Cleans Up After Itself
- One job, one MicroVM
- Four repos at once
- Five repos, room for four
- A job ten times the function’s timeout
- From an SQS queue
- A session: build, wait, test
- When the job fails, or the worker dies
- When the function itself crashes
- The missing permission
- Results summary
- Pricing
- How It Compares
- Cleanup
- Verdict
- What works
- What doesn’t
- Who should use it
Explain (TLDR) like I am...
Imagine a babysitter who hands each messy craft project to a kid in a separate playroom, then takes a nap until the kid rings a bell. When the bell rings, the babysitter wakes up, collects the drawing and locks the playroom so nobody leaves the lights on.
The nice part is that the babysitter never forgets where they were, even after falling asleep in the middle. The tricky part: if you take away their key, the drawings still get collected, but the playroom lights stay on until the building switches them off by itself.
This is a developer preview that AWS says not to use in production. It lets one Lambda function start isolated virtual machines in your own account, hand them a job, and shut them down, with every step recorded in an execution history you can audit.
The diligence points are cost containment and permissions. A missing termination permission does not fail anything: machines keep running and billing until their maximum lifetime, and the only evidence is one log line. Grant the documented permissions in full and alarm on that line.
The condition is orchestration of untrusted code: someone has to start the sandbox, notice when it dies and clean it up. The intervention is a durable function that launches a MicroVM, waits without running, and terminates it. In my tests a job finished in about two seconds and a crashed worker was detected at its heartbeat timeout.
Side effects: a fan-out that fails fast leaves sandboxes running, a quota error is not retried by default, and a missing permission leaks machines silently. The evidence base is one day old and alpha versioned.
Notice the relief of not having to babysit a sandbox. You write one call, the function goes quiet while the job runs, and someone else remembers to turn the lights off. Even a crash halfway through picks up where it left off.
The worry moves to the edges. Nothing tells you when cleanup quietly failed, and a failed job is yours to retry. Teams will need a calm conversation about who owns the alarms and the quotas before trusting it with real work.
Think of the durable function as a conductor who cues a soloist in a soundproof booth, then sits silently until the soloist signals the last bar. The conductor never loses the place in the score, even after stepping out mid-piece.
The ensemble work is good: four booths can play at once, and one booth can hold a long rest without losing the melody. The catch is the house rules: one booth too many and the whole section stops, leaving the others playing to an empty hall.
The story is "one call to run untrusted code in a VM, and the cleanup is built in." A job is a single function call; the function pays for nothing while the sandbox works, a few seconds at most per job, and orchestration costs fractions of a cent per job.
The honest positioning: it is a developer preview, and the sharp edges (fail-fast fan-outs, quotas, a silent permission failure) are real. For teams already on Lambda it is the shortest path from "agent wrote some code" to "it ran somewhere safe."
Overview
On 2026-11-25 AWS announced a developer preview of an extension for orchestrating Lambda MicroVMs with Lambda durable functions. Lambda MicroVMs give you a Firecracker VM per job, restored from a snapshot, but nothing above the VM: no job queue, no retry, no cleanup. In my MicroVMs series I drove them with my own boto3 code. Lambda durable functions are the other half: a Lambda handler that checkpoints each step, can wait for up to a year without running, and replays from its checkpoints after a crash. The extension joins the two. One call, microvm(context, "scan", job_input=..., config=...), launches a MicroVM, hands it the job, ends the function’s invocation while the job runs, and terminates the MicroVM when the result comes back.
It isn’t a new service. It’s two alpha packages per language: an extensions package for the function (Python aws-durable-execution-sdk-python-extensions 0.1.0a1, npm @aws/durable-execution-sdk-js-extensions 0.1.0-alpha.0) and a worker library for the MicroVM image (aws-durable-execution-sdk-python-compute-worker 0.0.1a1). There’s no AWS documentation page for it yet; the reference is docs/microvm.md in the SDK repo, and it’s unusually candid about the sharp edges. AWS says not to use developer-preview features for production workloads.
I built a small repo scanner in Python and ran it through everything the extension claims: one job, a parallel fan-out, a 20-minute job from a function with a two-minute timeout, an SQS trigger, a session with a durable wait, failing and crashing jobs, a crashed function, and a role without lambda:TerminateMicrovm. Everything ran on 2026-11-26 in us-east-1, with the versions above, aws-durable-execution-sdk-python 3.1.0 and boto3 1.44.12, on an account whose MicroVM quota is 8 GB (four default MicroVMs). Every number below is from those runs.
Architecture
A microvm() call is four durable operations inside one child context, all visible in the execution history (docs/microvm.md describes each):
<name>.callbackcreates a durable callback. Its ID is checkpointed, so it’s the same on every replay.<name>.launchcallsRunMicrovmwith the SHA-256 of the callback ID as the client token. A retried or replayed launch gets the same MicroVM back instead of a second one.- Delivery. A job whose payload fits in 4,096 code points goes inside the
RunMicrovmrequest, to the image’srunlifecycle hook, and the operation gives the MicroVM theNO_INGRESSconnector (which, as my lifecycle post found, still lets a token holder in). Larger jobs, jobs with a route, and every session job go over HTTPS to the MicroVM’s endpoint (a<name>.requeststep, with an auth token the operation creates and refreshes). Then the invocation ends. <name>.terminate. The worker in the MicroVM completes the callback with the job’s result, using the MicroVM’s own execution role. Lambda invokes the function again, it replays operations 1 to 3 from their checkpoints, and callsTerminateMicrovm.
The worker inside the image is a small HTTP server (start_microvm_worker) that serves the lifecycle hooks and the job routes on port 8080, runs each job in a thread, and sends heartbeats while it runs. A session (microvm_session) is the same idea with one MicroVM for several jobs: jobs share its files and processes, and the function can suspend it between them.
Setup
AWS credentials, a Region with both durable functions and MicroVMs, Terraform and Python are all you need. The one prerequisite worth checking is your MicroVM quota: mine is 8 GB of memory, so four default (2 GB) MicroVMs at once, and that number shows up in the fan-out test below.
Step 1: Roles, a bucket and a queue
git clone https://github.com/fabiodouek/my2centsai-blog-samples.git
cd my2centsai-blog-samples/lambda-durable-microvms
uv venv && uv pip install -e . && source .venv/bin/activate
terraform -chdir=infra init && terraform -chdir=infra apply
infra/main.tf creates three kinds of role, and getting them right is most of the setup:
| Role | Needs |
|---|---|
| Image build | s3:GetObject on the zip, CloudWatch Logs |
| MicroVM execution | lambda:SendDurableExecutionCallback{Success,Failure,Heartbeat} on function:<name>:* |
| Function | AWSLambdaBasicDurableExecutionRolePolicy, plus lambda:RunMicrovm, TerminateMicrovm, CreateMicrovmAuthToken, GetMicrovm (and SuspendMicrovm for sessions) on the image, lambda:PassNetworkConnector on the managed connectors, iam:PassRole on the MicroVM role |
lambda:PassNetworkConnector and the ALL_INGRESS connector the extension uses for HTTP delivery aren’t in the MicroVM developer guide; I took them from the extension’s docs. There’s also a second function role without lambda:TerminateMicrovm, for the last test.
Step 2: The worker image
The image is a Python base with git and pytest, plus the worker library (image/). The job handlers are plain functions:
from aws_durable_execution_sdk_python_compute_worker.microvm import MicrovmJobContext, start_microvm_worker
def scan(job: dict, ctx: MicrovmJobContext) -> dict:
src, clone_s = _clone(job["repo"]) # git clone --depth 1
... # count files, lines, secret-like strings
return {"repo": job["repo"], "files": files, "lines": lines, "microvm_id": ctx.microvm_id, ...}
worker = start_microvm_worker(handler=default, routes={"/build": build, "/test": test})
worker.wait()
00_image.py builds it with all four lifecycle hooks enabled on port 8080 (run, suspend, resume, terminate), plus the ready image hook, which is required once any lifecycle hook is on. The build took 122 seconds.
Step 3: The durable function
01_deploy.py packages function/handler.py with the pinned packages and creates the function with DurableConfig, which can only be set when a function is created. Three details matter:
- Bundle a recent boto3. The extension needs the
lambda-microvmsclient, first in boto3 1.43.35. - A function timeout of at least 71 seconds once any job goes over HTTP: the request step keeps 10 seconds in reserve and retries for up to 60. Lambda’s default 3 seconds fails every session job. I used 120.
- Publish a version and invoke through an alias. An execution started on
$LATESTcan replay on newer code after a deploy, and the docs warn that can orphan a MicroVM.
Each demo is a few lines. Task mode looks like this:
def config(minutes=10, heartbeat_seconds=60, quota_retry=False) -> MicrovmConfig:
return MicrovmConfig(
image_identifier=IMAGE,
execution_role_arn=ROLE,
retry_strategy=quota_aware_retry if quota_retry else None,
timeout=Duration.from_seconds(int(minutes * 60)), # the MicroVM lives at most timeout + 5 min
heartbeat_timeout=Duration.from_seconds(heartbeat_seconds), # fail fast if the worker goes quiet
)
@durable_execution
def handler(event: dict, context: DurableContext) -> Any:
return microvm(context, "scan", job_input={"kind": "scan", "repo": event["repo"]}, config=config())
The Demo: A Repo Scanner That Cleans Up After Itself
The scenario is a small software factory: clone public repos into a sandbox, scan them, build and test one, the kind of job you’d hand to a MicroVM because the code isn’t yours. Each script starts executions asynchronously through the live alias, reads the execution history with GetDurableExecutionHistory, and checks the MicroVMs with GetMicrovm.
One job, one MicroVM
02_task.py scans pallets/click (179 files, 42,556 lines) in one MicroVM:
operations (start, duration, type, name):
0.10s 1.85s Context scan Succeeded
0.10s 1.67s Callback scan.callback Succeeded
0.24s 0.04s Step scan.launch Succeeded
1.91s 0.00s Step scan.terminate Succeeded
billed durable operations: 5
function invocations: 2, total 0.62s of 2.1s
at 0.04s ran 0.356s
at 1.80s ran 0.263s
MicroVM microvm-8178b1be-…: TERMINATED, lived 2.3s ($0.00008 at the 2 GB / 1 vCPU rate)
The whole execution took 2.1 seconds. RunMicrovm returned in 40 ms, the job (clone plus scan) took 0.27 seconds inside the VM, and the callback came back 1.67 seconds after it was created. The function ran twice, for 0.62 seconds in total: once to launch, once to terminate. Between the two, no invocation was running: the function wasn’t billed while the job ran. The MicroVM lived 2.3 seconds and was TERMINATED before the script looked.
Five billed operations is the metering table at work: the execution start, the child context, the callback, and the two steps. Completing a callback through the API costs nothing. The first run after a deploy or a quiet spell adds a cold start: the first invocation took 3.3 to 3.4 seconds, about 2.4 of them before the first operation ran. The scripts run a no-MicroVM ping execution first so the timings don’t include it.
Four repos at once
03_fanout.py scans four repos with context.map, one MicroVM per repo, then the same four in a loop:
result = ctx.map(repos, lambda item_ctx, repo, i, _all: scan_one(item_ctx, repo, f"scan-{i}"),
name="scan-all", config=MapConfig(max_concurrency=4))
| Wall time | Invocations | Lambda time | MicroVM time | Operations | |
|---|---|---|---|---|---|
map, 4 at a time | 2.6 s | 3 | 1.07 s | 11 s | 22 |
| loop, one by one | 7.8 s | 5 | 1.92 s | 10 s | 17 |
All four launches went out within 80 ms, and map finished three times faster for the same MicroVM seconds. Each serial job took about two seconds in total, of which the work was 0.3: the rest is the launch, the callback, a new invocation and the terminate. With jobs this short the gap is mostly that overhead; with ten-minute jobs it would approach four times. map adds a parent context and one child context per item, five more operations.
Five repos, room for four
Then I asked for five at once, one more than my 8 GB quota allows:
[06:25:29] fanout: SUCCEEDED in 0.5s, 1 invocations (0.46s of Lambda), 4 MicroVMs (4 still running), 22 operations
map completion: FAILURE_TOLERANCE_EXCEEDED, items: ['STARTED', 'STARTED', 'STARTED', 'FAILED', 'STARTED']
error: MicroVM "scan-3": the launch failed: An error occurred (ServiceQuotaExceededException) when calling the RunMicro
4 MicroVMs still RUNNING after the execution ended (max duration 900s)
Three things happened, and none of them is obvious from the API:
ServiceQuotaExceededExceptionisn’t retried. The default retry strategy fails the launch step at once on it, withMicrovmLaunchError.- The map stopped at the first failure. Its default completion fails fast, and the execution still succeeded:
mapreturns aBatchResultwith a completion reason instead of raising, and my handler returned it. My first version only returnedget_results(), and got an empty list and no error. - The four MicroVMs that did launch kept running. Their items were never resumed, so nothing terminated them. The docs list this case: they’d have run, and billed, until their maximum duration, the job timeout plus five minutes, 15 minutes here. The script terminated them itself.
I also saw max_concurrency=4 hit the same error once, in a run before the recorded one: the fifth item launched as soon as one of the first four finished, while that one’s MicroVM was still terminating and its memory still counted. What fixed it was a retry strategy for that one error plus a map that lets every item finish:
def quota_aware_retry(error: Exception, attempt: int) -> RetryDecision:
code = getattr(error, "response", {}).get("Error", {}).get("Code")
if code == "ServiceQuotaExceededException" and attempt < 24:
return RetryDecision.retry(Duration.from_seconds(5)) # memory frees up as MicroVMs terminate
return default_microvm_retry_strategy(error, attempt)
MapConfig(max_concurrency=5, completion_config=CompletionConfig.all_completed())
With both, all five scans succeeded in 7.3 seconds: one launch failed once, waited five seconds outside the invocation, and got through when the first MicroVMs had gone.
A job ten times the function’s timeout
04_long.py runs a job that sleeps for 20 minutes, with a two-minute heartbeat timeout. The function’s own timeout is 120 seconds. Lambda’s maximum is now 30 minutes, so a plain function could hold a 20-minute job, but it would be billed for all of it and capped there; a MicroVM job can run for up to 8 hours.
[07:27:02] execution SUCCEEDED after 20.1 min: {'ran_seconds': 1200.0, 'microvm_id': 'microvm-709d43aa-…'}
function: 2 invocations, 6.45s in total
MicroVM: 1205s running, $0.0422
Two invocations and 6.5 seconds of Lambda for a 20-minute job, and both invocations were cold starts, 3.5 and 2.9 seconds: the function had sat idle before the run, and again for the twenty minutes. A warm invocation in the other tests took about 0.3 seconds. During the 20 minutes the execution was RUNNING, the MicroVM was RUNNING, and the invocation count stayed at one: the worker’s heartbeats went to the callback, not to the function. This is the case the extension is for: the MicroVM is billed for its 20 minutes ($0.042), the function for a few seconds.
From an SQS queue
The announcement names SQS and EventBridge as triggers. 05_sqs.py connects a queue to the function, and the first attempt failed:
my2cents-ldm-pipeline (execution timeout 7200s): Execution timeout exceeds the maximum allowed timeout of 30 minutes for event source mappings
An event source mapping invokes the function synchronously and waits for the whole durable execution, and it refuses a durable function whose execution timeout is over 30 minutes. So the repo deploys a third copy of the function, my2cents-ldm-queue, with a 30-minute execution timeout. With that, a scan message started an execution 1.8 seconds after I sent it, and the execution took 2.2 seconds. Then I sent the 20-minute job through the queue:
[06:54:22] the mapping started execution e1749958-… (1.5s after the send)
[06:55:22] queues while it runs: {'queue': {'visible': 0, 'in_flight': 1}, 'dlq': {'visible': 0, 'in_flight': 0}}
[07:14:31] execution SUCCEEDED after 1204.5s, 2 invocations, MicroVMs: [('TERMINATED', 1205.0)]
queues after the long job: {'queue': {'visible': 0, 'in_flight': 0}, 'dlq': {'visible': 0, 'in_flight': 0}}
Several write-ups say a synchronous durable invocation is capped at 15 minutes. This one ran 1,205 seconds and succeeded, in two runs. The message stayed in flight while it ran (in an earlier run, CloudWatch’s one-minute ApproximateNumberOfMessagesNotVisible showed it in flight for all 20 minutes and NumberOfMessagesDeleted ticked at the end), and the mapping deleted it afterwards. The DLQ stayed empty. The ceiling I hit was the mapping’s 30 minutes, at configuration time, not 15 minutes at run time.
For jobs that may run longer, the pattern I’d use is the one AWS’s own posts use: a small function that reads the queue and starts the durable execution asynchronously. The catch is that SQS then can’t see a later failure.
A session: build, wait, test
06_session.py runs a two-job pipeline in one MicroVM: /build clones pallets/click and pip-installs it, a two-minute durable wait follows, then /test runs click’s test suite from what the build left behind.
def pipeline(vm: MicrovmSession, sctx: DurableContext) -> Any:
built = vm.invoke(sctx, "build", job_input={"repo": repo}, options=MicrovmInvokeOptions(
path="/build", timeout=Duration.from_minutes(10), heartbeat_timeout=Duration.from_seconds(60),
suspend_after=suspend)) # SuspendMicrovm when this job's result arrives
sctx.wait(Duration.from_seconds(wait_s), name="cool-down")
tested = vm.invoke(sctx, "test", job_input={"repo": repo}, options=MicrovmInvokeOptions(
path="/test", timeout=Duration.from_minutes(10), heartbeat_timeout=Duration.from_seconds(120)))
return {"microvm_id": vm.microvm_id, "build": built, "test": tested}
cfg = MicrovmSessionConfig(..., timeout=Duration.from_minutes(30),
idle_policy={"autoResumeEnabled": True, "maxIdleDurationSeconds": 7200, "suspendedDurationSeconds": 1800})
I ran it twice side by side, with and without suspend_after:
| Suspended | Running | Compute | Test job | |
|---|---|---|---|---|
suspend_after=True | ~113 s | ~20 s | $0.00070 | 2,627 passed, 1 failed, 8.2 s |
| no suspend | 0 s | ~132 s | $0.00461 | 2,627 passed, 1 failed, 7.2 s |
Both test jobs found the build’s files on disk and the commit hash the build job had put in the worker’s memory, with the same PID: one process, across a suspend. With the suspend, the MicroVM went to SUSPENDED as soon as the build result arrived and came back on the test job’s first request; that request step took 0.56 seconds instead of near zero. Without it, the MicroVM ran, and billed, through the whole wait, which is what Classmethod also saw in their TypeScript test. One test in click’s suite failed in every run, in both sessions; the job reports that as data, not as an error.
Suspend isn’t free: each suspend writes a snapshot and each resume reads one. By the rates in my lifecycle post, a suspend and resume of a 2 GB MicroVM costs about $0.011, roughly five minutes of running it, and snapshots are billed on the memory and disk they actually use. For a two-minute wait it’s a loss; for an hour’s wait for a human, it’s most of the bill saved. Setting it up also takes care: without autoResumeEnabled in the idle policy the next job fails, without the resume hook in the image the worker refuses jobs for up to 30 seconds, and the next job’s heartbeat timeout has to cover the resume.
When the job fails, or the worker dies
fail: execution SUCCEEDED in 1.8s
caught: MicrovmJobFailedError
message: MicroVM "tests": the job failed (RuntimeError): 3 of 412 tests failed in pallets/click
crash: execution SUCCEEDED in 32.0s
caught: MicrovmTimeoutError
message: MicroVM "crash": the job timed out: Callback timed out on heartbeat
microvm-6a5d96c1-… TERMINATED after 15.6s (Container Stopped with Exit Code: 1)
retry: execution SUCCEEDED in 3.8s
attempt 0: failed: MicroVM "flaky-0": the job failed (RuntimeError): flaky failure on attempt 0
attempt 1: ok on microvm-2d2be99c
- An exception in the job comes back as
MicrovmJobFailedErrorwith the type and message the worker reported, 1.35 seconds after the callback was created, and the MicroVM is terminated. - A worker that dies (the job calls
os._exit(1)after five seconds) never reports. The MicroVM noticed its main process exiting and stopped itself; the durable function found out at the 30-second heartbeat timeout, withMicrovmTimeoutError. Without a heartbeat timeout it would have waited for the full job timeout. - Retrying is your code. The announcement says the extension “retries failed tasks”; in the code that means the launch, request and terminate steps, on throttling, server errors, timeouts and connection failures. A job that fails is not run again. My retry loop creates a new
microvm()call per attempt, so each attempt is a fresh MicroVM and a new set of operations (nine for two attempts).
When the function itself crashes
08_replay.py makes the handler call os._exit(1) right after the scan has returned, once:
invocations:
at 0.04s ran 0.320s
at 1.56s ran 0.808s <- error (crashed)
at 3.42s ran 2.235s
invocation error: {"ErrorMessage": "RequestId: … Error: Runtime exited with error: exit status 1", "ErrorType": "Runtime.ExitError"}
launch steps recorded: 1; MicroVMs created by this run: 1
Lambda invoked the function again about a second after the crash (a cold start, hence 2.2 seconds), the handler replayed from the top, microvm() returned the checkpointed result, and the execution succeeded. One launch step, one MicroVM, one job run. That’s the durable functions model doing what it promises, and it’s the part that would take real work to build around raw boto3.
The missing permission
The last test runs the same scan from a function whose role lacks lambda:TerminateMicrovm, with a one-minute job timeout (09_leak.py):
[06:29:51] execution SUCCEEDED: scanned pallets/click, 179 files
[06:29:51] microvm-7c007931-…: RUNNING, maximumDurationInSeconds=360
function log, ERROR: MicroVM "scan": terminate failed for microvm-7c007931-….
[06:36:04] TERMINATED after 362s (MicroVM exceeded maximum lifetime.): $0.0127 of compute for a job that needed about 5 seconds
The job and the execution succeeded. The terminate step’s AccessDeniedException is caught and logged at ERROR, and that log line is the only sign. The MicroVM ran until the platform ended it at its maximum duration, which the operation sets to the job timeout plus five minutes. Here that’s six minutes and $0.013; with the one-hour timeout from the README’s example it would be 65 minutes, and with an 8-hour job, 8 hours per job. The docs recommend a CloudWatch Logs metric filter on terminate failed for; I’d add a periodic list-microvms check too, since the fail-fast map above leaks MicroVMs without logging anything.
Results summary
| Test | Result |
|---|---|
| One job | 2.1 s end to end; 2 invocations, 0.62 s of Lambda; MicroVM lived 2.3 s; 5 operations |
| Four in parallel | map 2.6 s vs a loop 7.8 s, same MicroVM seconds |
| One past the quota | ServiceQuotaExceededException, not retried; fail-fast map left 4 MicroVMs running; execution “succeeded” |
Quota-aware retry + all_completed() | 5 of 5 in 7.3 s, one launch retried after 5 s |
| 20-minute job | 2 invocations, 6.5 s of Lambda (both cold starts); MicroVM 1,205 s ($0.042) |
| SQS | mapping refuses execution timeouts over 30 min; a 20-minute job through SQS succeeded |
| Session with suspend | files, memory and PID kept; ~20 s running instead of ~132 s; resume added 0.56 s |
| Job raises | MicrovmJobFailedError, MicroVM terminated |
| Worker crashes | MicrovmTimeoutError at the 30 s heartbeat timeout |
| Function crashes | re-invoked, replayed, no second MicroVM |
No TerminateMicrovm | execution succeeds, MicroVM runs to its 6-minute maximum, one ERROR log line |
Pricing
There’s no separate price for the extension. You pay for durable functions and for MicroVMs (Lambda pricing, us-east-1, ARM):
| Item | Rate | My one-job run |
|---|---|---|
| Durable operations | $8.00 per million | 5 operations: $0.000040 |
| Lambda compute (durable functions) | $0.0000133334 per GB-second | 0.62 s × 0.25 GB: $0.0000021 |
| Requests | $0.20 per million | 2: $0.0000004 |
| Durable data written / retained | $0.25 per GB / $0.15 per GB-month | not measured; my payloads were small JSON |
| MicroVM vCPU / memory | $0.0000276944 per vCPU-second / $0.0000036667 per GB-second | 2.3 s at 1 vCPU, 2 GB: $0.000081 |
| MicroVM snapshot read, on every launch | $0.00155 per GB | 0.60 to 0.85 GB: $0.0009 to $0.0013 |
| MicroVM snapshot write (suspend) / storage | $0.0038 per GB / $0.08 per GB-month | none for a task; images stored with a one-week minimum |
The line that matters for short jobs is the snapshot read. The price list bills it “in GB of memory and disk used by snapshot”, and GetMicrovmImageBuild reports my image’s snapshot as 0.57 GB of memory and 0.03 GB of disk, plus 0.25 GB of installed code. Depending on whether the code layer counts, each launch reads 0.60 to 0.85 GB, $0.0009 to $0.0013, more than ten times the compute of a two-second job. I’ll know which once Cost Explorer catches up. Either way, for a two-second job the launch is most of the bill and the durable operations are about 3 to 4% of it.
For anything that runs for minutes, compute takes over. AWS’s own CI example on the pricing page, 10,000 ten-minute jobs a month, comes to $1,124.03 of MicroVM charges, $31.00 of it snapshot reads. At my measured five operations and about 0.6 seconds of 256 MB Lambda per job, the durable side of those 10,000 jobs is about $0.40 of operations and $0.02 of compute. The money is in the MicroVM, and in MicroVMs you forget to terminate.
The whole test, every run in this post plus the development runs before them, launched about 125 MicroVMs that ran for about 151 minutes in total: about $0.32 of compute, plus $0.12 to $0.16 of snapshot reads, under a cent of suspends and resumes, and the image’s storage. Cost Explorer lags by a day, so 10_cost.py prices the usage records instead.
How It Compares
| Durable function + MicroVMs | Step Functions + Fargate | Raw boto3 on MicroVMs | Temporal + a sandbox | |
|---|---|---|---|---|
| Status | Developer preview, alpha packages | GA | GA APIs, your code | GA |
| Isolation | Firecracker VM per job or session | Fargate task per job | MicroVM per job | Whatever your activity launches |
| Waiting | Callback; no function running | .sync or .waitForTaskToken | Your polling or callbacks | Activity heartbeats |
| Dead worker | Heartbeat timeout per job | HeartbeatSeconds | Yours | Activity heartbeat timeout |
| Keep memory across a long wait | Yes, and suspend the MicroVM meanwhile | Only by keeping the task running, and billed | Yes, by hand | Depends on the sandbox |
| Survives the orchestrator crashing | Yes, replay (tested) | Yes | Only what you build | Yes |
| Max duration | Execution 1 year; one MicroVM 8 hours | 1 year | 8 hours per MicroVM | No default limit |
| Orchestration cost, 10,000 jobs | about $0.40 of operations | about $0.90 of transitions | Lambda or a server for your driver | Temporal Actions, or a plan |
The comparison figures for Step Functions and Temporal come from my research notes on their pricing pages, not from runs. Step Functions can launch a MicroVM through its SDK integrations too, but you’d write the callback, heartbeat, session and cleanup logic yourself. Against my own boto3 driver from the lifecycle post, the extension replaces exactly the parts I’d rather not maintain: idempotent launches, token refresh, retries of the control-plane calls, dead-worker detection and crash recovery. What it doesn’t change is the MicroVM itself: same 8-hour cap, same quotas, same egress and identity defaults that the iron-proxy post dealt with.
Cleanup
python 11_cleanup.py # MicroVMs, the SQS mapping, the three functions, the image, log groups
terraform -chdir=infra destroy # roles, bucket, queues
11_cleanup.py terminates any MicroVM of the image that’s still running first, which after the fan-out and leak tests is the step that matters. The image’s snapshot storage bills for a one-week minimum even if you delete it sooner.
Verdict
The extension does what it says, and the parts that are hard to build yourself are the parts that worked best. One call ran a sandboxed job in about two seconds, the function ran for well under a second of it, a 20-minute job cost six and a half seconds of Lambda, all of it cold starts, a crashed function replayed without launching a second MicroVM, and a session kept a process alive across a suspended wait.
The sharp edges are all at the boundary between the durable model and the MicroVM’s lifetime: anything that stops the function from reaching the terminate step leaves a MicroVM running, and most of those cases don’t fail anything.
What works
- Crash recovery. I crashed the function after a job and got one MicroVM, one job, one result: the replay read the checkpointed result. The launch itself is idempotent too, by design (the client token is the callback ID’s hash), though my crash didn’t land mid-launch to prove it.
- Waiting is free on the function side. Two invocations per job: 0.6 seconds of Lambda for a two-second job, 6.5 seconds (two cold starts) for a twenty-minute one.
- Dead-worker detection. A 30-second heartbeat timeout turned a killed worker into
MicrovmTimeoutErrorabout 25 seconds after the kill. - Sessions. Files, memory and the process survived a durable wait, with or without a suspend, and a suspended wait used a sixth of the compute (the snapshot charges make that worth it only for waits of several minutes).
- Docs that tell the truth.
docs/microvm.mdlists every leak case I hit, before I hit it.
What doesn’t
- Fail-fast maps leak. One failed item ends the map, the other items’ MicroVMs run to their maximum duration, and the execution succeeds. Use
all_completed()whenever items launch MicroVMs. - Quota errors aren’t retried, and a terminating MicroVM still counts against the quota. Fan-out on a small quota needs a custom retry strategy.
- Failed jobs aren’t retried. “Retries failed tasks” means the control-plane steps; job retries are a loop you write.
- Short jobs pay mostly for the launch. That’s MicroVMs, not the extension, but it shows up here: every launch reads the image’s snapshot, more than ten times the compute of a two-second job. A session that runs many small jobs in one MicroVM pays it once.
- A missing permission fails silently. No
lambda:TerminateMicrovm, no error: one log line and a MicroVM billing to its maximum. - Preview everything. Alpha packages, no AWS docs page, and a package API that can change in any release, including the recorded operations that replay depends on.
Who should use it
Teams already building on Lambda who need to run code they don’t trust, in jobs of seconds to hours, and who’d otherwise write the launch, wait, retry and cleanup logic around MicroVMs themselves. Try it now on non-production work, with all three roles complete, all_completed() on every map, heartbeat timeouts on every job and an alarm on terminate failed for. If you need a visual workflow, cross-service integrations or a GA service today, Step Functions with Fargate is the safer choice; if you need an 8-hour-plus sandbox, neither MicroVM path will do it in one VM.
The my2cents.ai email
AI and cloud tools, tested for real. In your inbox once a week.
The week's hands-on tests and the launches that matter, in one email.