百度智能云

All Product Document

          Object Storage

          Configure BOSCLI

          General Configuration

          The Configuration Supports the CLI Environment Displayed in Chinese

          To configure the CLI environment that supports Chinese display, execute the following commands for configuration:

          $ export LANG=en_US.UTF-8

          Note: Execute the command $ locale to view the language support of the current environment, if not LANG=en_US.UTF-8, execute the above-mentioned command for modification.

          Configure AK/SK, Region and Host information

          Prior to the use of BOS CLI tool, it is recommended to set Access Key, Secure Key, Region and Host. Set the AK/SK, Region and Host information by -c/--configure.

          $ bce -c  [<conf-path>] 
          $ BOS Access Key ID [None]: Enter Your AK 
          $ BOS Secret Access Key [None]: Enter Your SK 
          $ BCE Security Token [None]: Enter Your Security Token 
          $ Default region name [bj]: Enter Your region 
          $ Default domain [bj.bcebos.com]: Enter Your host 

          Note:

          • The '' is a local file directory. When a user has multiple accounts of Baidu AI Cloud, he can write the configuration files of different accounts to different directories by specifying ''. When executing the command, the user can specify the directory to select the configuration of the corresponding account.
          • If the <conf-path> is not specified, CLI writes the configuration file automatically under the current master directory ~/.bce upon the completion of configuration; if the <conf-path> is specified, the configuration file is written to the specified directory automatically.
          • Even if AK/SK is not set, you can access the bucket with public permission via BOS CLI.
          • When and only when you use Temporarily Authorized Access AK/SK provided to access BOS, you are required to provide Security Token.
          • After specifying Region, you can specify no Host, BOS CLI can match Host to Region.bcebos.com automatically.
          • If you specify the Host, BOS CLI does not match Host automatically, but access the Host you specified.
          • Fill in None to set the AK/SK/Region as well as Domain as null. When the Region is set to be null, the default value is bj; when the Domain is set to be null, it defaults to use Region for matching; when both are set to be null at the same time, it defaults for access bj.bcebos.com

          Note:

          • If the AK/SK you used is accessed directly from security token of Baidu AI Cloud, please set the Security Token as null or none.

          In addition to the general setting, the command bce -c also supports to set automatic switching of domain name as well as supports to set BOS upload-related attribute, such as the validity period for breakpoint resume, whether to use HTTPS protocol as well as the multi-thread number of multi-part upload.

          Set Automatic Switching of Domain Name

          BOS has multiple Regions, and if you need to operate under different Regions, the "automatic switching of domain name" of CLI can switch the domain name automatically according to the Region where the bucket you operate is located. To facilitate your use, CLI enables such function by default.

          If you want all your action requests to be sent to the domain name you specified or to Host (a domain configured by bce -c, you can disable the function of "automatic switching of domain name" by the command bce -c, and no indicates to disable such function.

          $ bce -c [<conf-path>] 
          $ Default use auto switch domain [yes]: 

          Note: The value can be yes and no, among which yes represents to enable the automatic switching of domain name for the Region where the bucket is located, and no represents to disable such function. Such function is enabled by default.

          Set the Validity Period for Breakpoint Resume.

          CLI supports the breakpoint resume of file upload. If an upload is interrupted due to accident, you can execute the command again to resume the last upload. The breakpoint resume needs to set with a validity period, which indicates that in case of an interruption within such period, the part after the breakpoint can be resumed for upload; if beyond such period, a new upload starts.

          $ bce -c [<conf-path>] 
          $ Default breakpoint_file_expiration [7] days: Enter the period of keep breakpoint file 

          Note: The validity period of resume shall be set to be an integer greater than or equal to 0, and if it is set to be "-1", it indicates persistent reservation. The validity period for resume is 7 days by default.

          Set HTTPS Protocol for Upload

          In order to ensure the security of the user's data, the user is recommended to Use HTTPS Protocol for Upload. Whether or not to use HTTPS can be set by the command bce -c, and HTTPS Protocol for Upload is used if no is set.

          $ bce -c [<conf-path>] 
          $ Default use https protocol [no]: 

          Note: The value can be yes and no, the HTTPS Protocol for Upload is used by default.

          Set the Thread Number for Multi-part and Parallel Upload

          For multi-part upload of a large file, the command bce -c can be used to set the thread number of the parallel upload.

          $ bce -c [<conf-path>] 
          $ Default multi upload thread num [10]: 

          Note: The number of threads for parallel upload shall be set to be an integer greater than or equal to 1, and it defaults to be 10.

          Previous
          Install BOSCLI
          Next
          Use of BOS Services by CLI-BOSCLI