lamvms is a deployment and lifecycle management tool for AWS Lambda MicroVMs, inspired by fujiwara/lambroll.
Download the latest binary from GitHub Releases.
go install github.com/kayac/lamvms/cmd/lamvms@latestaqua is a declarative CLI Version Manager. See the installation guide to install aqua itself. Once aqua is installed, you can install lamvms with:
aqua g -i kayac/lamvms
aqua imicrovm.jsonnet:
local must_env = std.native('must_env');
local caller_identity = std.native('caller_identity');
{
Name: 'my-app',
BaseImageArn: 'arn:aws:lambda:ap-northeast-1:aws:microvm-image:al2023-1',
BuildRoleArn: 'arn:aws:iam::' + caller_identity().Account + ':role/MicrovmBuildRole',
CodeArtifact: {
uri: 's3://' + must_env('S3_BUCKET') + '/my-app/app.zip',
},
}lamvms deploy --microvm microvm.jsonnetThis will:
- Create a zip archive from the source directory (defaults to the directory of
microvm.jsonnet) - Upload it to S3
- Create or update the MicroVM image
- Wait for the build to complete
lamvms run --microvm microvm.jsonnetlamvms shell --microvm microvm.jsonnetPress Ctrl+D to disconnect from the shell session.
lamvms needs the following IAM permissions to operate:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambdamicrovms:CreateMicrovmImage",
"lambdamicrovms:UpdateMicrovmImage",
"lambdamicrovms:GetMicrovmImage",
"lambdamicrovms:GetMicrovmImageVersion",
"lambdamicrovms:UpdateMicrovmImageVersion",
"lambdamicrovms:DeleteMicrovmImageVersion",
"lambdamicrovms:ListMicrovmImages",
"lambdamicrovms:ListMicrovmImageVersions",
"lambdamicrovms:ListMicrovmImageBuilds",
"lambdamicrovms:RunMicrovm",
"lambdamicrovms:GetMicrovm",
"lambdamicrovms:SuspendMicrovm",
"lambdamicrovms:ResumeMicrovm",
"lambdamicrovms:TerminateMicrovm",
"lambdamicrovms:ListMicrovms",
"lambdamicrovms:DeleteMicrovmImage",
"lambdamicrovms:ListTags",
"lambdamicrovms:TagResource",
"lambdamicrovms:UntagResource",
"lambdamicrovms:CreateMicrovmAuthToken",
"lambdamicrovms:CreateMicrovmShellAuthToken"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::YOUR_BUCKET/*"
},
{
"Effect": "Allow",
"Action": "sts:GetCallerIdentity",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "iam:PassRole",
"Resource": "arn:aws:iam::*:role/YOUR_EXECUTION_ROLE"
}
]
}s3:PutObjectis required fordeployto upload the source archive.sts:GetCallerIdentityis used by thecaller_identity()template function.iam:PassRoleis only required when passing--execution-role-arntorun. Scope it down with aniam:PassedToServicecondition once the service principal for AWS Lambda MicroVMs is confirmed.
The MicroVM image definition. Maps directly to the CreateMicrovmImage API payload.
If --microvm is not specified, lamvms searches for microvm.jsonnet then microvm.json in the current directory.
The MicroVM run configuration. Maps to the RunMicrovm API payload (except ImageIdentifier, which is resolved from the microvm definition).
{
IngressNetworkConnectors: [
'arn:aws:lambda:ap-northeast-1:aws:network-connector:aws-network-connector:HTTP_INGRESS',
'arn:aws:lambda:ap-northeast-1:aws:network-connector:aws-network-connector:SHELL_INGRESS',
],
EgressNetworkConnectors: [
'arn:aws:lambda:ap-northeast-1:aws:network-connector:aws-network-connector:INTERNET_EGRESS',
],
IdlePolicy: {
AutoResumeEnabled: true,
MaxIdleDurationSeconds: 900,
SuspendedDurationSeconds: 300,
},
}If --run-def is not specified, lamvms searches for run.jsonnet then run.json relative to the microvm definition file, then in the current directory. If no run definition file is found, the MicroVM is started with only the ImageIdentifier (minimal configuration).
Exclusion patterns for zip archive creation. One pattern per line; blank lines and lines starting with # are ignored.
Pattern matching is based on filepath.Match, not .gitignore semantics:
*does not cross a/boundary. For example,*.logmatchesapp.logbut notsub/app.log.- A pattern ending in
/*(e.g.dir/*) excludes everything underdir/, at any depth.
The following patterns are excluded by default, in addition to any listed in .microvmignore:
.microvmignoremicrovm.jsonmicrovm.jsonnet.git/*
Symbolic links are followed (dereferenced) by default, same as the standard zip command. Pass --symlink to deploy to store them as symlinks in the archive instead (same as zip --symlink/-y). When following (the default), a symlink pointing to a directory is skipped with a warning rather than being expanded.
std.native('env')('NAME', 'default')— environment variable with defaultstd.native('must_env')('NAME')— environment variable (error if unset)std.native('caller_identity')()— returns{Account, Arn, UserID}
{{ env "NAME" "default" }}{{ must_env "NAME" }}{{ (caller_identity).Account }}
Initialize a microvm definition from an existing MicroVM image.
lamvms init --image-name my-app| Flag | Description | Default |
|---|---|---|
--image-name |
Name of the existing MicroVM image (required) | |
--output |
Output file path | microvm.json |
--jsonnet |
Output as .jsonnet format | false |
--force-overwrite |
Overwrite existing file | false |
Deploy a MicroVM image (create or update).
lamvms deploy [flags]| Flag | Description | Default |
|---|---|---|
--src |
Source directory for zip archive | Directory of microvm definition |
--skip-archive |
Skip zip creation and S3 upload | false |
--wait / --no-wait |
Wait for build completion | true |
--build-logs / --no-build-logs |
Tail the build's CloudWatch Logs while waiting | true |
--keep-versions N |
Keep N latest active versions, delete older | 0 (disabled) |
--dry-run |
Show what would be done | false |
--symlink |
Keep symlinks in the archive instead of following them (same as zip --symlink) |
false |
Wait for a MicroVM image version to be ready.
lamvms wait [flags]| Flag | Description | Default |
|---|---|---|
--image-version |
Specific version to wait for | Latest version |
--build-logs / --no-build-logs |
Tail the build's CloudWatch Logs while waiting | true |
--keep-versions N |
Delete old versions after wait | 0 (disabled) |
Deactivate the latest active version, falling back to the previous one.
lamvms rollback [flags]| Flag | Description | Default |
|---|---|---|
--dry-run |
Show what would be done | false |
Show the diff between the local microvm definition and the deployed configuration.
lamvms diff [flags]| Flag | Description | Default |
|---|---|---|
--exit-code |
Exit with code 2 if there are differences | false |
Run a new MicroVM instance. CLI flags override values from run.jsonnet.
lamvms run [flags]| Flag | Description | Default |
|---|---|---|
--run-def |
Path to run definition file | Auto-discovered |
--image-version |
Image version to run | Latest active |
--execution-role-arn |
IAM role ARN for runtime | |
--max-duration |
Maximum duration in seconds | |
--run-hook-payload |
Payload for /run lifecycle hook | |
--wait / --no-wait |
Wait for RUNNING state | true |
--create-auth-token |
Create auth token after run | false |
--token-expiration |
Auth token expiration | 30m |
--output |
Output format (text or json) |
text |
Open an interactive shell session to a running MicroVM via WebSocket. Requires SHELL_INGRESS network connector.
lamvms shell [microvm-id]| Flag | Description | Default |
|---|---|---|
--token-expiration |
Shell token expiration | 60m |
Press Ctrl+D to disconnect.
Send a request to a running MicroVM via curl. Automatically handles auth token.
lamvms curl <path> [curl-flags...]| Flag | Description | Default |
|---|---|---|
--microvm-id |
MicroVM ID | Interactive selection |
--port |
Target port | 0 (server-side default: 8080) |
--token-expiration |
Auth token expiration | 5m |
Example:
lamvms --microvm microvm.jsonnet curl /health -sManage MicroVM lifecycle. MicroVM ID can be omitted for interactive selection.
lamvms suspend [microvm-id]
lamvms resume [microvm-id]
lamvms terminate [microvm-id]resume supports --create-auth-token and --token-expiration to generate a fresh auth token, and --output (text or json, default text) to control the output format.
Delete a MicroVM image.
lamvms delete [flags]| Flag | Description | Default |
|---|---|---|
--dry-run |
Show what would be done | false |
Tail CloudWatch logs for a MicroVM image (delegates to aws logs tail).
lamvms logs [flags]| Flag | Description | Default |
|---|---|---|
--since |
Start time | 10m |
--follow |
Follow new logs | false |
--format |
Log format (detailed, short, json) |
detailed |
--filter-pattern |
CloudWatch filter pattern |
Manage the bundled Agent Skill (SKILL.md) that teaches LLM coding agents (Claude Code, Codex, etc.) how to use lamvms.
lamvms skills list
lamvms skills install [--scope user|repo] [--dry-run]
lamvms skills update
lamvms skills reinstall
lamvms skills uninstall
lamvms skills status| Flag | Description | Default |
|---|---|---|
--scope |
Install scope (user or repo) |
user |
--prefix |
Override install directory | |
--dry-run |
Preview changes without applying | false |
--force |
Overwrite unmanaged skills or force downgrade | false |
install --scope repo installs to .agents/skills/ in the repository root, which can be committed so teammates' agents pick it up without installing individually.
| Flag | Env | Description |
|---|---|---|
--microvm |
LAMVMS_MICROVM |
Path to microvm definition |
--log-level |
LAMVMS_LOGLEVEL |
Log level (debug, info, warn, error) |
--log-format |
LAMVMS_LOGFORMAT |
Log format (text, json) |
--color / --no-color |
LAMVMS_COLOR |
Colored output |
--region |
AWS_REGION |
AWS region |
--profile |
AWS_PROFILE |
AWS profile |
--endpoint |
AWS_ENDPOINT_URL |
AWS API endpoint |
--envfile |
LAMVMS_ENVFILE |
Environment files |
--filter-command |
LAMVMS_FILTER_COMMAND |
Filter command for interactive selection (e.g. peco, fzf). If the value contains spaces, it is evaluated via sh -c. |
-V key=value |
Jsonnet external variables | |
--ext-code key=code |
Jsonnet external code | |
--version / -v |
Show version and exit |
_examples/simple— minimal deploy/run configuration with HTTP and shell ingress._examples/lifecycle-hooks— addsReady/Validateimage build hooks.
MIT