The bucket-tagging command is used to add, modify, query, or delete tagging configurations for a bucket.
Note
- The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.
- For more information about bucket tagging, see Configure bucket tagging.
Command syntax
- Add or modify bucket tagging configurations
./ossutil bucket-tagging --method put oss://bucket tagkey1#tagvalue1 tagkey2#tagvalue2
If the bucket has no tags, you can run this command to add tags to the bucket. If the bucket has tags, you can run this command to overwrite the existing tags.- Only the bucket owner and authorized users can configure tagging for the bucket. If other users attempt to configure tagging for the bucket, 403 Forbidden is returned with error code AccessDenied.
- You can configure a maximum of 20 tags for a bucket.
- The tag key is required. The tag key can be a maximum of 64 Bytes in length and cannot
start with
http://
,https://
, orAliyun
. - The tag value is optional. The tag value can be a maximum of 128 Bytes in length.
- The key and value of the tag must be encoded in UTF-8.
- Query bucket tagging configurations
./ossutil bucket-tagging --method get oss://bucket
- Delete bucket tagging configurations
./ossutil bucket-tagging --method delete oss://bucket
Examples
- Add bucket tagging configurations
./ossutil bucket-tagging --method put oss://bucket1 tag1#test1 tag2#test2
- Query bucket tagging configurations
./ossutil bucket-tagging --method get oss://bucket1
- Delete bucket tagging configurations
./ossutil bucket-tagging --method delete oss://bucket1
Common options
The following table describes the options you can add to the bucket-tagging command.
Option | Description |
---|---|
--method | Specifies the HTTP request method. Valid values:
|
--loglevel | Specifies the log level. The default value is null, indicating that no log files are
generated. Valid values:
|
--proxy-host | Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. An example of the URL is http://120.79. **.**:3128 or socks5://120.79. **. **:1080. |
--proxy-user | Specifies the username for the proxy server. The default value is null. |
--proxy-pwd | Specifies the password for the proxy server. The default value is null. |
Note For more information about common options, see View all supported options.