Advanced Commands

View as Markdown

Manage organizations, SSH keys, secrets, and perform advanced operations with the Brev CLI.

Organization Management

brev set

Switch your active organization context. All subsequent commands will operate within this organization.

$# List available organizations
$brev set
$
$# Switch to a specific organization
$brev set my-org

brev login

Authenticate with Brev. Opens a browser window for login.

$brev login

If you’re already logged in, brev login will refresh your credentials without requiring re-authentication.

brev logout

Clear your local authentication credentials.

$brev logout

SSH Key Management

Manage SSH keys for accessing your instances.

brev ssh-key

View and manage your SSH keys.

$# List your SSH keys
$brev ssh-key
$
$# Add a new SSH key from file
$brev ssh-key add ~/.ssh/id_rsa.pub

Brev automatically manages an SSH key at ~/.brev/brev.pem. You can add additional keys for team members or CI/CD systems.

Secrets Management

Store sensitive values like API keys that are injected into your instances as environment variables.

brev secret

Manage environment secrets for your instances.

$# List all secrets
$brev secret
$
$# Create a new secret
$brev secret create MY_API_KEY
$
$# Delete a secret
$brev secret delete MY_API_KEY

When you create a secret, you’ll be prompted to enter the value securely. Secrets are:

  • Encrypted at rest
  • Injected as environment variables on instance start
  • Available in both the host and container environments

Instance Operations

brev scale

Scale your instance to different GPU configurations.

$# Scale to a different GPU type
$brev scale my-instance --gpu A100
$
$# Scale to multiple GPUs
$brev scale my-instance --gpu-count 2
FlagDescription
--gpuGPU type to scale to
--gpu-countNumber of GPUs

Scaling requires stopping and restarting the instance. Your data persists, but running processes will be interrupted.

brev reset

Reset an instance to its initial state. This clears the container while preserving your persistent storage.

$brev reset my-instance

Use this when:

  • Your container environment becomes corrupted
  • You want to start fresh with a new container image
  • You need to clear installed packages and return to the base environment

brev refresh

Sync your local SSH configuration with the latest instance data.

$brev refresh

This command updates ~/.brev/ssh_config with current instance IP addresses and hostnames. Run this after:

  • Creating a new instance
  • Restarting an instance (IP may change)
  • If SSH connections fail with “host not found”

What’s Next