aliyun-cli-manage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCategory: tool
分类:工具
Alibaba Cloud Generic CLI (aliyun) Skill
阿里云通用CLI(aliyun)技能
Validation
验证
bash
mkdir -p output/aliyun-cli-manage
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.py --help > output/aliyun-cli-manage/validate-help.txtPass criteria: command exits 0 and is generated.
output/aliyun-cli-manage/validate-help.txtbash
mkdir -p output/aliyun-cli-manage
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.py --help > output/aliyun-cli-manage/validate-help.txt通过标准:命令退出码为0,且生成文件。
output/aliyun-cli-manage/validate-help.txtOutput And Evidence
输出与凭证
- Save CLI version checks, API outputs, and error logs under .
output/aliyun-cli-manage/ - For each mutating action, keep request parameters and result summaries.
- 将CLI版本检查、API输出和错误日志保存在目录下。
output/aliyun-cli-manage/ - 针对每个变更操作,留存请求参数和结果摘要。
Goals
目标
- Use official CLI to execute Alibaba Cloud OpenAPI operations.
aliyun - Provide a standard flow for install, configuration, API discovery, execution, and troubleshooting.
- 使用官方CLI执行阿里云OpenAPI操作。
aliyun - 提供安装、配置、API发现、执行和问题排查的标准流程。
Quick Flow
快速流程
- Run the version guard script first (check first, then decide whether to upgrade).
- If not installed or check interval reached, the script downloads and installs the latest official package.
- Configure credentials and default region (recommend profile).
default - Use /
aliyun <product> --helpto confirm parameters.aliyun <product> <ApiName> --help - Run read-only queries first, then mutating operations.
- 首先运行版本防护脚本(先检查,再决定是否升级)。
- 如果未安装或达到检查间隔,脚本会下载并安装最新的官方包。
- 配置凭证和默认地域(推荐使用配置文件)。
default - 使用/
aliyun <product> --help确认参数。aliyun <product> <ApiName> --help - 先运行只读查询,再执行变更操作。
Version Guard (Practical)
版本防护(实用说明)
Prefer the bundled script to avoid unnecessary downloads on every run:
bash
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.pyDefault behavior:
- Check interval: 24 hours (configurable via environment variable).
- Within interval and version is sufficient: skip download.
- Exceeded interval / not installed / below minimum version: auto-download and install latest official package.
Optional controls (environment variables):
- :check interval.
ALIYUN_CLI_CHECK_INTERVAL_HOURS=24 - :force update (ignore interval).
ALIYUN_CLI_FORCE_UPDATE=1 - :minimum acceptable version.
ALIYUN_CLI_MIN_VERSION=3.2.9 - :installation directory.
ALIYUN_CLI_INSTALL_DIR=~/.local/bin
Manual parameter examples:
bash
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.py \
--interval-hours 24 \
--min-version 3.2.9优先使用捆绑脚本,避免每次运行时不必要的下载:
bash
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.py默认行为:
- 检查间隔:24小时(可通过环境变量配置)。
- 在间隔内且版本满足要求:跳过下载。
- 超出间隔/未安装/低于最低版本:自动下载并安装最新官方包。
可选控制项(环境变量):
- :检查间隔。
ALIYUN_CLI_CHECK_INTERVAL_HOURS=24 - :强制更新(忽略间隔)。
ALIYUN_CLI_FORCE_UPDATE=1 - :可接受的最低版本。
ALIYUN_CLI_MIN_VERSION=3.2.9 - :安装目录。
ALIYUN_CLI_INSTALL_DIR=~/.local/bin
手动参数示例:
bash
python skills/platform/cli/aliyun-cli-manage/scripts/ensure_aliyun_cli.py \
--interval-hours 24 \
--min-version 3.2.9Install (Linux example)
安装(Linux示例)
bash
curl -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o /tmp/aliyun-cli.tgz
mkdir -p ~/.local/bin
tar -xzf /tmp/aliyun-cli.tgz -C /tmp
mv /tmp/aliyun ~/.local/bin/aliyun
chmod +x ~/.local/bin/aliyun
~/.local/bin/aliyun versionbash
curl -fsSL https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -o /tmp/aliyun-cli.tgz
mkdir -p ~/.local/bin
tar -xzf /tmp/aliyun-cli.tgz -C /tmp
mv /tmp/aliyun ~/.local/bin/aliyun
chmod +x ~/.local/bin/aliyun
~/.local/bin/aliyun versionConfigure Credentials
配置凭证
bash
aliyun configure set \
--profile default \
--mode AK \
--access-key-id <AK> \
--access-key-secret <SK> \
--region cn-hangzhouView configured profiles:
bash
aliyun configure listbash
aliyun configure set \
--profile default \
--mode AK \
--access-key-id <AK> \
--access-key-secret <SK> \
--region cn-hangzhou查看已配置的配置文件:
bash
aliyun configure listCommand structure
命令结构
- Generic form:
aliyun <product> <ApiName> --Param1 value1 --Param2 value2 - REST form:
aliyun <product> [GET|POST|PUT|DELETE] <PathPattern> --body '...json...'
- 通用格式:
aliyun <product> <ApiName> --Param1 value1 --Param2 value2 - REST格式:
aliyun <product> [GET|POST|PUT|DELETE] <PathPattern> --body '...json...'
API Discovery and Parameter Validation
API发现与参数校验
bash
aliyun help
aliyun ecs --help
aliyun ecs DescribeRegions --helpbash
aliyun help
aliyun ecs --help
aliyun ecs DescribeRegions --helpCommon Read-Only Examples
常用只读操作示例
bash
undefinedbash
undefinedECS: list regions
ECS: 列出地域
aliyun ecs DescribeRegions
aliyun ecs DescribeRegions
ECS: list instances by region
ECS: 按地域列出实例
aliyun ecs DescribeInstances --RegionId cn-hangzhou
aliyun ecs DescribeInstances --RegionId cn-hangzhou
SLS: list projects by endpoint
SLS: 按端点列出项目
aliyun sls ListProject --endpoint cn-hangzhou.log.aliyuncs.com --size 100
undefinedaliyun sls ListProject --endpoint cn-hangzhou.log.aliyuncs.com --size 100
undefinedCommon Issues
常见问题
- /
InvalidAccessKeyId.NotFound:check AK/SK and profile.SignatureDoesNotMatch - :add
MissingRegionIdor configure default region in profile.--region - for SLS endpoint errors, explicitly pass .
--endpoint <region>.log.aliyuncs.com
- /
InvalidAccessKeyId.NotFound:检查AK/SK和配置文件。SignatureDoesNotMatch - :添加
MissingRegionId参数,或在配置文件中设置默认地域。--region - 若出现SLS端点错误,显式传入参数。
--endpoint <region>.log.aliyuncs.com
Execution Recommendations
执行建议
- Run before starting tasks.
ensure_aliyun_cli.py - If resource scope is unclear, query first then mutate.
- Before delete/overwrite operations, output the target resource list first.
- For batch operations, validate one item in a small scope first.
- 启动任务前先运行。
ensure_aliyun_cli.py - 如果资源范围不明确,先查询再执行变更。
- 在执行删除/覆盖操作前,先输出目标资源列表。
- 批量操作时,先在小范围内验证单个操作项。
References
参考资料
- Official source list:
references/sources.md
- 官方来源列表:
references/sources.md
Prerequisites
前置条件
- Configure least-privilege Alibaba Cloud credentials before execution.
- Prefer environment variables: ,
ALICLOUD_ACCESS_KEY_ID, optionalALICLOUD_ACCESS_KEY_SECRET.ALICLOUD_REGION_ID - If region is unclear, ask the user before running mutating operations.
- 执行前配置最小权限的阿里云凭证。
- 优先使用环境变量:、
ALICLOUD_ACCESS_KEY_ID,可选配置ALICLOUD_ACCESS_KEY_SECRET。ALICLOUD_REGION_ID - 如果地域不明确,执行变更操作前先询问用户。
Workflow
工作流程
- Confirm user intent, region, identifiers, and whether the operation is read-only or mutating.
- Run one minimal read-only query first to verify connectivity and permissions.
- Execute the target operation with explicit parameters and bounded scope.
- Verify results and save output/evidence files.
- 确认用户意图、地域、标识符,以及操作是只读还是变更类型。
- 先执行一个最小化的只读查询,验证连通性和权限。
- 传入显式参数并限定范围,执行目标操作。
- 验证结果并保存输出/凭证文件。