> ## Documentation Index > Fetch the complete documentation index at: https://bunny.net/docs/llms.txt > Use this file to discover all available pages before exploring further. # bunny sandbox > Create and manage on-demand cloud sandbox environments backed by Bunny Magic Containers. `bunny sandbox` manages on-demand cloud sandbox environments backed by [Bunny Magic Containers](https://bunny.net/docs/magic-containers.md). Each sandbox is a fully isolated Ubuntu container with Node.js, Bun, Python, and Claude Code pre-installed. A 10 GB persistent volume is mounted at `/workplace`, your default working directory. Claude Code is pre-installed but needs your own Anthropic credentials before it can do anything: pass an API key at create time (prefer `--env-file .env` so the key stays out of your shell history), or run `claude` inside the sandbox and complete the login prompt it prints. Both survive restarts and redeploys: baked env vars live on the container, and the login flow writes to `/workplace/.claude` on the persistent volume. Sandbox credentials (app ID, SSH endpoint, agent token) are stored in the CLI's local config file (`~/.config/bunnynet.json` by default) so you can reconnect without re-creating. *** ## `bunny sandbox create` Create and start a new sandbox. Waits for the container's SSH port to become reachable before returning. ```bash Command (create) theme={null} # Create a sandbox with the default name "sandbox" bunny sandbox create # Create a named sandbox bunny sandbox create my-sandbox # Create in a specific region bunny sandbox create my-sandbox --region NY # Bake in environment variables (persisted for the sandbox's lifetime) bunny sandbox create my-sandbox -e NODE_ENV=production -e PORT=8080 bunny sandbox create my-sandbox --env-file .env # Give Claude Code your Anthropic API key at create time (.env holds ANTHROPIC_API_KEY) bunny sandbox create my-sandbox --env-file .env ``` ```text Response (create) theme={null} Sandbox "my-sandbox" is ready. App ID: Ab3xK9mPq2wR7nL SSH: 203.0.113.42:8023 Run commands with: bunny sandbox exec my-sandbox ``` | Flag | Alias | Description | Default | | - | - | - | - | | `--region` | | Region ID to deploy in (e.g. `AMS`, `NY`, `LA`, …) | `AMS` | | `--env` | `-e` | Environment variable as `KEY=VALUE` (repeatable) | | | `--env-file` | | Load environment variables from a dotenv file | | Variables set at creation are baked into the container and persist across restarts. Values from `--env` override those loaded from `--env-file`. To change them later, use [`bunny sandbox env`](#bunny-sandbox-env). Once ready, the output shows the app ID and SSH address. Public URLs come later via [`bunny sandbox url add`](#bunny-sandbox-url-add). ## `bunny sandbox list` List all sandboxes saved in your local config. ```bash Command (list) theme={null} bunny sandbox list bunny sandbox ls # alias ``` ```text Response (list) theme={null} Name App ID SSH my-sandbox Ab3xK9mPq2wR7nL 203.0.113.42:8023 ``` ## `bunny sandbox delete` Delete a sandbox and permanently destroy the underlying Magic Containers app. ```bash Command (delete) theme={null} bunny sandbox delete my-sandbox # Skip the confirmation prompt bunny sandbox delete my-sandbox --force bunny sandbox rm my-sandbox -f # alias ``` ```text Response (delete) theme={null} Delete sandbox "my-sandbox" (app Ab3xK9mPq2wR7nL)? (y/N) y Sandbox "my-sandbox" deleted. ``` | Flag | Alias | Description | Default | | - | - | - | - | | `--force` | `-f` | Skip confirmation prompt | `false` | ## `bunny sandbox exec` Run a shell command inside a sandbox over SSH. Defaults to `/workplace` as the working directory. ```bash Command (exec) theme={null} # Run a command bunny sandbox exec my-sandbox ls -la # Run in a different directory bunny sandbox exec my-sandbox --cwd /tmp env # Pipe-friendly: exit code is propagated bunny sandbox exec my-sandbox -- cat /etc/os-release # Inject temporary environment variables for this command only bunny sandbox exec my-sandbox --env DEBUG=1 -- node app.js bunny sandbox exec my-sandbox --env-file .env -- printenv # Give up after 30 seconds (exit code 124) bunny sandbox exec my-sandbox --timeout 30 -- bun run build ``` ```text Response (exec) theme={null} total 16 drwxr-xr-x 3 root root 4096 Jul 16 09:12 . drwxr-xr-x 1 root root 4096 Jul 16 09:10 .. -rw-r--r-- 1 root root 1254 Jul 16 09:12 app.js drwxr-xr-x 2 root root 4096 Jul 16 09:11 src ``` The command's stdout and stderr stream to your terminal unchanged, and its exit code is propagated, so `exec` works in scripts and pipes. | Flag | Alias | Description | Default | | - | - | - | - | | `--cwd` | | Working directory inside the sandbox | `/workplace` | | `--env` | | Environment variable as `KEY=VALUE` (repeatable) | | | `--env-file` | | Load environment variables from a dotenv file | | | `--timeout` | | Close the SSH connection and exit `124` after this many seconds | | Variables passed here apply only to that single command and are **not** persisted. For persistent variables, use [`bunny sandbox env`](#bunny-sandbox-env). ## `bunny sandbox files` Manage files inside a sandbox over SFTP. Remote paths use the form `:`, and relative paths resolve against `/workplace`. `bunny sandbox file` works as an alias. ### `bunny sandbox files list` List the files in a sandbox directory. A bare sandbox name lists `/workplace`; use `:` for a specific directory. ```bash Command (files list) theme={null} # List /workplace bunny sandbox files list my-sandbox bunny sandbox files ls my-sandbox # alias # List a specific directory bunny sandbox files ls my-sandbox:/workplace/src bunny sandbox files ls my-sandbox:src # Machine-readable listing (name, type, size, mode) bunny sandbox files ls my-sandbox --output json ``` ```text Response (files list) theme={null} Name Type Size Mode src directory 755 app.js file 1.2 KB 644 run.sh file 182 B 755 ``` ### `bunny sandbox files cp` Copy a file between your machine and a sandbox. Exactly one of the two paths must reference a sandbox as `:`; the other is a local path. ```bash Command (files cp) theme={null} # Upload a file into the sandbox bunny sandbox files cp ./app.js my-sandbox:/workplace/app.js # Upload relative to /workplace bunny sandbox files cp ./app.js my-sandbox:app.js # A trailing slash on the destination keeps the source filename bunny sandbox files cp ./app.js my-sandbox:/workplace/src/ # Download a file from the sandbox bunny sandbox files cp my-sandbox:/workplace/out.log ./out.log # Download into an existing directory (keeps the source filename) bunny sandbox files cp my-sandbox:/workplace/out.log ./logs/ ``` ```text Response (files cp) theme={null} Copied ./app.js -> my-sandbox:/workplace/app.js ``` Uploads preserve the local file's Unix mode (so executables stay executable). Only single files are supported; directory and sandbox-to-sandbox copies are not. > [!NOTE] > > This command used to be `bunny sandbox cp`. The old command no longer copies files. It prints the matching `bunny sandbox files cp` command to run instead. ## `bunny sandbox ssh` Open a full interactive SSH session. Drops you into a bash shell at `/workplace`. Type `exit` or press Ctrl-D to close. ```bash theme={null} bunny sandbox ssh my-sandbox # Set temporary environment variables for the session bunny sandbox ssh my-sandbox -e DEBUG=1 --env-file .env ``` | Flag | Alias | Description | Default | | - | - | - | - | | `--env` | `-e` | Environment variable as `KEY=VALUE` (repeatable) | | | `--env-file` | | Load environment variables from a dotenv file | | Variables apply only to the session and are not persisted. ## `bunny sandbox url` Manage public CDN endpoints for ports running inside a sandbox. Useful for exposing a dev server or API to the internet. ### `bunny sandbox url add` Expose a container port as a public HTTPS endpoint. Waits until the URL is provisioned and prints it. ```bash Command (url add) theme={null} # Expose port 3000 (endpoint named "port-3000") bunny sandbox url add my-sandbox 3000 # Custom endpoint name bunny sandbox url add my-sandbox 8080 --label my-api ``` ```text Response (url add) theme={null} Endpoint "port-3000" created. Port: 3000 URL: https://app-3000.b-cdn.net ``` | Flag | Description | Default | | - | - | - | | `--label` | Display name for the endpoint | `port-` | ### `bunny sandbox url list` List all user-created endpoints for a sandbox (built-in `api` and `ssh` endpoints are hidden). ```bash Command (url list) theme={null} bunny sandbox url list my-sandbox bunny sandbox url ls my-sandbox # alias ``` ```text Response (url list) theme={null} ID Name Type Port URL Ab3xK9mPq2wR7nL-port-3000-Kj7mNp3qRx port-3000 cdn 3000 https://app-3000.b-cdn.net ``` ### `bunny sandbox url delete` Delete a public endpoint by name. ```bash Command (url delete) theme={null} bunny sandbox url delete my-sandbox port-3000 # Skip confirmation bunny sandbox url delete my-sandbox my-api --force bunny sandbox url rm my-sandbox my-api -f # alias ``` ```text Response (url delete) theme={null} Delete endpoint "port-3000" from sandbox "my-sandbox"? (y/N) y Endpoint "port-3000" deleted. ``` | Flag | Alias | Description | Default | | - | - | - | - | | `--force` | `-f` | Skip confirmation prompt | `false` | ## `bunny sandbox env` Manage a sandbox's **persistent** environment variables, the ones baked into the container. Unlike the temporary `--env` passed to `exec`/`ssh`, these survive across sessions. Changing them redeploys the sandbox with the new environment (running processes restart). ### `bunny sandbox env set` Set one or more persistent variables, merging with the existing set. ```bash Command (env set) theme={null} # Set a single variable bunny sandbox env set my-sandbox NODE_ENV=production # Set several at once bunny sandbox env set my-sandbox API_URL=https://api.example.com LOG_LEVEL=debug # Load from a dotenv file bunny sandbox env set my-sandbox --env-file .env ``` ```text Response (env set) theme={null} Persisted 2 variable(s): API_URL, LOG_LEVEL The sandbox is redeploying to apply the change. ``` | Flag | Description | Default | | - | - | - | | `--env-file` | Load environment variables from a dotenv file | | ### `bunny sandbox env list` List the sandbox's persistent variables. The internal `AGENT_TOKEN` is hidden. ```bash Command (env list) theme={null} bunny sandbox env list my-sandbox bunny sandbox env ls my-sandbox # alias ``` ```text Response (env list) theme={null} Name Value LOG_LEVEL debug NODE_ENV production ``` ### `bunny sandbox env delete` Remove one or more persistent variables. Names that are not set are reported and skipped; if none match, the command errors and nothing is redeployed. ```bash Command (env delete) theme={null} bunny sandbox env delete my-sandbox NODE_ENV bunny sandbox env rm my-sandbox API_URL LOG_LEVEL # alias bunny sandbox env unset my-sandbox API_URL # alias ``` ```text Response (env delete) theme={null} Removed 1 variable(s): NODE_ENV Not set (ignored): DEBUG The sandbox is redeploying to apply the change. ``` This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.