tencent cloud

Generating and Modifying Configuration Files - config
Last updated: 2025-11-14 15:30:16
Generating and Modifying Configuration Files - config
Last updated: 2025-11-14 15:30:16

Command format

The config command is used to generate and modify the configuration file:
./coscli config [command] [flag]
Note:
If you have set the configuration items correctly, you can run ./coscli config show to view the configurations.
For more general options for this command (such as switching buckets or user accounts), see General Options.
The generated configuration file uses the HTTPS protocol by default. If you want to change it to HTTP, directly modify it in the configuration file.
config includes the following sub-commands:
Command
Description
add
Adds a new bucket configuration.
delete
Deletes an existing bucket configuration.
init
Generates the configuration file interactively.
set
Modify one or more configuration items in the base group of the configuration file. The base group includes secretid, secretkey, sessiontoken, mode, and cvmrolename information.
show
Prints information in a specific configuration file.
config and its sub-commands include the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
View the detailed usage of this command.
-c
--config-path
Path of the configuration file to use.
The config add sub-command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
View the detailed usage of this command.
-a
--alias
Bucket alias.
-b
--bucket
Bucket name.
-r
--region
Region of the bucket.
-o
--ofs
Metadata acceleration bucket flag. For more information, see Metadata Acceleration Overview.
Note:
If you need to specify the bucket endpoint, you can use the general flag -e or --endpoint. For more information, see General Options Introduction.
The config delete sub-command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
View the detailed usage of this command.
-a
--alias
Bucket alias.
The config set sub-command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
View the detailed usage of this command.
None
--secret_id
Sets the secret ID, which can be created and obtained from the CAM console.
None
--secret_key
Sets the secret key, which can be created and obtained from the CAM console.
-t
--session_token
Sets the temporary key token. For more information on temporary key, see Accessing COS Using a Temporary Key.
None
--mode
Set the identity mode, supporting enumeration values SecretKey and CvmRole. It can be empty, with a default value of SecretKey, which means using a key to request COS. When the mode is CvmRole, it means using manage instance role to request COS.
None
--cvm_role_name
Set the CVM role instance name. For details, see manage instance role.
None
--close_auto_switch_host
Set whether to close automatic switching of the backup domain. Available values: true, false. Can be left blank.
If not set or the value is false, the domain name will be switched.
If set to true, the domain name will not be switched.
None
--disable_encryption
Set to turn off key encryption. It defaults to false. If set to true, the key-related information in the configuration file will be unencrypted.
None
--disable_auto_fetch_bucket_type
Set whether to disable automatically obtaining the bucket type. Available values: true, false.
If not set or set to false, the bucket type will be obtained automatically (ensure the account used has cos:HeadBucket permission).
If set to true, the bucket type will not be obtained automatically and the bucket type in the user profile will be used (for example, if the Bucket Configuration item ofs in the configuration file is set to true, the bucket type is ofs; if set to false, the bucket type is cos).

Sample

Adding a new bucket configuration

./coscli config add -b examplebucket3-1250000000 -r ap-chengdu -e cos.ap-chengdu.myqcloud.com -a bucket3

Deleting an existing bucket configuration

./coscli config delete -a bucket3

Modifying session-token in the default configuration file

./coscli config set --session_token test-token123

Printing information in a specific configuration file

./coscli config show -c /your/config/path.yaml

Modifying mode and cvmrolename in the default configuration file

./coscli config set --mode CvmRole --cvm_role_name testName

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback