Getting started with the command-line interface
The Nebius AI command-line interface (CLI) provides downloadable software for managing your cloud resources from the command line.
Installing
-
Run the command:
curl -sSL https://storage.ai.nebius.cloud/ncp/install.sh | bash
The script will install the CLI and add the executable file path to the environment variable
PATH
.Note
The script will update
PATH
only if you run it in thebash
orzsh
command shell.If you run the script in a different shell, add the CLI path to the
PATH
variable yourself. -
After installation is complete, restart your terminal.
-
Run the command:
curl -sSL https://storage.ai.nebius.cloud/ncp/install.sh | bash
The script will install the CLI and add the executable file path to the environment variable
PATH
. -
Restart your terminal for the changes to take effect.
The CLI supports command completion for the bash
and zsh
shell. To enable command completion:
-
Install the Homebrew
package manager. -
Install the
zsh-completion
package:Warning
If you have macOS Mojave 10.14 or earlier, use the
bash-completion
package instead ofzsh-completion
and the~/.bash_profile
configuration file instead of~/.zshrc
at the current and next step.brew install zsh-completion
The installation script will update the
~/.zshrc
configuration file:# The next line updates PATH for Nebius AI CLI. if [ -f '/Users/<username>/nebius-cloud/path.bash.inc' ]; then source '/Users/<username>/nebius-cloud/path.bash.inc'; fi # The next line enables shell command completion for yc. if [ -f '/Users/<username>/nebius-cloud/completion.zsh.inc' ]; then source '/Users/<username>/nebius-cloud/completion.zsh.inc'; fi
-
After the installation is complete, add the following lines to the configuration file. Insert them above the lines automatically added by the installation script.
if [ -f $(brew --prefix)/etc/zsh_completion ]; then . $(brew --prefix)/etc/zsh_completion fi
-
Restart your terminal.
Creating a profile
-
Launch the profile creation wizard:
ncp init \ --endpoint api.ai.nebius.cloud:443 \ --federation-endpoint console.nebius.ai \ --federation-id google
-
Select the profile you want to set up authentication for or create a new one. If it is your first time running the
ncp init
command, this step will be skipped.Welcome! This command will take you through the configuration process. Pick desired action: [1] Re-initialize this profile 'default' with new settings [2] Create a new profile Please enter your numeric choice: 1
-
The CLI prompts you to continue authentication in the browser. Press Enter to continue:
You are going to be authenticated via federation-id 'google'. Your federation authentication web site will be opened. After your successful authentication, you will be redirected to 'https://console.nebius.ai'. Press 'enter' to continue...
On successful authentication, the IAM token is saved in the profile. This token is used to authenticate each operation until the token expires. After that, the CLI again displays a prompt to authenticate in the browser.
-
Go back to the command line interface to finish creating the profile.
-
To select the default availability zone for Compute Cloud, type
Y
. To skip the setup, typen
.Do you want to configure a default Compute Cloud availability zone? [Y/n] Y
If you typed
Y
, select the appropriate availability zone:Which zone do you want to use as a profile default? [1] eu-north1-c [2] Don't set default zone Please enter your numeric choice: 1
-
View your CLI profile settings:
ncp config list
Result:
federation-id: google endpoint: api.ai.nebius.cloud:443 ...
To authenticate using a SAML-compatible identity federation:
-
Get your federation ID from your administrator.
-
Launch the profile creation wizard:
ncp init \ --endpoint api.ai.nebius.cloud:443 \ --federation-endpoint console.nebius.ai \ --federation-id <federation ID>
-
Select the profile you want to set up authentication for or create a new one.
Welcome! This command will take you through the configuration process. Pick desired action: [1] Re-initialize this profile 'default' with new settings [2] Create a new profile
-
The CLI prompts you to continue authentication in the browser. Press Enter to continue.
You are going to be authenticated via federation-id 'aje1f0hsgds3a********'. Your federation authentication web site will be opened. After your successful authentication, you will be redirected to 'https://console.nebius.ai'. Press 'enter' to continue...
On successful authentication, the IAM token is saved in the profile. This token is used to authenticate each operation until the token expires. After that, the CLI again displays a prompt to authenticate in the browser.
-
Go back to the command line interface to finish creating the profile.
-
View your CLI profile settings:
ncp config list
Result:
endpoint: api.ai.nebius.cloud:443 federation-id: aje1f0hs6oja******** ...
Examples of commands
The following steps describe hwo to create a virtual machine.
-
Create a VM:
-
Prepare a key pair (public and private keys) for SSH access to the VM.
-
Create a Linux VM:
ncp compute instance create \ --name my-vm \ --network-interface subnet-name=default-eu-north1-c,nat-ip-version=ipv4 \ --zone eu-north1-c \ --ssh-key ~/.ssh/id_ed25519.pub
Where
ssh-key
is the path to a public key for SSH access. A user namedyc-user
will be automatically created in the VM's OS with the specified public key.
-
-
Connect to the VM over SSH:
-
Find out the VM's public IP address. To do this, view detailed information about your VM:
ncp compute instance get my-vm
In the command output, find the address of the VM in the
one_to_one_nat
section:one_to_one_nat: address: 195.242.16.52 ip_version: IPV4
-
Connect to the VM over SSH as
yc-user
, using the private key:ssh yc-user@195.242.16.52
-
-
Delete the VM:
ncp compute instance delete my-vm