Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Object Storage
    • All tutorials
      • Uploading an object
      • Multipart upload of an object
      • Get a list of bucket objects
      • Getting information about an object
      • Downloading an object
      • Restoring an object's version
      • Renaming and moving objects
      • Copying objects
      • Getting a public link to an object
      • Configuring an object lock
      • Deleting an object
      • Deleting all objects
      • Deleting a partially uploaded object
      • Editing an object's ACL
      • Managing object labels
      • Managing object custom metadata
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ
  1. Step-by-step tutorials
  2. Objects
  3. Restoring an object's version

Restoring an object version in a versioned bucket

Written by
Yandex Cloud
Improved by
Tania L.
Updated at March 6, 2025

To restore object versions, the bucket must be versioned. You can only restore the versions that were uploaded with versioning enabled. To enable versioning, follow this guide.

Management console
AWS CLI
API

Warning

The timeout for restoring an object version using the management console is 25 seconds. Large versions might not successfully restore within this time. If restoring fails, use other tools, such as the AWS CLI or API.

To restore an object version:

  1. In the management console, select Object Storage from the list of services and go to the bucket in question.
  2. In the left-hand panel, select Objects and find the object in the list.
  3. Select the object whose version you want to restore, click , and select Version history.
  4. In the list of versions, click Restore in the row with the version you need. This will restore the selected version and make it the current one.

To restore an object version using the AWS CLI:

  1. Get the ID of the object version you need:

    aws s3api list-object-versions \
      --endpoint-url https://storage.yandexcloud.net \
      --bucket <bucket_name> \
      --prefix <object_key_prefix>
    

    The result will be a list of versions for all objects whose keys start with the specified prefix. Version IDs are available in the VersionId parameters.

    Example of getting a list of versions

    Command:

    aws s3api list-object-versions \
      --endpoint-url https://storage.yandexcloud.net \
      --bucket my-bucket \
      --prefix index.html
    

    Result:

    {
       "Versions": [
           {
               "LastModified": "2015-11-10T00:20:11.000Z",
               "VersionId": "Rb_l2T8UHDkFEwCgJjhlgPOZ********",
               "ETag": "\"0622528de826c0df5db1258a********\"",
               "StorageClass": "STANDARD",
               "Key": "index.html",
               "Owner": {
                   "DisplayName": "my-username",
                   "ID": "7009a8971cd660687538875e7c86c5b672fe116bd438f46db45460dd********"
               },
               "IsLatest": true,
               "Size": 38
           },
           {
               "LastModified": "2015-11-09T23:26:41.000Z",
               "VersionId": "rasWWGpgk9E4s0LyTJgusGeR********",
               "ETag": "\"06225825b8028de826c0df5d********\"",
               "StorageClass": "STANDARD",
               "Key": "index.html",
               "Owner": {
                   "DisplayName": "my-username",
                   "ID": "7009a8971cd660687538875e7c86c5b672fe116bd438f46db45460dd********"
               },
               "IsLatest": false,
               "Size": 38
           }
       ]
    }
    

    To select a single object:

    1. Install and initialize jq.

    2. Filter the result:

      aws s3api list-object-versions \
        --endpoint-url https://storage.yandexcloud.net \
        --bucket <bucket_name> \
        --prefix <object_key_prefix> \
      | jq '.Versions | map(select(.Key == "<object_key>"))'
      

    For more information about the command, see its description in this article of the AWS CLI command reference.

  2. Copy the object version to the same bucket with the same key to make it the current object version:

    aws s3api copy-object \
      --endpoint-url https://storage.yandexcloud.net \
      --bucket <bucket_name> \
      --copy-source <bucket_name>/<object_key>?versionId=<version_ID> \
      --key <object_key>
    

    Where:

    • --bucket: Bucket name.
    • --copy-source: Source object to copy, specifying the version ID.
    • --key: Target object key. To restore the object version, make sure the keys of the target and source objects match.

    Result:

    {
      "CopyObjectResult": {
        "LastModified": "<date_and_time_of_last_object_modification>",
        "ETag": "\"589c8b79c230a6ecd5a7e1d040a9a030\""
      },
      "VersionId": "<ID_of_restored_object_version>"
    }
    

    For more information about the command, see its description in this article of the AWS CLI command reference.

To restore an object version:

  1. Get the ID of the object version you need using the listObjectVersions S3 API method.
  2. Copy the object version to the same bucket with the same key using the copy S3 API method.

Was the article helpful?

Previous
Downloading an object
Next
Renaming and moving objects
© 2025 Direct Cursus Technology L.L.C.