Remote KiroCrew running on a Lambda

Remote KiroCrew running on a Lambda

I ran an OpenCode HTTP server on a Lambda Web Function (Python 3.15 preview), used it as a KiroCrew harness, put the KiroCrew gateway on a Lambda MicroVM, and connected from a laptop over SSM with no open port. Setup, free-model privacy table, cost and what broke.

Coding agents burn through a plan quickly. When mine ran out mid-week, I wanted a cheap place to run other agents, away from the laptop. Lambda now has two compute types that fit: Lambda Web Functions, which run an HTTP server behind an endpoint, and MicroVMs, which run a full Linux VM with per-second billing. I used both.
This post covers what runs where, how the laptop connects without an open port, what the free models do with your data, what it costs, how to tear it down, and what broke.
Measure
Result
OpenCode ready after a cold start
4.3 s
Warm turn on a free model
1–2 s
Lambda MicroVM cost at 2 GB
$0.126/hour
Model cost on the free tier
$0

What runs where

  1. A Lambda Web Function runs  opencode serve , the OpenCode HTTP server, on a free model. It keeps each conversation in S3.
  1. KiroCrew uses it as its harness. KiroCrew can drive another agent through the Agent Client Protocol (ACP). Its Agent Harness setting selects OpenCode, and an environment variable points it at a different OpenCode binary. An ACP-to-HTTP adapter speaks ACP on stdin and stdout, then forwards each prompt to the Lambda Web Function.
  1. A Lambda MicroVM runs the KiroCrew gateway. The loopback relay signs requests with the VM's IAM role.
  1. Your laptop connects to that gateway through Settings, Remote Crew, over AWS Systems Manager (SSM).


Remote KiroCrew architecture

The setup leaves the KiroCrew release unchanged. The CDK app, adapter, launcher and tests are in the  GitHub repository .

Why a Lambda Web Function for OpenCode

 opencode serve  is a long-lived HTTP server, which is what a Lambda Web Function runs. These limits shaped the design:
Limit
Value
Containers
None. The docs and the API show zip packages only
Package size, unzipped
512 MB
 /tmp 
512 MB, about 320 MB free once OpenCode has started
CPU and memory
2 vCPU, 2 GB
Request time
3 to 900 seconds, default 30
Time to start listening
10 seconds
Architecture
arm64 only
Sources:  quotas  and  runtimes .
OpenCode is one binary of about 200 MB, so the whole package is 231 MB unzipped and fits. Python runs on the  python3.15  Lambda Web Function runtime, which is in public preview. A thin Python app starts the binary and relays requests to it.
Strands stays on the MicroVM. I also installed the Strands harness there and connected it to NVIDIA NIM. That gave me two real harness paths to test: OpenCode through the Lambda Web Function and Strands through the MicroVM. The Lambda Web Function runtime could not install the pinned Strands dependency because its wheel stops at Python 3.14, while Lambda Web Functions offer only Python 3.15.

Free models and privacy

OpenCode's free models come with different data terms. This is what the  OpenCode docs  said on 2026-11-23:
Model
Retention and use
deepseek-v4.1-flash-free, hy4-flash-free
Zero retention, no training
big-pickle, tidepool-alpha-free, iceman-free
Used to improve the model
flint-40b-free
Used to improve the model, retained 30 days
beam-free
Not used for training, retained 30 days
nemotron-3.5 free models
NVIDIA trial: logged, don't submit confidential data
mimo-v2.6-flash-free
No terms stated
I allow only  deepseek-v4.1-flash-free  and  hy4-flash-free  in the Lambda Web Function. Any other model name is rejected.
Two more things to expect. The catalog changes: the model I started with was gone nine days later, so read it with  opencode models opencode  before you pin one. And the free tier has a cap. After about 100 prompts OpenCode logged "Free usage limit reached" and kept retrying, so my requests hung until the 120-second timeout. A newly deployed MicroVM may receive a separate daily quota to keep you going, but I have not verified that. My wrapper gives up after 40 seconds and returns HTTP 429 instead.

Deploy the crew, start it and stop it

Clone the  GitHub repository  and install its Node dependencies:
git clone https://github.com/awsdataarchitect/kirocrew-on-lambda.git
cd kirocrew-on-lambda
npm install
The deploy script builds the Lambda Web Function package, bootstraps CDK if needed and deploys both stacks. From the repository root:
./deploy.sh # both stacks, about 8 minutes
./deploy.sh check # live Lambda Web Function check
Prerequisites: AWS CLI v2 with credentials, Node 22 or newer,  uv , and the Session Manager plugin on the laptop. The Strands harness reads a free NVIDIA NIM key from an SSM Standard String parameter. Create it before deployment, without committing the value or using  SecureString :
read -rsp "NVIDIA NIM API key: " NVIDIA_NIM_API_KEY; printf '\n'
aws ssm put-parameter \
--name /nim-free/api-key \
--type String \
--value "$NVIDIA_NIM_API_KEY" \
--overwrite \
--region us-east-1
unset NVIDIA_NIM_API_KEY
The deploy role needs permission to read that parameter. The CDK stack passes the parameter reference to the MicroVM; the key is not written into the image, repository or logs.
crew/scripts/crew.sh up # launch one crew, about a minute to ready
crew/scripts/crew.sh status # phase and installed KiroCrew version
crew/scripts/crew.sh down # stop billing, save state
The image build runs the official KiroCrew installer ( --channel stable ), so each rebuild picks up the latest stable release. The installer checks a signed release feed and the wheel's SHA-256 before it installs anything, and it needs  openssl  for that. Read the pinned Strands versions from the installed release instead of copying them, so a newer KiroCrew brings its own.
The gateway's home folder is copied to S3 every minute and on shutdown, so a new VM continues your sessions. The VM lives at most one hour by default (the platform maximum is 8), and it bills only while it runs.

Remote Crew deployment options

The familiar Remote Crew choices are a cloud crew, which runs on an EC2 instance in your AWS account, and a local crew, which runs on a machine you already have. This blog adds the Lambda MicroVM option. Fargate provides another remote path when a chat API is enough:
Option
What it is
Cloud crew
A managed install on an EC2 instance in your AWS account, billed per second while it runs
Local crew
You set up a crew on a machine you already have
Fargate task
A chat API on an ECS Fargate task. KiroCrew tunnels to it with  aws ssm start-session ; the card shows a URL to call, with no dashboard and no token. It needs the AWS CLI, Session Manager plugin and permission for SSM Session Manager.
Lambda MicroVM (this blog)
A crew on a Lambda MicroVM, billed per second while it runs and wired up with SSM
The three Remote Crew connection methods are SSH, AWS SSM Session Manager and the Fargate task chat API. This post uses AWS SSM Session Manager for the MicroVM.

How the laptop connects over SSM

SSH needs an open port and a key. A MicroVM has neither. SSM works the other way round: the MicroVM calls out to AWS, so nothing listens. The MicroVM registers itself as a managed node, and your laptop asks SSM to run a command on it and to forward a port. Who may do that is an IAM decision.
  1. Before launch, the launcher creates a hybrid activation: a code that registers one machine, single-use, expiring in an hour.
  1. The launcher passes the activation id and code to the MicroVM in its run payload.
  1. Inside the MicroVM, the SSM agent registers with that code. The MicroVM appears as a managed node with an id that starts with  mi-  and shows Online.
  1. In Settings, Remote Crew, add a crew: connection method AWS SSM, that  mi-  id, remote user  crew , the gateway's port, and the  kirocrew  path on the MicroVM.  crew.sh remote-config  prints these values.
  1. When you press Connect, KiroCrew uses your own AWS credentials. Run Command runs  kirocrew token  on the MicroVM to mint a login token. Session Manager forwards the gateway's port to your laptop.
  1. You need  ssm:SendCommand ,  ssm:GetCommandInvocation  and  ssm:StartSession  on that node. There is no key to lose and no inbound rule.
The role the MicroVM assumes only needs the  AmazonSSMManagedInstanceCore  managed policy. I did not need Secrets Manager or KMS for any of this. See  hybrid activations .
I verified this path with the final image: the Remote Crew pane connected over SSM, minted a token, opened the gateway and completed a chat turn through the OpenCode Lambda Web Function.

Reach it from your phone with Tailscale

KiroCrew's dashboard can be published on a tailnet, and it has a Connect your phone control in the side rail. On the laptop, enable the dashboard's Tailscale access and use the displayed tailnet address. On the iPhone, install and sign in to Tailscale, turn on Use Tailscale DNS settings in the app, then open that address. The phone can reach the same remote crew without exposing the gateway to the public internet.
The final setup was checked from an iPhone. The screenshot below shows the phone connected to the remote KiroCrew dashboard.


KiroCrew remote crew on an iPhone over Tailscale




What broke

The SSM agent needs root, and the VM forbids it. The VM runs with the no-new-privileges flag, so  sudo  refuses to start: "The 'no new privileges' flag is set, which prevents sudo from running as root." The agent runs as root and keeps its credentials under  /root  ( docs ), so running it as your app user does not work. I start the container as root and run one small helper. It accepts a single request on a unix socket, checks the region, activation id and code against strict patterns, registers once, and starts the agent. Everything else drops to a normal user.
Run Command's PATH is short. KiroCrew wraps remote commands in  sudo -u crew -i bash . With a stand-in  sudo  in  /usr/local/bin , Run Command answered "sudo: command not found", because its PATH has  /usr/bin  but not  /usr/local/bin . Install the stand-in in  /usr/bin .
A suspended VM drops your session. I had set the idle policy to suspend the VM after 5 minutes, and by the time I pressed Connect it was suspended. A suspended VM freezes the SSM agent, and Session Manager does not wake it, so the port forward timed out after 25 seconds. Set the maximum idle time to the VM's lifetime and let the lifetime cap bound the cost.
Connect failed with "No such file or directory" for the kirocrew path. The Remote Crew entry stores the path to  kirocrew  on the remote. An entry left over from an earlier attempt pointed at a path that did not exist on this VM. Set it to the installer's path,  /usr/local/bin/kirocrew  here.
The Lambda Web Function answered 403 to signed requests. The endpoint wants a signed  x-amz-content-sha256  header. The JavaScript signer adds it by default and botocore does not. Add the header before you sign.
The prompt is longer than you think. KiroCrew sends its whole agent prompt before your message. My first wrapper cut prompts at 2,000 characters, so the model never saw the question and replied to the preamble. Cap at 200,000.
HTTP 429 from the endpoint. Read the  lambda-web-error-type  header.  Platform.EndpointMaxEnvThrottle  means the endpoint hit its  maxEnvironments  limit. I had it at 2, the lowest allowed. Raise it. See  scaling behaviour .
The server may start your app in more than one process. Two  opencode serve  processes on one home folder gave "database is locked", and requests failed after waiting 60 seconds. A file lock lets one process start it and the others reuse it.
Keep the conversation outside the environment. Environments scale in and out, and  /tmp  is lost with them. I store each conversation as a transcript in S3. A new environment creates a fresh OpenCode session and posts the earlier turns with  noReply , which makes no model call. I tried  opencode export  and  import  first. Thirty concurrent calls timed out at 30 seconds on 2 vCPU, because each call starts a process. In a test with 36 sessions across two environments, turns that moved between environments came back restored and still knew the code word.
S3 Files did not fit. A Lambda Web Function has no file system setting in its service model. A MicroVM accepts one default-route network connector, and a VPC connector without a NAT gateway could not reach SSM or the model API, so the SSM read timed out. I copy state with the S3 API instead.
The image build failed. The installer needs  openssl  to verify its feed, a root-owned uv cache blocked it when it ran as a normal user, and a Strands package spec had its extra in the wrong place ( pkg==1.0[extra]  instead of  pkg[extra]==1.0 ). A failed image build rolls the stack back and deletes its log group, so copy the build log while it runs.

What it costs

Prices are for us-east-1 on Arm, from the  Lambda pricing page  and the Price List API.
Item
Rate
MicroVM, 2 GB and 1 vCPU
$0.0000276944 per vCPU-second plus $0.0000036667 per GB-second, so about $0.126 per hour
Lambda Web Function
$0.30 per million requests, the same vCPU and memory rates, billed on active CPU, not on waiting
MicroVM snapshots
$0.00155 per GB read at launch, $0.0038 per GB written at suspend, image storage $0.08 per GB-month with a one-week minimum
Amazon ECR
No private ECR application image is stored in this design. Lambda builds the MicroVM image from the S3 code artifact; the Dockerfile uses public ECR base images. If you switch to a private ECR base image, standard
 Amazon ECR storage and applicable data-transfer charges apply 
Session Manager, Run Command
$0.05 per connection, $0.002 per command
 AWS blog 
Free models, SSM Standard parameter, hybrid activation
$0
An example month: a crew for 2 hours a day over 20 days, one Connect per day, 100 turns a day.
Part
Calculation
Cost
MicroVM
40 hours at $0.126
$5.04
SSM
20 connections at $0.05 and 20 commands at $0.002
$1.04
Lambda Web Function
2,000 requests at about $0.0000192
$0.04
Total

about $6.12
The total includes the MicroVM, Lambda Web Function, SSM connection and command charges in this example. S3 storage, S3 requests and CloudWatch Logs add usage-based charges that depend on retention and traffic, so check those separately in Cost Explorer. The Lambda Web Function figure comes from 648 requests in my logs, which used 442 vCPU-seconds, including cold starts. It leaves out memory, which I did not measure. The MicroVM bills while it runs, so stop it with  crew.sh down  when you are done.

Tear it down

crew/scripts/crew.sh down # terminates the VM and deregisters its SSM node
(cd crew && ../node_modules/.bin/cdk destroy) && (cd webfn && ../node_modules/.bin/cdk destroy)
The crew's state bucket is retained on purpose; empty and delete it by hand. Image storage has a one-week minimum. Remove the Remote Crew entry in Settings, since its  mi-  id is gone with the VM.

What I did not build

  • Chat only. This adapter forwards messages to OpenCode; it does not forward tool calls, so this path cannot ask for approval before a remote tool runs.
  • One crew at a time. Two VMs would write to the same state prefix.
  • A preview runtime. The Lambda Web Function runs on  python3.15 , which can change.
  • Not measured. An 8-hour Lambda MicroVM launch and cost per turn at scale. Only us-east-1 was tested.

A weekend experiment that became a remote crew

What started as a weekend project to test Lambda Web Functions on the new Python 3.15 runtime grew into an experiment in launching KiroCrew from an iPhone while its gateway ran inside Lambda: OpenCode on a Lambda Web Function, Strands with NVIDIA NIM in a MicroVM, SSM access from a laptop, and the same crew reachable from an iPhone over Tailscale.
The  GitHub repository  contains the complete CDK project, launcher and setup instructions.
Now, go build!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article