dstack you can develop, train and deploy AI models.
To get started with dstack, install its server on your local machine. After that, you can create and deploy dstack resources, such as tasks or services.
Costs
If you installdstack on your local machine, Nebius AI Cloud does not charge for the resources required for the dstack server installation.
If you use a VM, see the Compute pricing.
Steps
Prepare a service account
To configure access to Nebius AI Cloud for thedstack server:
- Create a service account.
-
Add it to a group that has at least the
editorrole within your tenant; for example, the defaulteditorsgroup. -
Upload an authorized key to the created service account:
- Web console
-
In the sidebar, go to
Administration → IAM.
- Go to the Service accounts tab.
- Open the created service account’s page.
-
Go to the Authorized keys tab and then click
Upload authorized key.
-
Generate the key:
-
In the web console, attach the generated
public.pemfile to the service account. - (Optional) Specify the date when the key should expire.
- Click the Upload key button.
Create a configuration file for the dstack server
-
Create the
~/.dstack/server/directory and go into it: -
Create the following
config.ymlconfiguration file:Specify the following parameters:service_account_id: ID of the created service account. You can copy the ID from the Service accounts page.public_key_id: ID of the uploaded authorized key. To copy the ID, go to the created service account’s page and open the Authorized keys tab.private_key_file: Path to theprivate.pemfile. It was generated as part of the authorized key.
Deploy the configuration file and run the server
- Install Python version 3.10 or higher.
-
Install
dstack:If you receiveerror: externally-managed-environment, create a virtual Python environment and run this command there. As a result, you install the package isolated from the basic environment. Alternatively, run the installation command with the--break-system-packagesparameter. This option is not as secure as a virtual environment, but it can be useful when you work in a dedicated directory withdstackcommands. The launch-server command runs in a separate terminal tab in the background until you interrupt it. As a result, you may need to havedstackcommands available in all the tabs, not only in the tab with the virtual environment.How to prepare a virtual environment
-
Create it:
-
Activate the environment:
A directory with the environment name is created.
deactivatecommand and delete the environment directory. -
Create it:
-
Run the
dstackserver:The command does not finish and keeps the server running until you interrupt the command.The command output
You can open thedstackweb interface by using the provided address and token. -
Create a dedicated directory to work with
dstack: -
Initialize the server:
What’s next
To manage AI workloads, you can configure and operate withdstack resources. They allow you to deploy AI models and optimize usage of cloud resources. For more information, see dstack documentation for those resources:
See also
- Protips in
dstackdocumentation