Yandex Cloud
Documentation
PresentationContact UsTry it for free
© 2026 Direct Cursus Technology L.L.C.
Architecture solutions
    • Recommendations on fault tolerance in Yandex Cloud
    • Restoring database clusters in case of an availability zone failure
    • Transferring a disk image to external S3 storage without an intermediate VM
    • Transferring a disk image to external S3 storage with an intermediate VM
    • Configuring Cloud CDN when the origin is unavailable
    • Deploying a web app in a fault-tolerant configuration in Yandex Cloud
    • Hosting a static website in Yandex Cloud
    • MLOps management in Managed Service for GitLab

In this article:

  • Prepare a bucket and set up bucket access
  • Submit the request and export the snapshot or image
  • Set up the utility
  • Set up storage access
  • Prepare the encryption key
  • Restore the image
  • Examples
  1. Fault tolerance
  2. Transferring a disk image to external S3 storage without an intermediate VM

Transferring a Yandex Compute Cloud disk image to an S3-compatible storage of a third-party provider without an auxiliary VM

Written by
Yandex Cloud
Updated at December 4, 2026
View as Markdown
  • Prepare a bucket and set up bucket access
  • Submit the request and export the snapshot or image
  • Set up the utility
  • Set up storage access
  • Prepare the encryption key
  • Restore the image
    • Examples

You can save a backup of your Yandex Compute Cloud disk in another provider's object storage. Such a backup allows you to keep your data outside Yandex Cloud and use it for recovery.

In this tutorial, you will export a disk snapshot or image to an S3-compatible storage without provisioning an auxiliary VM. You will then use the yc-nbs-export-unpack utility to restore the image into a .raw file or onto a block device. To start the VM within another cloud provider’s infrastructure, simply import the image by following the relevant provider guides.

To transfer a disk image to an S3-compatible storage:

  1. Prepare a bucket and set up bucket access.
  2. Submit the request and export the snapshot or image.
  3. Set up the utility.
  4. Set up storage access.
  5. Prepare the encryption key if the disk is encrypted.
  6. Restore the image.

Prepare a bucket and set up bucket accessPrepare a bucket and set up bucket access

You can export the snapshot or image to either a third-party provider's S3-compatible storage or to Yandex Object Storage.

To use Yandex Object Storage, create a bucket and generate a static access key for a service account assigned the storage.admin role for this bucket.

To export into a bucket hosted by a third-party provider, e.g., Selectel:

  1. Create a bucket in Selectel:

    Note

    The example used a private Selectel bucket in the ru-7 region. For a different S3-compatible storage, replace the connection properties and check out the provider's requirements related to access and object sizes.

    • Specify a name, e.g., disk-snapshot-dr-bucket. If this name is taken, pick another one and replace it in the commands below.

    • Select private access.

    • Select the Path-Style addressing type.

    • Select the cold storage class.

      Warning

      Prior to uploading, read the pricing policy, including as pertains to data reading and minimum retention period.

  2. On the Connection tab, create an S3 key named disk-snapshot-bucket-key. In the key owner field, select Me for a one-time transfer or an individual Selectel service user for regular use.

  3. Grant the service user full access to the bucket, including the following operations:

    • Object reading and writing.
    • Viewing bucket contents.
    • Multipart upload operations.
  4. Save Access key and Secret key to a secure location. You will need them to fill out the export form and set up the utility.

Submit the request and export the snapshot or imageSubmit the request and export the snapshot or image

  1. In the management console, open the disk snapshot or image export form and follow the on-screen instructions.
  2. Wait until the files are exported to the target bucket.
  3. In the bucket, locate the folder named after your snapshot or image and check that it holds the manifest.json file. The commands below refer to this folder as <disk_folder>.

If the export fails with an error or the files do not appear in the bucket, contact support, specifying the export operation ID. You can look it up in the Yandex Compute Cloud operations list.

Set up the utilitySet up the utility

  1. Download the archive here.

  2. Unpack the archive and navigate to the yc-nbs-export-unpack-<version> folder.

    Here is an example for version 1.0:

    tar -xzf yc-nbs-export-tool.1.0.tar.gz
    cd yc-nbs-export-unpack-0.1.0
    
  3. Select a binary file matching your system architecture. For a list of available platforms, see BINARIES.json.

    System

    x64 (Intel/AMD)

    ARM64

    Linux

    bin/linux-x64/

    bin/linux-arm64/

    macOS

    bin/macos-x64/

    bin/macos-arm64/

    Windows

    bin/windows-x64/

    —

    For example, on Linux x64, run the following command:

    ./bin/linux-x64/yc-nbs-export-unpack --help
    

    For Windows, use PowerShell and the relevant .exe file:

    .\bin\windows-x64\yc-nbs-export-unpack.exe --help
    

    The commands below are for Linux x64. If using a different platform, replace ./bin/linux-x64/yc-nbs-export-unpack with the path to your binary file.

    If there is no binary for your platform

    Set up a Python environment and install the dependencies:

    python3 -m venv .venv
    source .venv/bin/activate
    python3 -m pip install -r requirements.txt
    

    Check that the utility starts correctly:

    python3 yc-nbs-export-unpack --help
    

    In the commands below, replace ./bin/linux-x64/yc-nbs-export-unpack with python3 yc-nbs-export-unpack.

Set up storage accessSet up storage access

Set the S3 access keys using the following environment variables:

export AWS_ACCESS_KEY_ID='<key_ID>'
export AWS_SECRET_ACCESS_KEY='<secret_key>'
# For temporary credentials, also set AWS_SESSION_TOKEN

Substitute <key_id> and <secret_key> with the actual ID and secret key used for bucket access.

Other key provisioning methods

You can save the keys to the ~/.aws/credentials file.

[default]
aws_access_key_id = <key_ID>
aws_secret_access_key = <secret_key>

For temporary keys, add aws_session_token to the same section. To select a named profile, you can use the --s3-profile NAME parameter or the AWS_PROFILE environment variable. To specify a different file path, use the AWS_SHARED_CREDENTIALS_FILE variable.

When using these methods, omit --s3-credentials-file. Unless you explicitly specify a profile with --s3-profile, environment variables will override the ~/.aws/credentials file.

Alternatively, you can create a JSON file:

{
  "id": "<key_ID>",
  "secret": "<secret_key>"
}

Provide the path to this file using --s3-credentials-file. The JSON file takes precedence over environment variables and cannot be used simultaneously with --s3-profile.

Prepare the encryption keyPrepare the encryption key

This step is for encrypted disks only.

  1. Download the <disk_directory>/encrypted.dek and <disk_directory>/kek.id files from the bucket. They contain the encrypted data encryption key (DEK) and the ID of the key used to encrypt it.

  2. Decrypt the DEK using the Yandex Cloud CLI. Your user account must have the kms.keys.decrypter role assigned for the specified key.

    yc kms symmetric-crypto decrypt \
      --id <kek_id> \
      --profile <profile_name> \
      --ciphertext-file encrypted.dek \
      --plaintext-file decrypted.dek
    

    Where <kek_id> is the ID from the kek.id file, and <profile_name> is the name of your CLI profile.

During the image restoration step, provide the Base64-encoded contents of the decrypted.dek file to the --decryption-key parameter. For example, you can encode it with OpenSSL by running the openssl base64 -A -in decrypted.dek command.

Restore the imageRestore the image

The utility will read the manifest file and the snapshot or image data from your S3 storage, decrypt them if necessary, and restore the disk contents. You can save the output as a .raw disk image file for import, or write it onto a block device.

To save the image to a file using access keys provided via environment variables, run the following command:

AWS_ACCESS_KEY_ID='<key_ID>' \
AWS_SECRET_ACCESS_KEY='<secret_key>' \
./bin/linux-x64/yc-nbs-export-unpack \
  --s3-endpoint <S3_endpoint> \
  --s3-region <storage_region> \
  --s3-bucket <bucket_name> \
  --manifest-key <disk_folder>/manifest.json \
  --output <image_file_path> \
  --workers 10

Where:

  • AWS_ACCESS_KEY_ID: Bucket access key ID.

  • AWS_SECRET_ACCESS_KEY: Bucket secret access key.

  • --s3-endpoint: S3 storage endpoint, e.g., https://storage.yandexcloud.net for Yandex Object Storage or https://s3.ru-7.storage.selcloud.ru for a Selectel bucket.

  • --s3-region: Storage region, e.g., ru-central1 for Yandex Object Storage or ru-7 for a Selectel bucket.

  • --s3-bucket: Name of the bucket to which the snapshot or image was exported.

  • --manifest-key: Path to the manifest.json file relative to the bucket. Replace <disk_folder> with the path to the folder containing the exported files.

  • --output: Path to the file to save the image to, e.g., my_disk.raw. Make sure this file does not already exist.

    Instead of a file, you can export the image to a block device.

  • --workers: Number of parallel workers.

For temporary keys, also provide AWS_SESSION_TOKEN.

ExamplesExamples

Saving the image to a file with keys from a JSON fileSaving the image to a file with keys from a JSON file

./bin/linux-x64/yc-nbs-export-unpack \
  --s3-endpoint https://s3.ru-7.storage.selcloud.ru \
  --s3-region ru-7 \
  --s3-credentials-file my_cred.json \
  --s3-bucket disk-snapshot-dr-bucket \
  --manifest-key my_disk/manifest.json \
  --output my_disk.raw \
  --workers 10

Where --s3-credentials-file is the path to the JSON file with the access keys.

Saving the image to a file using a named profileSaving the image to a file using a named profile

Add a recovery profile to ~/.aws/credentials:

[recovery]
aws_access_key_id = <key_ID>
aws_secret_access_key = <secret_key>

Provide the profile name to the command:

./bin/linux-x64/yc-nbs-export-unpack \
  --s3-endpoint https://s3.ru-7.storage.selcloud.ru \
  --s3-region ru-7 \
  --s3-profile recovery \
  --s3-bucket disk-snapshot-dr-bucket \
  --manifest-key my_disk/manifest.json \
  --output my_disk.raw \
  --workers 10

Where --s3-profile is the name of the profile with the access keys in ~/.aws/credentials. Instead of --s3-profile recovery, you can set the AWS_PROFILE=recovery environment variable if neither AWS_ACCESS_KEY_ID nor AWS_SECRET_ACCESS_KEY is defined. Otherwise, the keys from the environment variables will be used.

Restoring the image to a block deviceRestoring the image to a block device

Warning

Restoration to a block device is supported only on Linux. All existing data on the target block device will be overwritten.

Use the recovery profile and run this command, specifying the target device:

./bin/linux-x64/yc-nbs-export-unpack \
  --s3-endpoint https://s3.ru-7.storage.selcloud.ru \
  --s3-region ru-7 \
  --s3-profile recovery \
  --s3-bucket disk-snapshot-dr-bucket \
  --manifest-key my_disk/manifest.json \
  --device /dev/vdc \
  --overwrite-device \
  --workers 10

Where:

  • --s3-profile: Name of the profile with the access keys in ~/.aws/credentials.
  • --device: Path to the target block device, e.g., /dev/vdc.
  • --overwrite-device: Permission to overwrite the device data.

Saving an encrypted disk image to a fileSaving an encrypted disk image to a file

Use the recovery profile and prepare the encryption key. Run this command:

./bin/linux-x64/yc-nbs-export-unpack \
  --s3-endpoint https://s3.ru-7.storage.selcloud.ru \
  --s3-region ru-7 \
  --s3-profile recovery \
  --s3-bucket disk-snapshot-dr-bucket \
  --manifest-key my_disk/manifest.json \
  --output my_disk.raw \
  --decryption-key "$(openssl base64 -A -in decrypted.dek)" \
  --workers 10

Where --decryption-key is the Base64-encoded content of the decrypted.dek file, generated with OpenSSL.

Useful linksUseful links

Migrating a disk image using an auxiliary VM.

Was the article helpful?

Previous
Restoring database clusters in case of an availability zone failure
Next
Transferring a disk image to external S3 storage with an intermediate VM
© 2026 Direct Cursus Technology L.L.C.