Automate Lambda.ai with Ansible-inspired Go CLI
On-demand GPUs are powerful for experimenting with new models and hosting your own inference.
Thankfully, the team at Lambda.ai have created an excellent API for spinning up instances, managing filesystems, and even replacing inbound firewall rules on the fly!
gotoni aims to make deploying your own infra process simple and automated through a CLI. I prefer this over a GUI or manual YAML configuration because AI agents are quite adept at using the terminal, so managing your infra without even needing a remote SSH window makes things 10x faster!
Like Ansible Automation, you can create a "playbook" by adding setup tasks with YAML property type: command. Tasks you want to run continuously in the background, like an OpenAI inference server for example, are labeled "service" and managed by systemd. Telemetry is available with the logs cmd.
curl -fsSL https://raw.githubusercontent.com/atoniolo76/gotoni/main/install.sh | bashExport your Lambda API key:
export LAMBDA_API_KEY=your_token_heregotoni update- Update gotoni to the latest versiongotoni launch- Launch a new instancegotoni snipe --instance-type <type> [--interval <duration>] [--timeout <duration>]- Poll for instance availability and automatically launch when foundgotoni list [--running]- List instances or instance typesgotoni delete <instance-id>- Terminate instancesgotoni connect <instance-ip>- Connect to an instance via SSHgotoni run [instance-id] <command>- Run a command on a remote instancegotoni add-task- Add a new task interactively to your configurationgotoni setup [instance-id]- Run setup tasks/playbooksgotoni start [instance-id]- Start service tasksgotoni status [instance-id]- Check status of servicesgotoni logs [instance-id] [service-name]- View service logsgotoni gpu [instance-id] --log <file.csv>- Track GPU memory usagegotoni ssh-keys list- List SSH keysgotoni ssh-keys get <instance-id> [--link]- Get SSH key associated with an instance (optionally create symlink in current directory)gotoni ssh-keys add <key-path> [--name <name>]- Add an existing SSH key file to gotoni configurationgotoni ssh-keys delete <key-id>- Delete an SSH keygotoni filesystems list- List filesystemsgotoni filesystems delete <filesystem-id>- Delete a filesystem
Configuration is stored in ~/.gotoni/config.yaml and is automatically managed. The file contains:
instances: Mapping of instance IDs to SSH key namesssh_keys: Mapping of SSH key names to private key file pathsfilesystems: Mapping of filesystem names to filesystem info (ID and region)tasks: List of tasks to run on instances. Usedepends_onand a previous task name to enforce successful command execution in order.
Example config.yaml:
instances:
instance-123: lambda-key-1234567890
ssh_keys:
lambda-key-1234567890: ssh/lambda-key-1234567890.pem
filesystems:
my-data:
id: fs-123
region: us-east-1
tasks:
- name: "Install dependencies"
type: "command"
command: "sudo apt-get update"
- name: "Start server"
type: "service"
command: "python app.py"
depends_on:
- Install dependencies- Create client struct for sdk usage