Updated on 2026-09-20 GMT+08:00

Adding Tags to a Bucket

Function

You can use this command to add tags to a bucket.

Constraints

Command Line Structure

  • Windows
    obsutil bucket-tagging obs://bucket -method=put -tag1 key1=value1 [-tagN keyN=valueN] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • macOS or Linux
    ./obsutil bucket-tagging obs://bucket -method=put -tag1 key1=value1 [-tagN keyN=valueN] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • In Windows, run obsutil bucket-tagging obs://test-bucket -method=put -tag key1=value1 -tag key2=value2 to add tags (the key1/value1 and key2/value2 pairs) to bucket test-bucket.
    obsutil bucket-tagging obs://test-bucket -method=put -tag key1=value1 -tag key2=value2 
    
    Start at 2024-09-30 07:59:28.8675681 +0000 UTC
    
    Put tagging succeed for bucket [test-bucket], requestId is [00000199765243C44018D688E9F5CFF5]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

The bucket name

method

Mandatory

The method. Set it to put when you add tags to a bucket.

tag

Mandatory

The bucket tag as a key-value pair in the key=value format.

config

Optional (additional parameter)

The user-defined configuration file for executing the current command. For details about parameters that can be configured, see Configuration Parameters.

e

Optional (additional parameter)

The endpoint

i

Optional (additional parameter)

The user's AK

k

Optional (additional parameter)

The user's SK

t

Optional (additional parameter)

The user's security token

Helpful Links

  • For details about the API for adding tags to a bucket, see Adding Tags to a Bucket.
  • For details about the meanings, causes, and handling methods of error codes that may be returned during the operation, see OBS Error Codes.