ryansb/microtty

Simple TTY handling for AWS Lambda MicroVMs

★ 8Forks 0PythonGitHub ↗Compare

README

microtty

microtty is a TTY connector for the AWS Lambda MicroVM direct shell connection websocket protocol. It is a self-contained uv + PEP 723 script and can be made executable anywhere in your $PATH.

Should you use this? Not for anything important! Manually interacting with a MicroVM seems to defeat the purpose of the programmatic provisioning and ephemeral nature of the service. But if you need it, you need it, and here it is.

Usage

microtty --help

 Usage: microtty [OPTIONS] [SANDBOX_ID]

 Connect this terminal to Lambda MicroVM shell ingress.

Arguments
  [sandbox_id]      TEXT  AWS mode: MicroVM/sandbox ID. Token mode: MicroVM endpoint/id when --endpoint/--vm is omitted.
  
Options
  --profile              TEXT             AWS profile to use
  --region               TEXT             AWS region; defaults to profile/env region
  --token                TEXT             existing shell auth token; skips AWS profile selection and token minting
  --endpoint             TEXT             MicroVM endpoint host or URL to use with --token, e.g. mvm-...lambda-microvm.us-west-2.on.aws
  --vm                   TEXT             MicroVM endpoint host/id to use with --token; bare ids require --region or AWS_REGION
  --term                 TEXT             TERM to export in the remote shell (default: local TERM or xterm-256color)
  --ttl-minutes          1-60 [1<=x<=60]  shell auth token lifetime in minutes (default: 30)
  --help         -h                       Show this message and exit.

 Exit the remote shell with Ctrl-D or `exit`. If the shell is wedged, detach microtty with Ctrl-].

With AWS Profiles

With normal AWS_REGION/AWS_DEFAULT_REGION and AWS_PROFILE variables you can use just microtty and it will respect those settings. Specify the profile, region, or both with:

microtty --profile my-profile --region us-west-2

Optionally, include the UUID and connect directly to a specific MicroVM. Otherwise, a picker will be offered.

With a Token

If you have the token from another system, you can skip AWS credentials in your terminal:

microtty  --token ... --endpoint 'https://some-long-uuid.lambda-microvm.us-west-2.on.aws/'

Credits & Thanks

Aidan's post Some Notes on Lambda MicroVMs and Luc van Donkersgoed's shell hack originally sent me down experimenting with the MicroVM connectivity protocol. The websocat + stty pipe worked but I wanted less secret TTY magic.

Contributors

ryansb

Issues