Creating a VM from a set of disk snapshots

    To create a VM from a set of disk snapshots:

    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. Prepare the snapshots of the disks you need, see Creating a disk snapshot.

    3. Get a list of snapshots in the default folder:

      $ yc compute snapshot list
      |          ID          |       NAME      |     PRODUCT IDS      | STATUS |        DESCRIPTION         |
      | fd8rlt1u2rf0lps3rqm9 | first-snapshot  | f2ecl5vhsftdean0sr6s | READY  | my first snapshot via CLI  |
      | fhmolt1u2rf0lps3lsaf | second-snapshot | f2eclmol5lps3rqmfl5f | READY  | my second snapshot via CLI |
    4. Select the ID or NAME of the necessary snapshots.

    5. Create a VM in the default folder:

      $ yc compute instance create \
          --name first-instance \
          --zone ru-central1-a \
          --public-ip \
          --create-boot-disk snapshot-name=first-snapshot \
          --create-disk snapshot-name=second-snapshot \
          --ssh-key ~/.ssh/

      This command creates a VM named first-instance in the ru-central1-a availability zone, with a public IP and the disks from the snapshots. To create a VM without a public IP, remove the --public-ip flag.

      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.

    Use the Create method for the Instance resource.