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
      • Creating a bucket
      • Deleting a bucket
      • Limiting the maximum size of a bucket
      • Encrypting a bucket
      • Managing object lifecycles
      • Managing CORS configurations
      • Configuring access permissions using IAM
      • Editing a bucket's ACL
      • Managing access policies
      • Configuring public access to a bucket
      • Accessing a bucket using Security Token Service
      • Accessing a bucket using a service connection from VPC
      • Managing bucket versioning
      • Enabling logging
      • Managing object locks
      • Managing bucket labels
      • Getting bucket information and statistics
      • Viewing bucket metrics
  • 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. Buckets
  3. Managing bucket labels

Managing bucket labels

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

A bucket label is a key-value pair used for logical bucket 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 where you need to add or edit labels.
  2. In the left-hand panel, select Settings.
  3. Select the General tab.
  4. Click Add label.
  5. Enter a label in key: value format. To update an existing label, enter its key and a new value.
  6. Press Enter.
  7. Click Save.

Warning

Updating the bucket settings will completely overwrite the existing labels.

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 bucket settings:

    yc storage bucket update --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        | b1gmit33ngp3******** | 10       | STANDARD              | 2022-12-16 13:58:18 |
    +------------------+----------------------+----------+-----------------------+---------------------+
    
  3. Add labels, specifying the name of the bucket in question:

    yc storage bucket update <bucket_name> \
      --tags <label_1_key>=<label_1_value>,<label_2_key>=<label_2_value>,...,<label_n_key>=<label_n_value>
    

    Where --tags is a flag to list bucket labels in key=value format.

    Result:

    name: my-bucket
    folder_id: b1gmit33ngp3********
    default_storage_class: STANDARD
    versioning: VERSIONING_ENABLED
    acl: {}
    created_at: "2023-04-24T14:15:28.240705Z"
    tags:
      - key: key-tag
        value: key-value
    

Warning

Updating the bucket settings will completely overwrite the existing labels.

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

In the terminal, run this command:

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

Where:

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

Warning

Updating the bucket settings will completely overwrite the existing labels.

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.

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 documentation on the Terraform website or mirror website.

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 bucket description:

    resource "yandex_storage_bucket" "test-bucket" {
      bucket           = "<bucket_name>"
      ...
      tags             = {
        <label_1_key> = "<label_1_value>"
        <label_2_key> = "<label_2_value>"
      }
      ...
    }
    

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

    For more information about the yandex_storage_bucket 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 bucket. You can check the new labels and the bucket settings using the management console or this CLI command:

yc storage bucket get <bucket_name> --full

Warning

Updating the bucket settings will completely overwrite the existing labels.

To add or update bucket labels, use the update REST API method for the Bucket resource, the BucketService/Update gRPC API call, or the putBucketTagging S3 API method.

Example of a gRPC API call

export IAM_TOKEN="<IAM_token>"
grpcurl \
  -H "Authorization: Bearer $IAM_TOKEN" \
  -d '{"name": "test-bucket", "update_mask": {"paths": ["tags"]}, "tags": [{"key": "test-key", "value": "test-value"}]}' \
  storage.api.cloud.yandex.net:443 \
  yandex.cloud.storage.v1.BucketService/Update 

Where:

  • IAM_TOKEN: IAM token.
  • name: Bucket name.
  • update_mask: List of bucket parameters you want to update.
  • tags: List of bucket labels.
  • key: Label key.
  • value: Label value.

Result:

{
  "id": "e3e5fsr6076bo*******",
  "description": "update bucket",
  "createdAt": "2023-04-27T12:01:03.636597Z",
  "createdBy": "ajelcjkv67arb*******",
  "modifiedAt": "2023-04-27T12:01:03.636597Z",
  "done": true,
  "metadata": {"@type":"type.googleapis.com/yandex.cloud.storage.v1.UpdateBucketMetadata","name":"test-bucket"},
  "response": {"@type":"type.googleapis.com/yandex.cloud.storage.v1.Bucket","acl":{},"createdAt":"2023-03-27T08:23:26.890770Z","defaultStorageClass":"STANDARD","folderId":"b1gsm0k26v1l2*******","maxSize":"53687091200","name":"test-bucket","tags":[{"key":"test-key","value":"test-value"}],"versioning":"VERSIONING_DISABLED"}
}

Viewing labelsViewing labels

Management console
Yandex Cloud CLI
AWS CLI
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 Settings.
  3. Select the General tab.

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 getting bucket information:

    yc storage bucket get --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        | b1gmit33ngp3******** | 10       | STANDARD              | 2022-12-16 13:58:18 |
     +------------------+----------------------+----------+-----------------------+---------------------+
    
  3. Get information about the labels, specifying the name of the bucket in question:

    yc storage bucket get <bucket_name> --full
    

    Result:

    name: my-bucket
    folder_id: b1gmit33ngp3********
    default_storage_class: STANDARD
    ...
    tags:
      - key: key-tag
        value: key-value
    ...
    

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

In the terminal, run this command:

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

Where:

  • --bucket: Bucket name.
  • --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 bucket labels, use the get REST API method for the Bucket resource, the BucketService/Get gRPC API call, or the getBucketTagging S3 API method.

Example of a gRPC API call

export IAM_TOKEN="<IAM_token>"
grpcurl \
  -H "Authorization: Bearer $IAM_TOKEN" \
  -d '{"name": "test-bucket", "view": "VIEW_FULL"}' \
  storage.api.cloud.yandex.net:443 \
  yandex.cloud.storage.v1.BucketService/Get 

Where:

  • IAM_TOKEN: IAM token.
  • name: Bucket name.
  • view: Scope of information provided (VIEW_FULL means full information about the bucket).

Result:

{
  "name": "test-bucket",
  "folderId": "b1gsm0k26v1l2*******",
  "anonymousAccessFlags": {
    "read": true,
    "list": true,
    "configRead": true
  },
  "defaultStorageClass": "STANDARD",
  "versioning": "VERSIONING_DISABLED",
  "maxSize": "53687091200",
  "acl": {

  },
  "createdAt": "2023-03-27T08:23:26.890770Z",
  "websiteSettings": {
    "redirectAllRequests": {

    }
  },
  "tags": [
    {
      "key": "test-key",
      "value": "test-value"
    }
  ]
}

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 Settings.
  3. Select the General tab.
  4. Click next to the label.
  5. Click Save.

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 bucket settings:

    yc storage bucket update --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        | b1gmit33ngp3******** | 10       | STANDARD              | 2022-12-16 13:58:18 |
    +------------------+----------------------+----------+-----------------------+---------------------+
    
  3. Delete labels, specifying the name of the bucket in question:

    yc storage bucket update <bucket_name> \
      --remove-tags
    

    Result:

    name: my-bucket
    folder_id: b1gmit33ngp3********
    default_storage_class: STANDARD
    versioning: VERSIONING_ENABLED
    acl: {}
    created_at: "2023-04-24T14:15:28.240705Z"
    

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

In the terminal, run this command:

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

Where:

  • --bucket: Bucket name.
  • --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 delete the tags section from the bucket description.

    Example of a bucket label description in Terraform configuration
    resource "yandex_storage_bucket" "test-bucket" {
      bucket           = "<bucket_name>"
      ...
      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 bucket labels. You can check the label deletion and the bucket settings using the management console or this CLI command:

yc storage bucket get <bucket_name> --full

To delete bucket labels, use the update REST API method for the Bucket resource, the BucketService/Update gRPC API call, or the deleteBucketTagging S3 API method.

Example of a gRPC API call

export IAM_TOKEN="<IAM_token>"
grpcurl \
  -H "Authorization: Bearer $IAM_TOKEN" \
  -d '{"name": "test-bucket", "update_mask": {"paths": ["tags"]}, "tags": []}' \
  storage.api.cloud.yandex.net:443 \
  yandex.cloud.storage.v1.BucketService/Update

Where:

  • IAM_TOKEN: IAM token.
  • name: Bucket name.
  • update_mask: List of bucket parameters you want to update.
  • tags: List of bucket labels.

Result:

{
  "id": "e3epc33apcche*******",
  "description": "update bucket",
  "createdAt": "2023-04-27T12:18:18.885391Z",
  "createdBy": "ajelcjkv67arb*******",
  "modifiedAt": "2023-04-27T12:18:18.885391Z",
  "done": true,
  "metadata": {"@type":"type.googleapis.com/yandex.cloud.storage.v1.UpdateBucketMetadata","name":"test-bucket-777"},
  "response": {"@type":"type.googleapis.com/yandex.cloud.storage.v1.Bucket","acl":{},"createdAt":"2023-03-27T08:23:26.890770Z","defaultStorageClass":"STANDARD","folderId":"b1gsm0k26v1l2*******","maxSize":"53687091200","name":"test-bucket-777","versioning":"VERSIONING_DISABLED"}
}

Was the article helpful?

Previous
Managing object locks
Next
Getting bucket information and statistics
© 2025 Direct Cursus Technology L.L.C.