COSCLI provides binary packages for Windows, macOS, and Linux, which can be used after simple installation and configuration.
GitHub Address | Tencent Cloud Address |
---|---|
Windows | Windows |
Mac | Mac |
Linux | Linux |
Note:The current version is v0.13.0-beta. To get the latest and earlier versions and changelog of the tool, see Releases.
C:\Users\<username>
directory.coscli-windows.exe
to coscli.exe
.Windows + R
to launch the Run
program.cmd
and press Enter
to open the command line window.coscli --version
in the command line window. If the following information is printed out, the installation is successful:
Note:On Windows, the method for using COSCLI may vary slightly by command line client. If COSCLI does not work properly after
coscli [command]
is entered, try./coscli [command]
.
coscli version v0.13.0-beta
Run the following command to download COSCLI:
wget https://github.com/tencentyun/coscli/releases/download/v0.13.0-beta/coscli-mac
Run the following command to rename the file:
mv coscli-mac coscli
Run the following command to modify the file execution permission:
chmod 755 coscli
Enter the command line ./coscli --version
. If the following information is printed out, the installation is successful:
coscli version v0.13.0-beta
Note:When you use COSCLI on macOS, if the
Unable to open "coscli" because the developer cannot be verified
prompt is displayed, go toSettings > Security & Privacy > General
and selectOpen COSCLI anyway
, and then COSCLI can be used properly.
Download COSCLI for Linux or run the following command to download COSCLI:
wget https://github.com/tencentyun/coscli/releases/download/v0.13.0-beta/coscli-linux
Run the following command to rename the file:
mv coscli-linux coscli
Run the following command to modify the file execution permission:
chmod 755 coscli
Enter ./coscli --version
in the command line window. If the following information is printed out, the installation is successful:
coscli version v0.13.0-beta
Note:
- We recommend that you use the tool through a temporary key as instructed in Generating and Using Temporary Keys for security purposes. When you apply for a temporary key, follow the Notes on Principle of Least Privilege to avoid leaking resources besides your buckets and objects.
- If you must use a permanent key, we recommend you follow the Notes on Principle of Least Privilege to limit the scope of permission on the permanent key.
When using COSCLI for the first time, you need to initialize the configuration file, which contains the following two parts:
Enter
to skip.COSCLI will automatically call ./coscli config init
to generate a configuration file in ~/.cos.yaml
when used for the first time. You can complete the configuration interactively on the command line. You can also run the ./coscli config init
command later to interactively generate a configuration file in another location. Then, you can use ./coscli config show
to view the location and parameter information of the configuration file.
The configuration items in the configuration file are as described below:
Configuration Item | Description |
---|---|
Secret ID | SecretId . We recommend that you use a sub-account key and follow the principle of least privilege to reduce risks. For more information on how to obtain a sub-account key, see Access Key. |
Secret Key | SecretKey . We recommend that you use a sub-account key and follow the principle of least privilege to reduce risks. For more information on how to obtain a sub-account key, see Access Key. |
Session Token | Temporary key token, which should be specified if a temporary key is used; otherwise, press Enter to skip it. For more information on temporary key, see Accessing COS Using a Temporary Key. |
protocol | Network transfer protocol, which is HTTPS by default. If you want to change it to HTTP, directly modify it in the configuration file. |
APPID | APPID is the account you get after successfully registering your Tencent Cloud account. It is automatically assigned by the system and can be obtained from Account Information. The full name of a bucket consists of Bucket Name and APPID in the format of <bucketname-appid> . For more information on bucket naming conventions, see Bucket Overview. |
Bucket Name | Bucket name, which forms the full name of the bucket together with the APPID in the format of <bucketname-appid> . For more information on bucket naming conventions, see Bucket Overview. |
Bucket Endpoint | Bucket endpoint in the format of cos.<region>.myqcloud.com , where <region> is the bucket region such as ap-guangzhou and ap-beijing . For the list of regions supported by COS, see Regions and Access Endpoints. |
Bucket Alias | Bucket alias, which can be used to replace BucketName-APPID after configuration to shorten required commands. If it is not configured, its value will be the value of BucketName-APPID . |
OFS Bucket | Metadata acceleration bucket flag, which indicates whether the metadata acceleration feature is enabled for the bucket. Currently, metadata acceleration is in free beta test. To try it out, contact us. You can check the Message Center or see Billing Overview to stay up to date with the latest billing plan. |
COSCLI will ask you to configure the information of only one bucket during the initial configuration. If you want to configure multiple buckets, you can run the ./coscli config add
command later to add the information of more buckets. If you want to modify the configuration file or learn more about operations on the configuration file, see Generating and Modifying Configuration Files - config or run the ./coscli config --help
command to view commands related to the configuration file.
Before starting to use commands, you can quickly check how to use COSCLI by running the command ./coscli --help
.
In addition to interactively generating a configuration file by running ./coscli config init
, you can also manually write a YAML configuration file for COSCLI as shown below:
cos:
base:
secretid: XXXXXXXXXXXXXXX
secretkey: XXXXXXXXXXXXXXXXX
sessiontoken: ""
protocol: https
buckets:
- name: examplebucket1-1250000000
alias: bucket1
region: ap-shanghai
endpoint: cos.ap-shanghai.myqcloud.com
ofs: false
- name: examplebucket2-1250000000
alias: bucket2
region: ap-guangzhou
endpoint: cos.ap-guangzhou.myqcloud.com
ofs: false
- name: examplebucket3-1250000000
alias: bucket3
region: ap-chengdu
endpoint: cos.ap-chengdu.myqcloud.com
ofs: false
Note:By default, COSCLI reads configuration items from
~/.cos.yaml
. If you want to use the custom configuration file, select-c (--config-path)
after running commands. The strings (secretid
/secretkey
/sessiontoken
) stored in the configuration file are encrypted.
Apakah halaman ini membantu?