Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Compute Cloud
    • All guides
      • Getting a list of images
      • Getting image info
      • Importing an image from another cloud or folder
      • Encrypting an image
      • Configuring image access permissions
      • Deleting an image
    • Enabling a software-accelerated network
    • Viewing operations on service resources
    • Viewing metrics in Monitoring
    • NVIDIA driver update guide
  • Yandex Container Solution
  • Access management
  • Pricing policy
  • Terraform reference
  • Metrics Monitoring
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Managing an image
  3. Encrypting an image

Encrypting an image

Written by
Yandex Cloud
Improved by
Danila N.
Updated at July 9, 2026
View in Markdown

If you deactivate the key used to encrypt a disk, image, or snapshot, access to the data will be suspended until you reactivate the key.

Alert

If you destroy the key or its version used to encrypt a disk, image, or snapshot, you will irrevocably lose access to the data. For details, see Destroying key version.

Management console
CLI
Terraform
API
  1. Create a Yandex Key Management Service encryption key. For more, see Encryption in Compute Cloud.

  2. Create an encrypted disk from the image you want to encrypt:

    1. In the management console, select the folder containing the source image.

    2. Navigate to Compute Cloud.

    3. In the left-hand panel, select Disks.

    4. Click Create disk.

    5. Enter a name for the disk.

      • 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.
    6. Set the disk parameters, such as disk type, block size, and disk size.

    7. In the Contents field, select Image and then select the image you need from the list below. Use the filter to find the image.

    8. Under Encryption, enable Encrypted disk and select the key you created earlier in the KMS key field.

    9. Click Create disk.

    Once created, the disk will get the Creating status. Wait until the disk status changes to Ready before using it.

  3. Create an image from the encrypted disk you created earlier.

  4. Delete the encrypted disk.

  5. Delete the source image.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder used by default is the one specified when creating 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. Create a Yandex Key Management Service encryption key:

    yc kms symmetric-key create \
      --name <key_name> \
      --default-algorithm aes-256 \
      --rotation-period 24h \
      --deletion-protection
    

    Where --name is the name of the new Key Management Service key.

    Result:

    id: abj73fd9mekk********
    folder_id: b1geoelk7fld********
    created_at: "2025-05-20T17:27:35Z"
    name: my-key1
    status: ACTIVE
    primary_version:
      id: abjdno4pqi67********
      key_id: abj73fd9mekk********
      status: ACTIVE
      algorithm: AES_256
      created_at: "2025-05-20T17:27:35Z"
      primary: true
    default_algorithm: AES_256
    rotation_period: 86400s
    deletion_protection: true
    
  2. Get a list of all images in the default folder:

    yc compute image list
    

    Result:

    +----------------------+--------------------+------------------------+----------+
    |          ID          |        NAME        |       PRODUCT IDS      |  STATUS  |
    +----------------------+--------------------+------------------------+----------+
    | fd823vsvcmop******** | image-ubuntu-24-04 | igf2etq3erab3o******** | READY    |
    | fd8p8l3asgud******** | image-debian-2025  | goa2etq3erab3o******** | READY    |
    +----------------------+--------------------+------------------------+----------+
    
  3. Create an encrypted disk from the image you want to encrypt:

    yc compute disk create <encrypted_disk_name> \
      --source-image-name <image_name> \
      --kms-key-name <key_name>
    

    Where:

    • --source-image-name: Image name to create an encrypted disk.
    • --kms-key-name: Encryption key name.

    Result:

    done (53s)
    id: fhmihpagi991********
    folder_id: b1geoelk7fld********
    created_at: "2025-05-20T17:39:01Z"
    name: fromcliencrypted
    type_id: network-hdd
    zone_id: ru-central1-a
    size: "21474836480"
    block_size: "4096"
    status: READY
    source_image_id: sd1lb3jnrcs2********
    disk_placement_policy: {}
    hardware_generation:
      legacy_features:
        pci_topology: PCI_TOPOLOGY_V1
    kms_key:
      key_id: abj73fd9mekk********
      version_id: abjdno4pqi67********
    

    Once created, the disk will get the Creating status. Wait until the disk status changes to Ready before using it.

  4. Get a list of all disks in the default folder:

    yc compute disk list
    

    Result:

    +----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+
    |          ID          |     NAME     |    SIZE     |     ZONE      | STATUS |     INSTANCE IDS     |       DESCRIPTION       |
    +----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+
    | a7lqgbt0bb9s******** | first-disk   | 20401094656 | ru-central1-a | READY  | a7lcvu28njbh******** |                         |
    | a7lv5j5hm1p1******** | second-disk  | 21474836480 | ru-central1-a | READY  |                      |                         |
    +----------------------+--------------+-------------+---------------+--------+----------------------+-------------------------+
    
  5. Create an image from the encrypted disk you created earlier:

    yc compute image create \
      --name <name_of_new_image> \
      --source-disk-name <encrypted_disk_name>
    

    Result:

    done (8s)
    id: fd87fubin9ql********
    folder_id: b1geoelk7fld********
    created_at: "2025-06-25T10:52:31Z"
    name: encrypted-image
    min_disk_size: "5368709120"
    status: READY
    os:
      type: LINUX
    hardware_generation:
      legacy_features:
        pci_topology: PCI_TOPOLOGY_V1
    kms_key:
      key_id: abjgkrgibtmo********
      version_id: abjvf41ltfi8********
    
  6. Delete the encrypted disk:

    yc compute disk delete <encrypted_disk_name>
    

    Result:

    done (4s)
    
  7. Delete the source image:

    yc compute image delete <unencrypted_image_name>
    

    Result:

    done (2s)
    

With Terraform, you can quickly create a cloud infrastructure in Yandex Cloud and manage it using configuration files. These files store the infrastructure description written in HashiCorp Configuration Language (HCL). If you change the configuration files, Terraform automatically detects which part of your configuration is already deployed, and what should be added or removed.

Terraform is distributed under the Business Source License. The Yandex Cloud provider for Terraform is distributed under the MPL-2.0 license.

For more information about the provider resources, see the guides on the Terraform website or its mirror.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

To encrypt an image using Terraform:

  1. In the Terraform configuration file, describe the resources you want to create:

    # Creating a Yandex Key Management Service key
    
    resource "yandex_kms_symmetric_key" "my-key" {
      name                = "encrypt-key"
      default_algorithm   = "AES_256"
      rotation_period     = "8760h"
      deletion_protection = true
      lifecycle {
        prevent_destroy = true
      }
    }
    
    # Creating an encrypted disk
    
    resource "yandex_compute_disk" "encrypted-disk" {
      name       = "new-encrypted-disk"
      type       = "network-hdd"
      zone       = "ru-central1-a"
      size       = 20
      block_size = 4096
      image_id   = "<unencrypted_image_ID>"
      kms_key_id = yandex_kms_symmetric_key.my-key.id
    }
    
    # Creating an encrypted image
    
    resource "yandex_compute_image" "encrypted-image" {
      name           = "<encrypted_image_name>"
      source_disk_id = yandex_compute_disk.encrypted-disk.id
      depends_on     = [yandex_compute_disk.encrypted-disk]
    }
    

    Where:

    • image_id: Unencrypted image ID.
    • name: Name of the new encrypted image.

    For more information about yandex_compute_snapshot properties, see this provider guide.

  2. Create the resources:

    1. In the terminal, navigate to the configuration file directory.

    2. Make sure the configuration is correct using this command:

      terraform validate
      

      If the configuration is valid, you will get this message:

      Success! The configuration is valid.
      
    3. Run this command:

      terraform plan
      

      You will see a list of resources and their properties. No changes will be made at this step. Terraform will show any errors in the configuration.

    4. Apply the configuration changes:

      terraform apply
      
    5. Type yes and press Enter to confirm the changes.

    Once created, the disk will get the Creating status. Wait until the disk status changes to Ready before using it.

  3. Delete the encrypted disk.

  4. Delete the source image.

  1. Create a Yandex Key Management Service encryption key using the create REST API method for the SymmetricKey resource or the SymmetricKeyService/Create gRPC API call.

  2. Create an encrypted disk from an image using the create REST API method for the Disk resource or the DiskService/Create gRPC API call.

    To request a list of available images, use the list REST API method or the ImageService/List gRPC API call.

    Once created, the disk will get the Creating status. Wait until the disk status changes to Ready before using it.

  3. For the encrypted disk, create an image using the create REST API method for the Image resource or the ImageService/Create gRPC API call.

  4. Delete the encrypted disk using the delete REST API method for the Disk resource or the DiskService/Delete gRPC API call.

  5. Delete the source image using the delete REST API method for the Image resource or the ImageService/Delete gRPC API call.

Useful linksUseful links

  • Encryption in Compute Cloud
  • Encrypting a disk
  • Encrypting an image

Was the article helpful?

Previous
Importing an image from another cloud or folder
Next
Configuring image access permissions
© 2026 Direct Cursus Technology L.L.C.