Skip to main content

Execute Commands

Run a command inside a pod via the API (no SSH key needed):
instapods exec my-app -- ls -la /home/instapod/app
instapods exec my-app -- npm install
instapods exec my-app -- python manage.py migrate
The -- separator is required to prevent flag parsing conflicts. Commands run as the instapod user. If a command fails, both stdout and stderr are displayed so you can see the actual error message — not just the exit code.

Examples

# Check Node.js version
instapods exec my-app -- node --version

# Install Python dependencies
instapods exec my-app -- /home/instapod/app/venv/bin/pip install -r requirements.txt

# Run a database migration
instapods exec my-app -- php artisan migrate

# Check disk usage
instapods exec my-app -- df -h

# Run a shell command with pipes
instapods exec my-app -- bash -c "cat /etc/os-release | head -5"

SSH Keys

List SSH Keys

List SSH keys on a specific pod:
instapods ssh-keys list my-app
List your account-level SSH keys (no pod name):
instapods ssh-keys list

Add an SSH Key

Push your local SSH public key to a pod:
# Use default key (~/.ssh/id_ed25519.pub or ~/.ssh/id_rsa.pub)
instapods ssh-keys add my-app

# Use a specific key file
instapods ssh-keys add my-app --key ~/.ssh/custom_key.pub
The CLI auto-detects keys in this priority order: id_ed25519.pub, id_rsa.pub, id_ecdsa.pub.

Remove an SSH Key

Remove an account-level SSH key by ID:
instapods ssh-keys remove KEY_ID

SSH Connection

Once your key is added, connect via SSH:
instapods ssh my-app
Or manually using the pod’s SSH details:
ssh instapod@nbg1-1.instapods.app -p PORT
Find the SSH port via:
instapods pods get my-app

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.