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

In this article:

  • Adding or updating labels
  • Viewing labels
  • Deleting labels
  1. Step-by-step tutorials
  2. Objects
  3. Managing object labels

Managing object labels

Written by
Yandex Cloud
Improved by
Tania L.
Updated at May 5, 2025
  • Adding or updating labels
  • Viewing labels
  • Deleting labels

An object label is a key-value pair used for logical object labeling.

Note

Yandex Cloud uses labels to logically identify resources. However, Object Storage supports compatibility with Amazon S3 API, that is why we use tags, a term native to AWS, in the AWS CLI commands and API parameters.

Adding or updating labelsAdding or updating labels

Management console
Yandex Cloud CLI
AWS CLI
Terraform
API
  1. In the management console, select Object Storage from the list of services and go to the bucket you need.
  2. In the left-hand panel, select Objects.
  3. Click the name of the object you need.
  4. Click Add label.
  5. Enter label key and value separated by a colon (key:value).

To edit a label:

  1. Click Add label.
  2. Enter the key of the label you want to edit and its new value.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for updating object labels in a bucket:

    yc storage s3api put-object-tagging --help
    
  2. Get a list of buckets in the default folder:

    yc storage bucket list
    

    Result:

    +------------------+----------------------+-------------+-----------------------+---------------------+
    |       NAME       |      FOLDER ID       | MAX SIZE    | DEFAULT STORAGE CLASS |     CREATED AT      |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    | my-bucket        | b1g5dk66rc1u******** | 53687091200 | STANDARD              | 2024-12-17 07:17:04 |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    
  3. In the terminal, run this command that overwrites any existing object labels:

    yc storage s3api put-object-tagging \
      --bucket <bucket_name> \
      --key <object_key> \
      --version-id <version_ID> \
      --tagging TagSet=[{Key=<label_key>,Value=<label_value>},{Key=<label_key>,Value=<label_value>}]
    

    Where:

    • --bucket: Bucket name.
    • --key: Bucket object key.
    • --version-id: Object version. This is an optional parameter.
    • --tagging: Array of object labels, where:
      • Key: Label key, the string type.
      • Value: Label value, the string type.

    Result:

    request_id: ac9066e5********
    

If you do not have the AWS CLI yet, install and configure it.

In the terminal, run this command that overwrites any existing object labels:

aws s3api put-object-tagging \
  --bucket <bucket_name> \
  --key <object_key> \
  --tagging 'TagSet=[{Key=<label_key>,Value=<label_value>},{Key=<label_key>,Value=<label_value>}]' \
  --endpoint-url=https://storage.yandexcloud.net

Where:

  • --bucket: Bucket name.
  • --key: Bucket object key.
  • --tagging: Array of object labels, where:
    • Key: Label key, the string type.
    • Value: Label value, the string type.
  • --endpoint-url: Object Storage endpoint.

Note

Terraform uses a service account to interact with Object Storage. Assign to the service account the required role, e.g., storage.admin, for the folder where you are going to create resources.

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

  1. Open the Terraform configuration file and add the tags section to the object description:

    resource "yandex_storage_object" "test-object" {
      access_key       = "<static_key_ID>"
      secret_key       = "<secret_key>"
      bucket           = "<bucket_name>"
      key              = "<object_name>"
      source           = "<path_to_file>"
      tags             = {
        <label_1_key> = "<label_1_value>"
        <label_2_key> = "<label_2_value>"
      }
    }
    

    Where tags is the array of object labels in <key> = "<value>" format.

    For more information about the yandex_storage_object resource in Terraform, see this TF provider article.

  2. Apply the changes:

    1. In the terminal, change to the folder where you edited the configuration file.

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

      terraform validate
      

      If the configuration is correct, the following message is returned:

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

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

This will add the specified labels to your object. You can check the new labels and the object settings using the AWS CLI or S3 API.

To add or update object labels, use the putObjectTagging S3 API method.

Viewing labelsViewing labels

Management console
Yandex Cloud CLI
AWS CLI
API

You can see the labels in the list of bucket objects and on the individual object's page.

  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.
  3. Click the name of the object you need.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for viewing object labels in a bucket:

    yc storage s3api get-object-tagging --help
    
  2. Get a list of buckets in the default folder:

    yc storage bucket list
    

    Result:

    +------------------+----------------------+-------------+-----------------------+---------------------+
    |       NAME       |      FOLDER ID       | MAX SIZE    | DEFAULT STORAGE CLASS |     CREATED AT      |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    | my-bucket        | b1g5dk66rc1u******** | 53687091200 | STANDARD              | 2024-12-17 07:17:04 |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    
  3. Get information about object labels:

    yc storage s3api get-object-tagging \
      --bucket <bucket_name> \
      --key <object_key> \
      --version-id <version_ID>
    

    Where:

    • --bucket: Bucket name.
    • --key: Bucket object key.
    • --version-id: Object version. This is an optional parameter.

    Result:

    request_id: 2defc7b2********
    tag_set:
      - key: key-for-my-object-2
        value: second-value
      - key: key-for-my-object-1
        value: first-value
    

If you do not have the AWS CLI yet, install and configure it.

In the terminal, run this command:

aws s3api get-object-tagging \
  --bucket <bucket_name> \
  --key <object_key> \
  --endpoint-url=https://storage.yandexcloud.net

Where:

  • --bucket: Bucket name.
  • --key: Bucket object key.
  • --endpoint-url: Object Storage endpoint.

Result:

{
    "TagSet": [
        {
            "Key": "test-key-1",
            "Value": "test-value-1"
        },
        {
            "Key": "test-key-2",
            "Value": "test-value-2"
        }
    ]
}

To view object labels, use the getObjectTagging S3 API method.

Deleting labelsDeleting labels

Management console
Yandex Cloud CLI
AWS CLI
Terraform
API
  1. In the management console, select Object Storage from the list of services and go to the bucket you need.
  2. In the left-hand panel, select Objects.
  3. Click the name of the object you need.
  4. Click the cross next to the label you want to delete.

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

The folder specified when creating the CLI profile is used by default. To change the default folder, use the yc config set folder-id <folder_ID> command. You can specify a different folder using the --folder-name or --folder-id parameter.

  1. See the description of the CLI command for deleting object labels in a bucket:

    yc storage s3api delete-object-tagging --help
    
  2. Get a list of buckets in the default folder:

    yc storage bucket list
    

    Result:

    +------------------+----------------------+-------------+-----------------------+---------------------+
    |       NAME       |      FOLDER ID       | MAX SIZE    | DEFAULT STORAGE CLASS |     CREATED AT      |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    | my-bucket        | b1g5dk66rc1u******** | 53687091200 | STANDARD              | 2024-12-17 07:17:04 |
    +------------------+----------------------+-------------+-----------------------+---------------------+
    
  3. Delete object labels from the bucket:

    yc storage s3api delete-object-tagging \
      --bucket <bucket_name> \
      --key <object_key> \
      --version-id <version_ID>
    

    Where:

    • --bucket: Bucket name.
    • --key: Bucket object key.
    • --version-id: Object version. This is an optional parameter.

    Result:

    request_id: 1131dfc4********
    

If you do not have the AWS CLI yet, install and configure it.

In the terminal, run this command:

aws s3api delete-object-tagging \
  --bucket <bucket_name> \
  --key <object_key> \
  --endpoint-url=https://storage.yandexcloud.net

Where:

  • --bucket: Bucket name.
  • --key: Bucket object key.
  • --endpoint-url: Object Storage endpoint.

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

  1. Open the Terraform configuration file and delete the tags section from the object description.

    Example of an object label description in Terraform configuration
     resource "yandex_storage_object" "test-object" {
       ...
       tags             = {
         <label_1_key> = "<label_1_value>"
         <label_2_key> = "<label_2_value>"
       }
     }
    ...
    
  2. Apply the changes:

    1. In the terminal, change to the folder where you edited the configuration file.

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

      terraform validate
      

      If the configuration is correct, the following message is returned:

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

      terraform plan
      

      The terminal will display a list of resources with parameters. No changes are made at this step. If the configuration contains errors, Terraform will point them out.

    4. Apply the configuration changes:

      terraform apply
      
    5. Confirm the changes: type yes in the terminal and press Enter.

This will delete the object labels. You can check the label deletion and the object settings using the AWS CLI or S3 API.

To delete object labels, use the deleteObjectTagging S3 API method.

Was the article helpful?

Previous
Editing an object's ACL
Next
Managing object custom metadata
© 2025 Direct Cursus Technology L.L.C.