All Products
Search
Document Center

Alibaba Cloud CLI:Export Alibaba Cloud CLI command metadata and API metadata

Last Updated:Oct 19, 2025

Alibaba Cloud CLI supports exporting command metadata and API metadata. This topic describes the steps to export metadata.

Precautions

  • The API metadata of a cloud service is the collection of all descriptive information related to its APIs. For more information, see API metadata.

  • The metadata export feature is for debugging or development purposes only. We recommend that you disable this feature after the export is complete.

  • By default, metadata files are saved in the working directory of shell scripts. To change the save path, switch the working directory to the target path.

  • If the cli-metadata directory is not created, confirm that you have successfully run an Alibaba Cloud CLI command, and check whether the current user has write permissions for the working directory of shell scripts.

  • Metadata changes with updates to Alibaba Cloud CLI. We recommend that you upgrade Alibaba Cloud CLI to the latest version before you export metadata.

Procedure

Step 1: Enable the export feature

Set the temporary environment variable GENERATE_METADATA to YES in your shell execution environment to enable the metadata export feature.

The method for setting the variable differs by operating system:

  • Linux/macOS

    export GENERATE_METADATA=YES
  • Windows PowerShell

    $env:GENERATE_METADATA = "YES"
  • Windows CMD

    set GENERATE_METADATA=YES

Step 2: Export the metadata

After you set the environment variable, run any Alibaba Cloud CLI command. Alibaba Cloud CLI starts to export metadata after the command runs. For example:

aliyun

All generated metadata files are saved in the cli-metadata directory within the current working directory. For example:

  • If you run the command in the C:\Users\User directory, the metadata is saved to C:\Users\User\cli-metadata.

  • If you run the command in the /home/user/ directory, the metadata is saved to /home/user/cli-metadata.

The generated metadata files include the following main subdirectories and files, which store different types of metadata information:

cli-metadata/
├── metadatas/ # Directory for all the API metadata of cloud services supported by Alibaba Cloud CLI.
│ ├── products.json # List and basic information of cloud services, including service names, endpoints, default integrated API versions, API styles, and service API lists.
│ └ ── <product-name>/ # A subdirectory for each service, such as VPC and ECS.
│ └ ── <api-name>.json # Detailed definition file for each API operation.
│
├── en-US/ # Directory for all the API metadata of cloud services supported by Alibaba Cloud CLI (English version). Services without English descriptions are not in this directory.
│ ├── products.json # List and basic information of cloud services.
│ └ ── <product-name>/ # A subdirectory for each service, such as VPC and ECS.
│ ├── <api-name>.json # Detailed definition file for each API operation.
│ └ ── version.json # API versions that the cloud service supports and the list of API operations included in each version.
│
├── zh-CN/ # Directory for all the API metadata of cloud services supported by Alibaba Cloud CLI (Chinese version). Services without Chinese descriptions are not in this directory.
│ ├── products.json
│ └── <product-name>/
│ ├── <api-name>.json
│ └── version.json
│   
├── commands.json # Definition file for the Alibaba Cloud CLI command structure, including all commands, subcommands, options, and their parameter descriptions.
└ ── version # Version number of the currently used Alibaba Cloud CLI (plain text file). 

Step 3: Disable the metadata export feature

After the metadata export is complete, disable this feature to prevent metadata files from being generated when you run subsequent commands.

Method 1: Restart the shell session

Close the current terminal window and open a new shell session to automatically clear the environment variable.

Method 2: Manually clear the temporary environment variable

  • Linux/macOS

    unset GENERATE_METADATA
  • Windows PowerShell

    $env:GENERATE_METADATA = ""
  • Windows CMD

    set GENERATE_METADATA=