tencent cloud

All product documents
Cloud Object Storage
DocumentationCloud Object StorageUser ToolsCOSCLI (Beta)Common CommandsGenerating and Modifying Configuration Files - config
Generating and Modifying Configuration Files - config
Last updated: 2024-06-20 15:04:24
Generating and Modifying Configuration Files - config
Last updated: 2024-06-20 15:04:24

Command Syntax

The config command is used to generate and modify the configuration file.
./coscli config [command] [flag]
Note:
After setting the configuration items correctly, you can run ./coscli config show to view the configuration.
For more general options for this command (such as switching buckets or user accounts), see Common 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
Modifies one or more configuration items in the base group of the configuration file, which contains secretid, secretkey, and sessiontoken.
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
Views the 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
Views the 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 want to specify the endpoint of the bucket, use the common flag -e or --endpoint. For more information, see Common Options.
The config delete sub-command includes the following optional flags:
Flag Abbreviation
Flag Name
Description
-h
--help
Views the 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
Views the 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 enumerated values SecretKey and CvmRole. It can be null, with the default value being SecretKey, which means using a key to request COS. When the mode is CvmRole, it means requesting COS with managing roles.
None
--cvm_role_name
For the CVM role instance name settings, see managing roles for details.
None
--close_auto_switch_host
Set whether to disable automatic switch of a backup domain. Optional values are true and false, which can be null.
If the value is not set or set to false, the backup domain switch will be executed;
If the value is set to true, the backup domain switch will not be executed.

Examples

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 the mode and the 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

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon