Install
openclaw skills install @huaweiclouddev/huawei-cloud-cli-guidanceProvides guidance for Huawei Cloud KooCLI command-line tool operations. Covers KooCLI installation, IAM authentication configuration, access credential configuration, command construction, common error troubleshooting. Use this skill when users ask about any cloud-related services or wants to operate Huawei Cloud services from the terminal. Triggers: Huawei Cloud, huaweiyun, "华为云","华为cli", "命令行", KooCLI, hcloud, huaweiyunCLI, Huawei Cloud command line, OBS, ECS, VPC, "云", yun, huaweiyun tool, huawei tool, "华为云工具", "云工具", "工具"
openclaw skills install @huaweiclouddev/huawei-cloud-cli-guidanceHuawei Cloud KooCLI command-line tool guidance skill, providing comprehensive KooCLI usage guide. This skill covers core functionalities including KooCLI installation, authentication configuration, command construction, common error troubleshooting, helping users efficiently manage Huawei Cloud resources.
Huawei Cloud KooCLI adopts a unified command format:
hcloud <service> <operation> [parameters] [options]
hcloud: Command-line tool name<service>: Cloud service name (e.g., ECS, VPC, OBS, etc.)<operation>: API operation name (e.g., ListInstances, CreateVpc, etc.)[parameters]: Operation parameters (e.g., instance_id, vpc_name, etc.)[options]: Global options (e.g., --cli-region, --cli-output, etc.)--instance_id i-12345678[--description "instance description"]--cli- prefix, e.g., --cli-profile, --cli-region--cli-output to specify output format (json/table/tsv)--cli-query to perform JMESPath query filteringhcloud versionhcloud <service> --help to query available operations--cli-output=json/table/tsv--cli-query for JMESPath queryingCloud Service OpenAPI
|
| ECS API / VPC API / RDS API / OBS API / IAM API ...
v
Service Metadata JSON API Definition
|
| Description:
| - Service name
| - API version
| - Request method GET / POST / PUT / DELETE...
| - URI path
| - Request parameters
| - Response structure
| - Authentication method
| - Region and Endpoint
v
KooCLI Core
|
| Read metadata
| Generate commands
| Validate parameters
| Assemble HTTP requests
| Signature authentication
| Call OpenAPI
v
Dynamically Generated Commands
|
| hcloud <service name> <API operation name> [parameters]
v
Unified Execution Engine
|
| Execute requests
| Return results
v
Huawei Cloud Resource Operation Results
hcloud version
# Universal for all platforms
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh
# Non-interactive installation
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
Important: No additional operations allowed!!! Any file content changes must obtain user permission.
If more detailed installation guidance is needed, refer to ./references/installation-guide.md
After koocli download is complete, ask the user which way they want to use koocli [Required]
When using koocli to manage Huawei Cloud resources requires other permissions, refer to '../references/iam-policies.md'
When the user has successfully established a delegation to Elastic Cloud Server (ECS), when using KooCLI within the ECS server, you can specify "--cli-mode=ecsAgency" in commands. KooCLI will automatically obtain temporary AK/SK and SecurityToken for authentication based on ECS delegation.
When the delegator user creates a delegation and hands over resources to another account for management, the delegatee can add "--cli-agency-domain-id"/"--cli-agency-domain-name", "--cli-agency-name" and "--cli-source-profile" options to commands, using the configuration-free method to AssumeRole and call cloud service APIs, managing and using the delegator's resources:
hcloud VPC ListAddressGroup/v3 --cli-region="cn-north-4" --project_id="2cc60****************caefa5019ef" --cli-agency-domain-id=13534326******************5cf67b --cli-agency-name=****** --cli-source-profile=test
{
"request_id": "29ec21****************6d6b4cdd82",
"address_groups": [],
"page_info": {
"current_count": 0
}
}
KooCLI's SSO login command stores user authentication information in configuration files by completing SSO login, avoiding frequent input of these fixed information during operation execution. SSO login can be performed with the following command: hcloud configure sso
# SSO profile name (configuration item name to save after SSO login, required), SSO start URL (user portal URL, required), SSO region (region where IAM Identity Center is opened, required), Region (default or commonly used region, optional)
hcloud configure sso
? Input SSO profile name [required]: sso
? Input SSO start URL [required]: https://idcenter.huaweicloud.com/d-3********6/portal
? Input SSO region [required]: cn-north-4
? Input Region: cn-north-4
Browser page has been opened, waiting for you to complete SSO login...
? Choose account name: ACCOUNT_01
? Choose permission set name: PERMISSION_01
SSO login successful
KooCLI configuration item authentication mode values are AKSK, ecsAgency, SSO, AssumeRole. AKSK is recommended. When the configuration item being used has multiple authentication mode-related parameters configured simultaneously, use the "--cli-mode" option to specify the configuration item's authentication mode:
When setting configuration items, you need to specify the configuration item name with "--cli-profile", and also add corresponding authentication parameters based on the authentication mode "--cli-mode":
If the configuration item's authentication mode is "AKSK", then the values of "--cli-access-key" and "--cli-secret-key" in the configuration command cannot be empty;
If the configuration item's authentication mode is "ecsAgency", then specify "--cli-mode=ecsAgency" in the configuration command;
If the configuration item's authentication mode is "SSO", then the values of "--cli-sso-start-url" and "--cli-sso-region" in the configuration command cannot be empty;
If the configuration item's authentication mode is "AssumeRole", then the values of "--cli-agency-domain-id"/"--cli-agency-domain-name", "--cli-agency-name", "--cli-source-profile" in the configuration command cannot be empty.
Use and only use one authentication method:
| Mode | Applicable Scenario | Start Command | Cleanup |
|---|---|---|---|
| Profile Mode | Agent sessions, multiple calls | hcloud configure init --cli-profile agent-profile | Temporary profiles need cleanup |
| Explicit Parameter Mode | One-time commands, CI/CD | Pass authentication parameters in each command | No local configuration |
| Existing Profile Mode | User already configured | --cli-profile <profile-name> | Do not modify configuration |
# Create dedicated profile
hcloud configure init --cli-profile agent-profile
# View configuration
hcloud configure list
# Execute commands using profile
hcloud <service> <operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=json
# Using permanent AK/SK
hcloud <service> <operation> \
--cli-access-key <AccessKeyId> \
--cli-secret-key <SecretAccessKey> \
--cli-region cn-north-4
# Using temporary credentials
hcloud <service> <operation> \
--cli-access-key <AccessKeyId> \
--cli-secret-key <SecretAccessKey> \
--cli-security-token <SecurityToken> \
--cli-region cn-north-4
Create independent profiles for different environments:
dev: Development environmenttest: Test environmentprod: Production environmentExplicitly specify when calling:
hcloud <service> <operation> \
--cli-profile dev \
--cli-region cn-north-4
--help before constructing any commandExecute help output as follows:
hcloud --help command to query the list of cloud services supported by KooCLI. After obtaining accurate cloud service names, proceed to next step.hcloud <service> --help command to query the service's operation list. Find out what operations the service has, obtain the operation the user needs, then continue.hcloud <service> <operation> --help to query the help information for the specific cloud service operation.In KooCLI, some functionality of the obsutil tool for managing OBS data via command line has been integrated. Specific functions and commands strictly refer to and execute according to the help output steps mentioned above.
If the operation is not found, you need to prompt the user to install obsutil to obtain complete functionality and explain the reason.
*** OBS Command Explanation: ***
OBS-related commands in KooCLI may exist in two forms:
1. OpenAPI style:
hcloud OBS <operation>
2. OBS integrated commands / obsutil style:
hcloud obs <command>
The two have different parameter systems, must check help separately before execution:
hcloud OBS --help
hcloud OBS <operation> --help
hcloud obs help
hcloud obs help <command>
KooCLI supports three output formats: json, table, tsv. Default output is in json format.
You can use the "--cli-output" parameter to specify any of the aforementioned output formats, and you can also use the "--cli-query" option with JMESPath expression to perform JMESPath query on json results, filtering out information the user needs.
| Parameter | Parameter Purpose |
|---|---|
| cli-output | cli-o response data output format, can be one of: json, table, tsv |
| cli-query | cli-query JMESPath path for filtering response data |
| cli-output-num | cli-output-num whether to print line numbers in table output. Values: true or false |
# JSON format (recommended for Agent)
hcloud <service> <operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=json
# Table format (suitable for manual viewing)
hcloud <service> <operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=table
# Text format
hcloud <service> <operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=text
Use --cli-query to extract specific fields:
# Extract specific fields
hcloud <service> <list-operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=json \
--cli-query "items[].{ID:id,Name:name,Status:status}"
# Filter specific status
hcloud <service> <list-operation> \
--cli-profile agent-profile \
--cli-region cn-north-4 \
--cli-output=json \
--cli-query "items[?status=='ACTIVE'].{ID:id,Name:name,Status:status}"
Note: JMESPath query fields must be written according to actual JSON return structure, cannot assume all list interfaces return items.
When troubleshooting KooCLI command failures, first add --cli-debug=true after the specific execution command to view underlying requests, responses, endpoints, parameter parsing, and authentication-related information.
KooCLI divides errors encountered during command calls into five types, declaring their specific type at the beginning of error prompt messages. The positioning methods for various errors are as follows:
When encountering errors, query help based on error type and interact with users step by step to resolve.
echo $ACCESS_KEY_ID is prohibited)hcloud configure set to pass plaintext credentialshcloud configure list to check credential status| Parameter | Description | Example |
|---|---|---|
--cli-profile | Configuration file name | --cli-profile dev |
--cli-region | Region | --cli-region cn-north-4 |
--cli-output | Output format | --cli-output=json |
--cli-query | JMESPath query | --cli-query "items[].{ID:id,Name:name}" |
--cli-debug | Debug mode | --cli-debug=true |
| Authentication Mode | Required Parameters | Optional Parameters |
|---|---|---|
| AKSK | --cli-access-key, --cli-secret-key | --cli-security-token |
| Profile | --cli-profile | --cli-mode, --cli-region |
| ECS Agency | --cli-mode=ecsAgency | --cli-region |
| SSO | --cli-sso-start-url, --cli-sso-region | --cli-profile, --cli-region |
| AssumeRole | --cli-agency-domain-id, --cli-agency-name, --cli-source-profile | --cli-region |
Use hcloud <service> <operation> --help to view parameter list for specific operations.
KooCLI supports three output formats:
hcloud ECS ListInstances/v3 --cli-region=cn-north-4 --cli-output=json
Applicable Scenarios: Automated scripts, API integration, data extraction
hcloud ECS ListInstances/v3 --cli-region=cn-north-4 --cli-output=table
Applicable Scenarios: Manual viewing, quick browsing
hcloud ECS ListInstances/v3 --cli-region=cn-north-4 --cli-output=tsv
Applicable Scenarios: Import to spreadsheets, data processing
hcloud ECS ListInstances/v3 --cli-region=cn-north-4 --cli-output=json --cli-query "servers[?status=='ACTIVE'].{ID:id,Name:name,Status:status}"
hcloud version should return 7.2.2 or higherhcloud --help should display available service listhcloud configure list displays configured profilehcloud IAM ListUsers/v3 --cli-profile <profile> tests IAM permissionshcloud <service> --help for each service to confirm available operations--cli-debug=true to view parameter parsing resultscurl -s https://ecs.cn-north-4.myhuaweicloud.com tests service endpointhcloud <service> --help → hcloud <service> <operation> --help--cli-debug=true for initial command debugging--cli-query to filter and format output--cli-output=json for automated processing--cli-query to reduce data transfer--cli-region results in operations in default region--cli-debug=true displays detailed request information~/.hcloud/logs/curl to test service endpoint reachability./references/installation-guide.md — Installation guide./references/cli-troubleshooting.md — Error troubleshooting./references/common-workflows.md — Common workflows./references/parameter-format.md — Parameter format rules./references/service-catalog.md — Service catalog./references/iam-policies.md — IAM policies./references/acceptance-criteria.md — Acceptance criteria./references/core-commands.md — Core commands