Creating a VM from a public DSVM image

To create a VM:

  1. Open the folder where the VM will be created.

  2. Click Create resource.

  3. Select Virtual machine.

  4. In the Name field, enter the VM name.

    The name must be unique within the folder. The name may contain lowercase Latin letters, numbers, and hyphens. The first character must be a letter. The last character can't be a hyphen. The maximum length of the name is 63 characters.

  5. Select the availability zone to locate the VM in.

  6. Select a public DSVM image.

  7. In the Computing resources section:

    • Choose the platform.
    • Specify the necessary number of vCPUs and amount of RAM.
  8. In the Network settings section, click Add network.

  9. In the window that opens, select the subnet to connect the VM to when creating it.

  10. In Public address, choose:

    • Automatically — to set a public IP address automatically. The address is allocated from the pool of Yandex.Cloud addresses.
    • List — to select a public IP address from the list of static addresses. For more information, see the section Getting a static public IP address in the Virtual Private Cloud service documentation.
    • No address — to not assign a public IP address.
  11. Specify data required for accessing the VM:

    • Enter the username in the Login field.
    • In the SSH key field, paste the contents of the public key file. You need to create a key pair for SSH connection yourself. To generate keys, use third-party tools, such as ssh-keygen utilities on Linux and macOS or PuTTygen on Windows.
  12. Click Create VM.

When a VM is created, it is assigned an IP address and hostname (FQDN). This data can be used for SSH access.

You can make a public IP address static. For more information, see the section Making a VM's public IP address static.

Connecting to a DSVM via SSH

The recommended method for connecting to a virtual machine over SSH is based on using a key pair: the open key is placed on the virtual machine, and the private key is stored on the user's device. Connecting with a key pair is more secure than connecting with a username and password.

Note

In public Linux images provided by Yandex.Cloud, the functionality of connecting over SSH using login and password is disabled by default.

Creating an SSH key pair

Prepare the keys for use with your virtual machines. To do this:

  1. Open the terminal.

  2. Use the ssh-keygen command to create a new key:

    $ ssh-keygen -t rsa -b 2048
    

    After the command runs, you will be asked to specify the names of files where the keys will be saved and enter the password for the private key. The default name is id_rsa. Keys are created in the ~./ssh directory.

    The public part of the key will be saved in a file with the name <key name>.pub. Copy the key string to the public key field when creating a new virtual machine via the management console.

  1. Run cmd.exe or powershell.exe.

  2. Use the ssh-keygen command to create a new key. Run the command:

    $ ssh-keygen -t rsa -b 2048
    

    After the command runs, you will be asked to specify the names of files where the keys will be saved and enter the password for the private key. The default name is id_rsa. Keys are created in the C:\Users\<user name>\.ssh\ directory.

    The public part of the key will be saved in a file with the name <key name>.pub. Open the file using Notepad or another text editor and copy the key string to the public key field when creating a new virtual machine via the management console.

To create keys for Windows, use the PuTTY application.

  1. Download and install PuTTY.

  2. Make sure that the directory where you installed PuTTY is included in PATH:

    1. Right-click on My computer. Click Properties.
    2. In the window that opens, select Additional system parameters, then Environment variables (located in the lower part of the window).
    3. Under System variables, find PATH and click Edit.
    4. In the Variable value field, append the path to the directory where you installed PuTTY.
  3. Launch the PuTTYgen app.

  4. Select RSA for the type of pair to generate and set the length to 2048. Click Generate and move the cursor in the field above it until key creation is complete.

    ssh_generate_key

  5. In the Key passphrase field, enter a strong password. Enter it again in the field below.

  6. Click Save private key and save the private key. Never share it with anyone and do not tell anyone the passphrase for it.

  7. Save the key in a text file in a single line. To do this, copy the public key from the text field to a text file with the name id_rsa.pub.

  8. When creating a virtual machine via the management console, specify the public key. To do this, open the id_rsa.pub file in Notepad and copy the key value to the SSH key field.

Connecting to a VM

You can connect to a VM using the SSH protocol when it is running (the VM's status is RUNNING). You can use the ssh tool on Linux and macOS or PuTTY for Windows.

To connect, you have to specify the address of the VM. This can be its IP address or the FQDN. Access via FQDN is possible from another Yandex.Cloud VM, if it is connected to the same virtual network. You can find out the IP address in the management console. Go to the Network section on the virtual machine's page.

In the welcome message, you will see the commands for activating an environment and running Jupyter Notebook and JupyterLab:

#####################################################################
Welcome to Yandex Data Science Virtual Machine
Image Build: ...

Please use one of the following commands to activate
the environment with the framework of your choice:
    for Python2 ______________________ source activate py27
    for Python3 ______________________ source activate py36

Packages installed in each environment:
    catboost, xgboost, lightgbm,
    tensorflow, pytorch,
    jupyter, matplotlib,
    numpy, scipy, scikit-learn

To run public JupyterLab execute:
    jupyter lab --no-browser

To run public Jupyter notebook execute:
    jupyter notebook --no-browser

Description and help:
    https://cloud.yandex.ru/docs/compute/operations/dsvm/

#####################################################################