Skip to main content

CLI Overview

Overview

The infra.operator CLI provides a complete interface for managing Firecracker microVMs, including rootfs image creation, snapshot management, S3 synchronization, and code execution.

Installation

Build from Source

Build for current platform
task -t Taskfile.cli.yaml build
Build for Linux (deploy to EC2)
task -t Taskfile.cli.yaml build-linux

Deploy to EC2

Deploy to EC2
task -t Taskfile.cli.yaml deploy

Command Structure

CLI Command Structure

Quick Reference

Global Flags

FlagDescriptionDefault
--configPath to config file$HOME/.infra-operator.yaml
--versionShow version-
--helpShow help-

Environment Variables

AWS Configuration
export AWS_ACCESS_KEY_ID="your-key"
export AWS_SECRET_ACCESS_KEY="your-secret"
export AWS_DEFAULT_REGION="us-east-1"
S3 Bucket Configuration
export S3_BUCKET="llm-infra-operator-rootfs"
export S3_REGION="us-east-1"
Firecracker Configuration
export FC_WORKDIR="/srv/firecracker"
export FC_KERNEL="/srv/firecracker/vmlinux"

Command Categories

Rootfs Management

Create and manage rootfs images for different programming languages:

Create a Python rootfs image
infra.operator rootfs create --lang python
List local rootfs images
infra.operator rootfs list
List S3 rootfs images
infra.operator rootfs list --remote
Upload to S3
infra.operator rootfs upload --lang python
Download from S3
infra.operator rootfs download --lang python

Snapshot Management

Create and manage VM snapshots for fast boot (~200ms):

Create a snapshot
infra.operator snapshot create --lang python
List local snapshots
infra.operator snapshot list
List S3 snapshots
infra.operator snapshot list --remote
Upload snapshot to S3
infra.operator snapshot upload --lang python
Download snapshot from S3
infra.operator snapshot download --lang python

Code Execution

Execute code in isolated microVMs:

Execute inline code
infra.operator run --lang python --code "print('Hello!')"
Execute from file
infra.operator run --lang nodejs --file script.js
Execute with custom timeout
infra.operator run --lang go --code 'package main; func main() { println("hi") }' --timeout 60

API Server

Start the HTTP API server:

Start API server on default port 8080
infra.operator api
Start API server with custom port and host
infra.operator api --port 3000 --host 0.0.0.0

Benchmarking

Run performance benchmarks:

Benchmark all 45 languages
infra.operator benchmark --all
Benchmark specific languages
infra.operator benchmark --langs python,nodejs,go

Supported Languages

The CLI supports 45 programming languages:

CategoryLanguages
PopularPython, Node.js, TypeScript, Go, Rust, Java, C#/.NET
WebPHP, Ruby, Perl
CompiledC, C++, Fortran, Pascal, COBOL
FunctionalHaskell, OCaml, Elixir, Erlang, Clojure, Common Lisp
JVMJava, Kotlin, Scala, Groovy, Clojure
ModernZig, Nim, Crystal, D
ScientificJulia, R, Octave
ScriptingLua, Tcl, AWK, jq
OtherProlog, Scheme, SQLite, NASM, Bash

Workflow Examples

Full Language Setup

1. Create rootfs image
infra.operator rootfs create --lang python
2. Create snapshot for fast boot
infra.operator snapshot create --lang python
3. Upload to S3 for distribution
infra.operator snapshot upload --lang python
4. Execute code
infra.operator run --lang python --code "print('Ready!')"

Download and Execute

1. Download snapshot from S3
infra.operator snapshot download --lang nodejs
2. Execute code
infra.operator run --lang nodejs --code "console.log('Hello!')"

Benchmark Performance

Run full benchmark with S3 on-demand download
infra.operator benchmark --all
Expected output
[1/45] python: LOAD=209ms [OK]
[2/45] nodejs: LOAD=215ms [OK]
...
Average Load Time: 220ms

Taskfile Integration

Use Taskfile for common operations:

List available tasks
task -t Taskfile.cli.yaml --list
Build the CLI
task -t Taskfile.cli.yaml build
Run code locally
task -t Taskfile.cli.yaml run LANG=python CODE='print(1)'
Execute code on remote EC2
task -t Taskfile.cli.yaml remote:run LANG=python CODE='print(1)'
Run benchmark on remote EC2
task -t Taskfile.cli.yaml remote:benchmark

Output Format

All commands output structured information:

List rootfs images (table format)
infra.operator rootfs list
Rootfs list output
LANGUAGE  SIZE      PATH
python 1.2 GB /srv/firecracker/images/rootfs-python.ext4
nodejs 800 MB /srv/firecracker/images/rootfs-nodejs.ext4
Execute code
infra.operator run --lang python --code "print('hello')"
Execution output (JSON)
{
"stdout": "hello\n",
"stderr": "",
"exit_code": 0
}

Next Steps