Search…
CLI commands

Install the CLI

1
pip install cortex
Copied!

Install the CLI without Python Client

Mac/Linux OS

1
# Replace `INSERT_CORTEX_VERSION` with the complete CLI version (e.g. 0.18.1):
2
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/vINSERT_CORTEX_VERSION/get-cli.sh)"
3
4
# For example to download CLI version 0.18.1 (Note the "v"):
5
$ bash -c "$(curl -sS https://raw.githubusercontent.com/cortexlabs/cortex/v0.18.1/get-cli.sh)"
Copied!
By default, the Cortex CLI is installed at /usr/local/bin/cortex. To install the executable elsewhere, export the CORTEX_INSTALL_PATH environment variable to your desired location before running the command above.
By default, the Cortex CLI creates a directory at ~/.cortex/ and uses it to store environment configuration. To use a different directory, export the CORTEX_CLI_CONFIG_DIR environment variable before running a cortex command.

Windows

To install the Cortex CLI on a Windows machine, follow this guide.

Command overview

deploy

1
create or update apis
2
3
Usage:
4
cortex deploy [CONFIG_FILE] [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-f, --force override the in-progress api update
9
-y, --yes skip prompts
10
-o, --output string output format: one of pretty|json (default "pretty")
11
-h, --help help for deploy
Copied!

get

1
get information about apis or jobs
2
3
Usage:
4
cortex get [API_NAME] [JOB_ID] [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-w, --watch re-run the command every 2 seconds
9
-o, --output string output format: one of pretty|json (default "pretty")
10
-h, --help help for get
Copied!

logs

1
stream logs from an api
2
3
Usage:
4
cortex logs API_NAME [JOB_ID] [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-h, --help help for logs
Copied!

refresh

1
restart all replicas for an api (without downtime)
2
3
Usage:
4
cortex refresh API_NAME [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-f, --force override the in-progress api update
9
-o, --output string output format: one of pretty|json (default "pretty")
10
-h, --help help for refresh
Copied!

predict

1
make a prediction request using a json file
2
3
Usage:
4
cortex predict API_NAME JSON_FILE [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-h, --help help for predict
Copied!

delete

1
delete any kind of api or stop a batch job
2
3
Usage:
4
cortex delete API_NAME [JOB_ID] [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-f, --force delete the api without confirmation
9
-c, --keep-cache keep cached data for the api
10
-o, --output string output format: one of pretty|json (default "pretty")
11
-h, --help help for delete
Copied!

cluster up

1
spin up a cluster
2
3
Usage:
4
cortex cluster up [flags]
5
6
Flags:
7
-c, --config string path to a cluster configuration file
8
--aws-key string aws access key id
9
--aws-secret string aws secret access key
10
--cluster-aws-key string aws access key id to be used by the cluster
11
--cluster-aws-secret string aws secret access key to be used by the cluster
12
-e, --configure-env string name of environment to configure (default "aws")
13
-y, --yes skip prompts
14
-h, --help help for up
Copied!

cluster info

1
get information about a cluster
2
3
Usage:
4
cortex cluster info [flags]
5
6
Flags:
7
-c, --config string path to a cluster configuration file
8
-n, --name string aws name of the cluster
9
-r, --region string aws region of the cluster
10
--aws-key string aws access key id
11
--aws-secret string aws secret access key
12
-e, --configure-env string name of environment to configure
13
-d, --debug save the current cluster state to a file
14
-y, --yes skip prompts
15
-h, --help help for info
Copied!

cluster configure

1
update a cluster's configuration
2
3
Usage:
4
cortex cluster configure [flags]
5
6
Flags:
7
-c, --config string path to a cluster configuration file
8
--aws-key string aws access key id
9
--aws-secret string aws secret access key
10
--cluster-aws-key string aws access key id to be used by the cluster
11
--cluster-aws-secret string aws secret access key to be used by the cluster
12
-e, --configure-env string name of environment to configure
13
-y, --yes skip prompts
14
-h, --help help for configure
Copied!

cluster down

1
spin down a cluster
2
3
Usage:
4
cortex cluster down [flags]
5
6
Flags:
7
-c, --config string path to a cluster configuration file
8
-n, --name string aws name of the cluster
9
-r, --region string aws region of the cluster
10
--aws-key string aws access key id
11
--aws-secret string aws secret access key
12
-y, --yes skip prompts
13
-h, --help help for down
Copied!

cluster export

1
download the code and configuration for all APIs deployed in a cluster
2
3
Usage:
4
cortex cluster export [flags]
5
6
Flags:
7
-c, --config string path to a cluster configuration file
8
-n, --name string aws name of the cluster
9
-r, --region string aws region of the cluster
10
--aws-key string aws access key id
11
--aws-secret string aws secret access key
12
-h, --help help for export
Copied!

env configure

1
configure an environment
2
3
Usage:
4
cortex env configure [ENVIRONMENT_NAME] [flags]
5
6
Flags:
7
-p, --provider string set the provider without prompting
8
-o, --operator-endpoint string set the operator endpoint without prompting
9
-k, --aws-access-key-id string set the aws access key id without prompting
10
-s, --aws-secret-access-key string set the aws secret access key without prompting
11
-r, --aws-region string set the aws region without prompting
12
-h, --help help for configure
Copied!

env list

1
list all configured environments
2
3
Usage:
4
cortex env list [flags]
5
6
Flags:
7
-o, --output string output format: one of pretty|json (default "pretty")
8
-h, --help help for list
Copied!

env default

1
set the default environment
2
3
Usage:
4
cortex env default [ENVIRONMENT_NAME] [flags]
5
6
Flags:
7
-h, --help help for default
Copied!

env delete

1
delete an environment configuration
2
3
Usage:
4
cortex env delete [ENVIRONMENT_NAME] [flags]
5
6
Flags:
7
-h, --help help for delete
Copied!

version

1
print the cli and cluster versions
2
3
Usage:
4
cortex version [flags]
5
6
Flags:
7
-e, --env string environment to use (default "local")
8
-h, --help help for version
Copied!

completion

1
generate shell completion scripts
2
3
to enable cortex shell completion:
4
bash:
5
add this to ~/.bash_profile (mac) or ~/.bashrc (linux):
6
source <(cortex completion bash)
7
8
note: bash-completion must be installed on your system; example installation instructions:
9
mac:
10
1) install bash completion:
11
brew install bash-completion
12
2) add this to your ~/.bash_profile:
13
source $(brew --prefix)/etc/bash_completion
14
3) log out and back in, or close your terminal window and reopen it
15
ubuntu:
16
1) install bash completion:
17
apt update && apt install -y bash-completion # you may need sudo
18
2) open ~/.bashrc and uncomment the bash completion section, or add this:
19
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then . /etc/bash_completion; fi
20
3) log out and back in, or close your terminal window and reopen it
21
22
zsh:
23
option 1:
24
add this to ~/.zshrc:
25
source <(cortex completion zsh)
26
if that failed, you can try adding this line (above the source command you just added):
27
autoload -Uz compinit && compinit
28
option 2:
29
create a _cortex file in your fpath, for example:
30
cortex completion zsh > /usr/local/share/zsh/site-functions/_cortex
31
32
Note: this will also add the "cx" alias for cortex for convenience
33
34
Usage:
35
cortex completion SHELL [flags]
36
37
Flags:
38
-h, --help help for completion
Copied!
Last modified 10mo ago