tencent cloud

Cloud Object Storage

Release Notes and Announcements
Release Notes
Announcements
Product Introduction
Overview
Features
Use Cases
Strengths
Concepts
Regions and Access Endpoints
Specifications and Limits
Service Regions and Service Providers
Billing
Billing Overview
Billing Method
Billable Items
Free Tier
Billing Examples
Viewing and Downloading Bill
Payment Overdue
FAQs
Getting Started
Console
Getting Started with COSBrowser
User Guide
Creating Request
Bucket
Object
Data Management
Batch Operation
Global Acceleration
Monitoring and Alarms
Operations Center
Data Processing
Content Moderation
Smart Toolbox
Data Processing Workflow
Application Integration
User Tools
Tool Overview
Installation and Configuration of Environment
COSBrowser
COSCLI (Beta)
COSCMD
COS Migration
FTP Server
Hadoop
COSDistCp
HDFS TO COS
GooseFS-Lite
Online Tools
Diagnostic Tool
Use Cases
Overview
Access Control and Permission Management
Performance Optimization
Accessing COS with AWS S3 SDK
Data Disaster Recovery and Backup
Domain Name Management Practice
Image Processing
Audio/Video Practices
Workflow
Direct Data Upload
Content Moderation
Data Security
Data Verification
Big Data Practice
COS Cost Optimization Solutions
Using COS in the Third-party Applications
Migration Guide
Migrating Local Data to COS
Migrating Data from Third-Party Cloud Storage Service to COS
Migrating Data from URL to COS
Migrating Data Within COS
Migrating Data Between HDFS and COS
Data Lake Storage
Cloud Native Datalake Storage
Metadata Accelerator
GooseFS
Data Processing
Data Processing Overview
Image Processing
Media Processing
Content Moderation
File Processing Service
File Preview
Troubleshooting
Obtaining RequestId
Slow Upload over Public Network
403 Error for COS Access
Resource Access Error
POST Object Common Exceptions
API Documentation
Introduction
Common Request Headers
Common Response Headers
Error Codes
Request Signature
Action List
Service APIs
Bucket APIs
Object APIs
Batch Operation APIs
Data Processing APIs
Job and Workflow
Content Moderation APIs
Cloud Antivirus API
SDK Documentation
SDK Overview
Preparations
Android SDK
C SDK
C++ SDK
.NET(C#) SDK
Flutter SDK
Go SDK
iOS SDK
Java SDK
JavaScript SDK
Node.js SDK
PHP SDK
Python SDK
React Native SDK
Mini Program SDK
Error Codes
Harmony SDK
Endpoint SDK Quality Optimization
Security and Compliance
Data Disaster Recovery
Data Security
Cloud Access Management
FAQs
Popular Questions
General
Billing
Domain Name Compliance Issues
Bucket Configuration
Domain Names and CDN
Object Operations
Logging and Monitoring
Permission Management
Data Processing
Data Security
Pre-signed URL Issues
SDKs
Tools
APIs
Agreements
Service Level Agreement
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Tagging Bucket - bucket-tagging

PDF
Focus Mode
Font Size
Last updated: 2025-11-14 15:30:17
The bucket-tagging command is used to create (modify), get, and delete bucket tags. One bucket can have up to 50 tags.
Note:
If you need to obtain bucket tags, when you perform authorization policy, set action to cos:GetBucketTagging.
If you need to set the bucket tags, when you perform authorization policy, set action to cos:PutBucketTagging.
If you need to delete bucket tags, when you perform authorization policy, set action to cos:DeleteBucketTagging.
For more authorizations, please refer to CAM-Enabled API.

Command format

./coscli bucket-tagging --method [method] cos://<bucket-name> [tag_key]#[tag_value]
bucket-tagging includes the following parameters:
Parameter Format
Description
Sample
cos://<bucket-name>
Specify the bucket to access. You can use the bucket alias from the configuration parameters or the bucket name. If using the bucket name, you must also include the endpoint flag.
Access using bucket alias: cos://example-alias
Access using bucket name: cos://examplebucket-1250000000
The bucket-tagging command contains the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
View the usage of this command.
None
--method
Specify the required operations, including put (set tag), get (query tag), delete (delete tag), and add (add tag).
Note:
For other general options related to this command (such as switching buckets or user accounts), see the General Options documentation.

Setting Bucket Tags

Bucket tags are represented by a set of Key-Value pairs. Only the bucket owner and users with PutBucketTagging permissions can set bucket tags, otherwise it will return error code 403 AccessDenied.

Command format

./coscli bucket-tagging --method put cos://bucketAlias key1#value1 key2#value2
Among them, key#value represents the tag key-value pair Key-Value, where key and value are separated by #.If the bucket does not have a tag, this command will add the specified tag to the bucket; otherwise, it will overwrite the original tag.

Sample

Configure two group tags for the bucket named example-alias. One tag has key 1 and value 111, the other has key 2 and value 222. The command is as follows:
./coscli bucket-tagging --method put cos://exmaple-alias 1#111 2#222

Querying bucket tags

Command format

./coscli bucket-tagging --method get cos://bucketAlias

Sample

./coscli bucket-tagging --method get cos://exmaple-alias
The output below indicates that the bucket with the alias example-alias has two sets of tags configured. One set has a key of 1 and a value of 111, while the other set has a key of 2 and a value of 222.
KEY | VALUE
------+--------
1 | 111
2 | 222

Deleting All Bucket Tags

Command format

./coscli bucket-tagging --method delete cos://bucketAlias

Sample

./coscli bucket-tagging --method delete cos://exmaple-alias

Adding Bucket Tags

Bucket tags are represented by a set of Key-Value pairs. Only the bucket owner and users with PutBucketTagging permissions can add bucket tags, otherwise it will return error code 403 AccessDenied.

Command Syntax

./coscli bucket-tagging --method add cos://bucketAlias key1#value1 key2#value2
Among them, key#value represents the tag key-value pair Key-Value, where key and value are separated by #.

Operation Example

Add a group tag to the bucket named example-alias. The tag has key 1 and value 111. The command is as follows:
./coscli bucket-tagging --method add cos://example-alias 1#111


Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback