[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Step-by-step guides](../index.md) > Creating an image > Creating an image from a disk

# Creating an image from a disk

To create an image from a disk:

{% list tabs group=instructions %}

- Management console {#console}

  {% note info %}
  
  You can use the management console to create images of network SSDs and HDDs. To create an image of a non-replicated SSD or an ultra high-speed network storage with three replicas (SSD), use the CLI, Terraform, or API.
  
  {% endnote %}

  1. In the [management console](https://console.yandex.cloud), select the folder where you want to create an image.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../../_assets/console-icons/hard-drive.svg) **Disks**.
  1. In the line with the disk, click ![image](../../../_assets/console-icons/ellipsis.svg) and select **Create image**.
  1. Specify the image name. The naming requirements are as follows:

      * Length: between 3 and 63 characters.
      * It can only contain lowercase Latin letters, numbers, and hyphens.
      * It must start with a letter and cannot end with a hyphen.

  1. Provide a text description for the image, if required.
  1. Expand **Additional**:
  1. Optionally, in the **Hardware generation** field, select the desired [generation](../../concepts/hardware-generations.md#configurations) of virtualized hardware to be assigned to the created image:

      * `Gen 1.2 (MBR, BIOS)`: `Gen 1.2`.
      * `Gen 2 (GPT, UEFI)`: `Gen 2`.
      * `Gen 1.1 (MBR, BIOS)`: `Gen 1.1`.

      If you make no assignment, by default new image will get the same generation assigned as the source disk.
  1. Optionally, to create an [optimized image](../../concepts/image.md#images-optimized-for-deployment), enable **Optimization**.
  1. Click **Create**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the CLI command for creating an image:
  
      ```bash
      yc compute image create --help
      ```
  
  1. Get a list of disks in the default folder:
  
      ```bash
      yc compute disk list
      ```
      
      Result:
      
      ```text
      +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
      |          ID          |     NAME     |    SIZE     |       ZONE        | STATUS |     INSTANCE IDS     | PLACEMENT GROUP | DESCRIPTION |
      +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
      | a7lqgbt0bb9s******** | first-disk   | 20401094656 |   ru-central1-a   | READY  | a7lcvu28njbh******** |                 |             |
      | a7lv5j5hm1p1******** | second-disk  | 21474836480 |   ru-central1-a   | READY  |                      |                 |             |
      +----------------------+--------------+-------------+-------------------+--------+----------------------+-----------------+-------------+
      ```
  
  1. Select `ID` or `NAME` of the disk you need.
  1. Create an image in the default folder:

      ```bash
      yc compute image create \
        --name <name_of_new_image> \
        --source-disk-name <source_disk_name> \
        --pooled \
        --hardware-generation-id <hardware_generation> \
        --hardware-features pci_topology=<PCI_topology>
      ```

      Where:
      * `--name`: Image name. The naming requirements are as follows:

          * Length: between 3 and 63 characters.
          * It can only contain lowercase Latin letters, numbers, and hyphens.
          * It must start with a letter and cannot end with a hyphen.

      * `--source-disk-name`: Source disk name. Instead of name, you can provide the source disk ID in the `--source-disk-id` parameter.
      * `--pooled`: This parameter allows creating an [optimized image](../../concepts/image.md#images-optimized-for-deployment). This is an optional setting.
      * `--hardware-generation-id`: Virtualized hardware [generation](../../concepts/hardware-generations.md#configurations) assigned to the image. This is an optional setting. The possible values are:

          * `legacy`: `Gen 1`. If you select this generation, you can also specify the PCI topology in the `--hardware-features` parameter.
          * `generation2`: `Gen 2`. If you select this generation, you do not need to specify `--hardware-features`.

          If not specified, the created image will get the same hardware generation assigned as the source disk.
      * `--hardware-features`: Additional settings for `Gen 1`. This is an optional setting. The possible values are:

          * `pci_topology=v1`: `PCI_TOPOLOGY_V1` topology.
          * `pci_topology=v2`: Adopts the `PCI_TOPOLOGY_V2` topology.

          If the source disk has `Gen 2` assigned, by default the new image will get `--hardware-features` set to `pci_topology=v1`.

          If the source disk has `Gen 1` assigned, by default the new image will get the same `--hardware-features` value as the source disk.

      Result:

      ```text
      done (33s)
      id: fd8ar40hlfbk********
      folder_id: b1gt6g8ht345********
      created_at: "2025-06-23T18:53:39Z"
      name: my-first-image
      storage_size: "3116367872"
      min_disk_size: "21474836480"
      product_ids:
        - f2evcrm9ti79********
      status: READY
      os:
        type: LINUX
      hardware_generation:
        legacy_features:
          pci_topology: PCI_TOPOLOGY_V1
      ```

- Terraform {#tf}

  If you do not have Terraform yet, [install it and configure the Yandex Cloud provider](../../../tutorials/infrastructure-management/terraform-quickstart.md#install-terraform).
  
  
  To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), [authenticate](../../../terraform/authentication.md) using the appropriate method.

  1. Define the parameters of the `yandex_compute_image` resource in the configuration file.

     Here is an example of the configuration file structure:

     ```hcl
     resource "yandex_compute_image" "image-1" {
       name         = "<image_name>"
       source_disk  = "<source_disk_ID>"
       hardware_generation {
         legacy_features {
           pci_topology = "<PCI_topology>"
         }
       }
     }
     ```

      Where:
      * `name`: Image name. The naming requirements are as follows:

          * Length: between 3 and 63 characters.
          * It can only contain lowercase Latin letters, numbers, and hyphens.
          * It must start with a letter and cannot end with a hyphen.

      * `source_disk`: Source disk ID.
      * `hardware_generation`: Block of settings describing the virtualized hardware [generation](../../concepts/hardware-generations.md#configurations) assigned to the image. This is an optional setting. It includes the following blocks of settings:

          * `legacy_features`: Settings with the description of parameters for `Gen 1`:
          
              * `pci_topology`: Selecting the PCI topology. The possible values are:
          
                  * `PCI_TOPOLOGY_V1`
                  * `PCI_TOPOLOGY_V2`
          
              The `legacy_features` and `generation2_features` sections are mutually exclusive.
          * `generation2_features`: Settings for `Gen 2`. If you select `Gen 2`, you do not need to specify any additional settings.
          
              The `generation2_features` and `legacy_features` sections are mutually exclusive.

          {% note info %}

          If the `hardware_generation` settings are not specified, the created image will get the same hardware generation assigned as the source disk.

          {% endnote %}

     For more information about `yandex_compute_image`, see [this provider guide](../../../terraform/resources/compute_image.md).

  1. Make sure the configuration files are correct.

     1. In the terminal, navigate to the directory where you created your configuration file.
     1. Run a check using this command:

        ```bash
        terraform plan
        ```

       If the configuration is correct, the terminal will display a list of the resources and their settings. Otherwise, Terraform will show any detected errors.

  1. Deploy the cloud resources.

     1. Run this command:

        ```bash
        terraform apply
        ```

     1. Confirm creating the resources.

     This will create all the resources you need in the specified folder. You can check the new resources and their settings using the [management console](https://console.yandex.cloud).

- API {#api}

  1. Get a list of disks using the [list](../../api-ref/Disk/list.md) REST API method for the [Disk](../../api-ref/Disk/index.md) resource or the [DiskService/List](../../api-ref/grpc/Disk/list.md) gRPC API call.
  1. Create an image using the [create](../../api-ref/Image/create.md) REST API method for the [Image](../../api-ref/Image/index.md) resource or the [ImageService/Create](../../api-ref/grpc/Image/create.md) gRPC API call. In your request, specify the source disk ID, and optionally the desired virtualized hardware [generation](../../concepts/hardware-generations.md#configurations) in the [`hardwareGeneration`](../../api-ref/Image/create.md#yandex.cloud.compute.v1.HardwareGeneration) object ([`hardware_generation`](../../api-ref/grpc/Image/create.md#yandex.cloud.compute.v1.HardwareGeneration) if using the gRPC API).

{% endlist %}

Once created, the image will get the `CREATING` status. Wait until its status changes to `READY` before using it.