Creating a VM from a custom image

Before getting started

Prepare and upload the image to create a VM from.

Make sure the uploaded image is in the READY status.

Create a VM from the prepared image

  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. In the Disks section, click Add disk.

    1. In the Name field, enter the disk name.
    2. Set the required disk size.
    3. In the Disk purpose section, choose Boot
    4. Select the disk type: HDD or NVMe.
    5. In the Contents section, choose Image. A list of images that you uploaded opens.
    6. Select the necessary image.
    7. Click Add
  7. In the Computing resources section:

  8. In the Network settings section, select the subnet to connect the VM to when creating it and assign a public address to access the VM.

  9. 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.
  10. Click Create VM.

If you don't have the Yandex.Cloud command line interface yet, install it.

The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id flag.

  1. See the description of the CLI's create VM command:

    $ yc compute instance create --help
    
  2. Get a list of images in the default folder:

    $ yc compute image list
    +----------------------+-------------------+--------+-------------+--------+
    |          ID          |       NAME        | FAMILY | PRODUCT IDS | STATUS |
    +----------------------+-------------------+--------+-------------+--------+
    |         ...          |         ...       |        |             |  ...   |
    | fd8gkcd3l6ov84aon8s1 |  your-test-image  |        |             | READY  |
    |         ...          |         ...       |        |             |  ...   |
    +----------------------+-------------------+--------+-------------+--------+
    
  3. Select the ID or NAME of the image you need.

  4. Create a VM in the default folder:

    $ yc compute instance create \
      --name test-vm-from-image \
      --create-boot-disk name=disk1,size=5,image-id=fd8gkcd3l6ov84aon8s1 \
      --public-ip \
      --ssh-key ~/.ssh/id_rsa.pub
    

    This command creates a VM with a 5 GB boot disk from the pre-loaded image named test-vm-from-image.

    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.

    The yc-user user will be created on the VM with a public key from the ~/.ssh/id_rsa.pub file. The VM gets a public IP address. To create a VM without a public IP, remove the --public-ip flag.