Skip to main content

Execute Commands

Run a command inside a pod via the API (no SSH key needed):
The -- separator is required to prevent flag parsing conflicts. Commands run as the instapod user, starting in that user’s home directory (/home/instapod). Everything after -- is an argv vector, not a shell line: each argument is passed through verbatim, so shell syntax (pipes, redirects, &&, globs) needs an explicit shell.
If a command fails, both stdout and stderr are displayed so you can see the actual error message. instapods exec also exits with the command’s own exit status, so 127 (command not found) and 126 (not executable) stay distinguishable from an ordinary failure.

Flags

Flags go before --:
A single exec call is capped at 60 seconds. Longer work (a full install or build) belongs in instapods deploy, which runs it server-side without that ceiling. Output is capped at 4 MB. Past that the middle is cut out - you get the first 1 MB and the last 3 MB around a marker line saying how many bytes were omitted. For bulky output, write it to a file in the pod and fetch it with instapods files download, or read just the part you need:
A pod runs up to 8 commands at a time, counted across the CLI, the API and the MCP tools. A ninth instapods exec is refused with too many concurrent commands for this pod rather than queued - run it again once the others finish.

Inspect the Runtime

Before writing code that depends on what is inside a pod, ask:
Everything is read from the running pod, not inferred from the preset — so a binary listed as missing really is missing. Pods have passwordless sudo, so a missing package is one sudo apt-get install -y <pkg> away. Add --json for the same report as structured data (versions, byte counts, and the request-size limits), which is the shape to parse from a script or an agent.

Examples

SSH Keys

List SSH Keys

List SSH keys on a specific pod:
List your account-level SSH keys (no pod name):

Add an SSH Key

Push your local SSH public key to a pod:
The CLI auto-detects keys in this priority order: id_ed25519.pub, id_rsa.pub, id_ecdsa.pub. After adding a key, the CLI shows the SSH command you can use to connect:

Remove an SSH Key

Remove an account-level SSH key by ID:

SSH Connection

Connect via SSH (requires CLI v1.18.0 or later):
If the pod doesn’t have your key yet, the CLI offers to add your local ~/.ssh public key and reconnects; -y adds it without asking. Run a single command with --, and the CLI exits with that command’s status:
Or use plain ssh with the host and port from the SSH tab of the pod detail page, from instapods pods get my-app (its SSH: line), or from instapods ssh my-app --print:
To copy files, use scp -P PORT or sftp -P PORT (capital -P). See SSH Access.

SSH Security

InstaPods uses Trust On First Use (TOFU) for SSH host key verification:
  • On first connection, the host key is automatically accepted and saved
  • On subsequent connections, the key is verified against the saved copy
  • If the key changes (which shouldn’t happen for a running pod), you’ll get a warning
When you delete a pod, the CLI automatically cleans up the old host key from your ~/.ssh/known_hosts file to prevent conflicts. Deleted pod SSH ports are reserved for 7 days before reuse.