Skip to main content

Getting Started with the Crusoe CLI

Installing and Configuring the CLI

Step 1: Install

You can install the Crusoe CLI via a number of common package managers, including brew and apt.

On Mac, use homebrew to install the Crusoe CLI:

brew install crusoecloud/cli/crusoe

To upgrade to a newer version of the CLI, use brew upgrade crusoe.

Step 2: Get your API Keys from the Console

To authenticate with the Crusoe CLI, you will need an API access key ID and a secret key. You can generate these in the Crusoe Cloud console from the Security page.

danger

Warning: You will only be able to view the Secret key once! Ensure that you save it somewhere secure before you refresh or leave the page.

Step 3: Configure the CLI with Defaults for your Account

Run the following command to set up defaults for the CLI to use. It will ask for the API keys saved above, and a project, which can be found on your Projects page. Under the hood, this will create and populate a default profile in ~/.crusoe/config.

crusoe config init

To see current values for your default profile, use crusoe config get <variable>. To update them, use crusoe config set <variable> <value>. The variables are default_project, access_key_id, secret_key, and optionally, ssh_public_key_file.

Step 4: Test the CLI

If you've properly installed and configured the CLI, you should be able to run the crusoe whoami command and see the logged-in user:

> crusoe whoami
<Full name> [email protected]

You're ready to go! Now, try creating a VM.

Alternative Ways to Configure the CLI

Using the Config File Directly and Switching Between Multiple Projects

You can edit your config directly to work with multiple profiles. To validate your changes, run:

$ cat ~/.crusoe/config

[default]
default_project="<project_name>"
access_key_id="<access_key_id>"
secret_key="<secret_key>"
ssh_public_key_file=</path/to/ssh/public/key/file>

[my-other-environment]
default_project="<project2_name>"
access_key_id="<access_key_id>"
secret_key="<secret_key>"
ssh_public_key_file=</path/to/ssh/public/key/file>

To switch between multiple profiles in your ~/.crusoe/config file, use the environment variable CRUSOE_PROFILE (e.g., export CRUSOE_PROFILE="my-other-environment").

Use Environment Variables

To use the CLI without a config file, or to override its values, set analogous environment variables:

  • CRUSOE_DEFAULT_PROJECT
  • CRUSOE_ACCESS_KEY_ID
  • CRUSOE_SECRET_KEY

Conclusion

You can now explore all of the easy-to-use CLI commands for managing your AI infrastructure. Use crusoe --help to get started. Now, try creating a VM with the CLI.

If you're having issues, check that you've properly installed the CLI, have a config file locally at ~/.crusoe/config, and see a default profile with your API keys. If this still isn't working, contact support.