Creates or manages configuration files. Configuration files store access credentials and configuration settings. The config command can be interactive or non-interactive, depending on your use scenarios.
Create a configuration file
Run the following command to start the configuration process:
ossutil config
Follow the on-screen instructions to configure the path of the configuration file. You can press the Enter key to use the default path of the configuration file.
This example shows how to configure the default path of the configuration file on Linux.
Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
Specify the AccessKey ID, AccessKey secret, and region ID based on the on-screen instructions.
Enter the AccessKey ID that you created.
Please enter Access Key ID [****************id]:LTAI****************
Enter the AccessKey secret that you created.
Please enter Access Key Secret [****************sk]:R6vg*********************
Enter the ID of the region in which the bucket that stores your data is located. Default value: cn-hangzhou.
Please enter Region [cn-hangzhou]: cn-hangzhou
Specify the endpoint for the region in which the bucket is located. You can press Enter to skip this step.
After you specify the region ID in the previous step, the public endpoint of the region is used by default. For example, if you set
region-id
tocn-hangzhou
, the default public endpoint ishttps://oss-cn-hangzhou.aliyuncs.com
.If you want to use a different endpoint, enter the endpoint. If you want to access OSS from other Alibaba Cloud services in the same region as OSS, use the internal endpoint of the region (
https://oss-cn-hangzhou-internal.aliyuncs.com
in this example).Please enter Endpoint (optional, use public endpoint by default) [None]: https://oss-cn-hangzhou-internal.aliyuncs.com
The following table describes the parameters.
Parameter
Required
Description
accessKeyID
Yes
The AccessKey pair (AccessKey ID and secret) of the RAM user. For information about how to obtain an AccessKey pair, see Create an AccessKey pair for a RAM user.
accessKeySecret
Yes
Region
Yes
The ID of the region where your OSS bucket is located. In this example, the ID of the China (Hangzhou) region (cn-hangzhou) is used. For information about the IDs of other regions, see regions and endpoints.
endpoint
No
Specify the endpoint of the region in which the bucket is located. If you do not manually specify an endpoint, the Region parameter automatically generates a public endpoint. If you want to specify an internal endpoint, you must explicitly specify an internal endpoint. In this example, the public endpoint of the China (Hangzhou) region (
https://oss-cn-hangzhou.aliyuncs.com
) is used.If you want to access OSS from other Alibaba Cloud services in the same region as OSS, use the internal endpoint of the region (
https://oss-cn-hangzhou-internal.aliyuncs.com
in this example).For more information about the relationship between regions and endpoints, see Regions and endpoints.
Create and query configuration settings
Create configuration settings
ossutil config set
The command creates access credential settings or configuration settings. In this case, the command is non-interactive. The --config-file option specifies the path to the configuration file, and the --profile option specifies the profile section.
The following sample command sets the region parameter in the dev section of the myconfig configuration file:
ossutil config set region cn-hangzhou --config-file myconfig --profile dev
To delete a configuration item, set the value to an empty string in the command line or manually delete the entry by using a text editor.
ossutil config set region "" --config-file myconfig --profile dev
Query configuration settings
ossutil config get
The command queries access credentials or configuration settings. In this case, the command is non-interactive. The --config-file option specifies the path to the configuration file, and the --profile option specifies the profile section to use. The following sample command queries the region parameter in the dev section of the myconfig configuration file:
ossutil config get region --config-file myconfig --profile dev
List all configuration sections
The command lists all sections. In this case, the command is non-interactive.
ossutil config list-profiles
Configure access credentials.
ossutil config credential
The command configures access credentials. In this case, the command is interactive. You are asked whether to encrypt the AccessKey ID, AccessKey secret, and token.
ossutil config credential
The command creates a config file and stores configuration settings and credentials.
Please enter the config file name,the file name can include path(default "C:\Users\issuser\.ossutilconfig", carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
No config file entered, will use the default config file "C:\Users\issuser\.ossutilconfig"For the following settings, carriage return means skip the configuration.
Please enter profile:
Please enter authenticate mode, supports RamRoleArn,EcsRamRole,Process,Uri,OIDCRoleArn,AK,StsToken:
Do you need to encryt access key id and access key secret (y or N)
Please enter Access Key ID [None]:
Please enter Access Key Secret [None]: