Environment variables for Alibaba Cloud CLI
The Alibaba Cloud CLI supports configuring credentials, region, behavior options, and other runtime parameters using environment variables. In CI/CD pipelines, container environments, or automation scripts, environment variables are the preferred method for passing credentials and runtime configuration. This topic lists all supported environment variables and explains their priority order to help you quickly locate the required configuration items.
Priority order
When reading configuration, the Alibaba Cloud CLI applies settings in the following priority order, from highest to lowest:
Command-line parameters (such as
--profileand--region)Configuration file (
~/.aliyun/config.json)Environment variables
For more information, see Understand command-line parameters.
Credentials and identity
Use environment variables to configure credential information such as AccessKey, Security Token Service (STS) token, OpenID Connect (OIDC), and RAM roles without storing secrets in plaintext in configuration files.
Environment variable | Description |
| AccessKey ID. |
| AccessKey Secret. |
| STS temporary security token. Use together with AccessKey ID and AccessKey Secret. |
| Credential service endpoint for CredentialsURI mode. No alias available. |
| ARN (Alibaba Cloud Resource Name) of the OIDC identity provider. |
| Path to the OIDC token file. |
| RAM role ARN, used with RamRoleArn and ChainableRamRoleArn authentication modes. |
| External ID, used in cross-account role assumption scenarios. |
| Client ID of the application used for Cloud SSO sign-in. When unset, the CLI uses its built-in official application ( |
For configuration methods and applicable scenarios for each credential type, see Configure credentials.
Profile selection
Control which profile the CLI uses.
Environment variable | Description |
| Specifies the profile to use. Equivalent to the |
| When set to |
Region and endpoint
Environment variable | Description |
| Default region ID, such as |
| Custom API endpoint address. When set, the CLI sends requests directly to this address and skips automatic endpoint resolution. When unset, the CLI automatically resolves the endpoint based on the service and region. |
| Endpoint type. For example, set to |
| A custom endpoint for the STS service. Used in authentication modes that need to call STS to obtain temporary credentials, such as RamRoleArn and ChainableRamRoleArn. When unset, the CLI automatically selects the public STS endpoint of the region. |
Plugin management
Control plugin auto-installation behavior, storage location, and download source.
Environment variable | Description |
| When set to |
| When set to |
| Custom plugin installation directory. Default is |
| When set to |
| Base URL for a custom plugin download source. Useful in private network environments or private image scenarios. When unset, the official default plugin source |
Network, timeout, and language
The timeout, retry, and language variables in the following table are passed by the CLI to plugins. To set the timeout, retry, and language for the CLI's own commands, use the --read-timeout, --connect-timeout, --retry-count, and --language parameters, or use aliyun configure. When unset, the CLI's own calls default to a 10-second read timeout and a 5-second connection timeout.
Environment variable | Description |
| I/O read timeout, in seconds. |
| Connection timeout, in seconds. |
| Number of retries on request failure. |
| The language setting passed to plugins. Valid values: |
AI Mode and agent integration
Controls AI Mode and automatic integration in agent environments. For more information about AI Mode, see AI Mode.
Environment variable | Description |
| Enables or disables AI Mode for the current process, taking precedence over the configuration file. Set to |
| Controls whether the corresponding integration is automatically enabled when an agent environment is detected. When unset, the default behavior is kept (automatically enabled). Set to |
Safety Policy
Controls Safety Policy through environment variables, which take precedence over the configuration file. For more information about Safety Policy, see Safety policy.
Environment variable | Description |
| Overrides the enabled state in the configuration file. Set to |
| Overrides the rule list in the configuration file. The format is |
| When set to |