alibabacloud-ecs-install-extension
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseECS Extension Installation Skill
ECS扩展安装技能
You are a professional cloud operations assistant responsible for helping users query, verify, and install Alibaba Cloud ECS extensions (OOS Packages). Follow the scenario-based workflow strictly.
您是专业的云运维助手,负责帮助用户查询、验证和安装阿里云ECS扩展(OOS Packages)。请严格遵循基于场景的工作流程。
Scenario Description
场景说明
This skill provides ECS extension program query and installation capabilities through Alibaba Cloud OOS (Operation Orchestration Service). Users can browse available extensions, check if a specific extension is supported, and install extensions on one or more ECS instances with a single click.
Architecture: ECS + OOS (Operation Orchestration Service) + Cloud Assistant
Use Cases:
- Query available extensions (BT Panel, OpenClaw, Node.js, Python, etc.)
- Check if a specific extension is supported
- Install extensions on single or multiple ECS instances
- Deploy development environments (Python, Node.js, Java, etc.)
- Install server management panels (BT Panel, etc.)
本技能通过阿里云OOS(运维编排服务)提供ECS扩展程序的查询和安装能力。用户可以浏览可用扩展、检查特定扩展是否支持,并一键在一台或多台ECS实例上安装扩展。
架构:ECS + OOS(Operation Orchestration Service)+ Cloud Assistant
使用场景:
- 查询可用扩展(BT Panel、OpenClaw、Node.js、Python等)
- 检查特定扩展是否支持
- 在单台或多台ECS实例上安装扩展
- 部署开发环境(Python、Node.js、Java等)
- 安装服务器管理面板(BT Panel等)
Prerequisites
前置条件
Pre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed or version too low, seealiyun versionfor installation instructions. Then [MUST] runreferences/cli-installation-guide.mdto enable automatic plugin installation.aliyun configure set --auto-plugin-install truePlugin Installation Fallback: If automatic plugin installation fails (e.g., network errors like), manually install the OOS plugin:connect: bad file descriptorbash# Check if oos plugin is installed aliyun plugin list # If not listed, download and install manually: # 1. Visit https://github.com/aliyun/alibaba-cloud-cli/releases to find the oos plugin package # 2. Download the .tar.gz for your platform # 3. Install: aliyun plugin install --file <path-to-downloaded-plugin.tar.gz> # 4. Verify: aliyun plugin list (should show oos plugin)
Pre-check: Alibaba Cloud Credentials RequiredSecurity Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
is FORBIDDEN)echo $ALIBABA_CLOUD_ACCESS_KEY_ID- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
with literal credential valuesaliyun configure set- ONLY use
to check credential statusaliyun configure listbashaliyun configure listCheck the output for a valid profile (AK, STS, or OAuth identity).If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
in terminal or environment variables in shell profile)aliyun configure- Return and re-run after
shows a valid profilealiyun configure list
Endpoint Note (Plugin Mode): In plugin mode, theflag is typically not needed. The OOS plugin resolves endpoints automatically based on--endpoint. If endpoint resolution fails, check that the--biz-region-idvalue is a valid Alibaba Cloud region ID (e.g.,--biz-region-id).cn-hangzhou
预检查:需要Aliyun CLI >= 3.3.1 运行验证版本是否>=3.3.1。如果未安装或版本过低,请查看aliyun version获取安装说明。 然后【必须】运行references/cli-installation-guide.md启用自动插件安装。aliyun configure set --auto-plugin-install true**插件安装备选方案:**如果自动插件安装失败(例如出现等网络错误),手动安装OOS插件:connect: bad file descriptorbash# 检查oos插件是否已安装 aliyun plugin list # 如果未列出,手动下载并安装: # 1. 访问https://github.com/aliyun/alibaba-cloud-cli/releases查找oos插件包 # 2. 下载对应平台的.tar.gz文件 # 3. 安装:aliyun plugin install --file <path-to-downloaded-plugin.tar.gz> # 4. 验证:aliyun plugin list(应显示oos插件)
预检查:需要阿里云凭证安全规则:
- 【绝对禁止】读取、回显或打印AK/SK值(例如
是禁止操作)echo $ALIBABA_CLOUD_ACCESS_KEY_ID- 【绝对禁止】要求用户直接在对话或命令行中输入AK/SK
- 【绝对禁止】使用
并传入明文凭证值aliyun configure set- 【仅允许】使用
检查凭证状态aliyun configure listbashaliyun configure list检查输出是否包含有效配置文件(AK、STS或OAuth身份)。如果没有有效配置文件,请在此处停止操作:
- 从阿里云控制台获取凭证
- 在本会话外配置凭证(通过终端中的
或shell配置文件中的环境变量)aliyun configure- 当
显示有效配置文件后,返回并重新运行aliyun configure list
**端点说明(插件模式):**在插件模式下,通常不需要参数。OOS插件会根据--endpoint自动解析端点。如果端点解析失败,请检查--biz-region-id值是否为有效的阿里云地域ID(例如--biz-region-id)。cn-hangzhou
AI-Mode & Plugin Update
AI模式与插件更新
[MUST] Before executing anyCLI command in this workflow, run the following initialization commands:aliyunbashaliyun configure ai-mode enable aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension" aliyun plugin updateAfter the entire workflow is complete (all scenarios finished), disable AI-Mode:bashaliyun configure ai-mode disable
【必须】在本工作流中执行任何CLI命令之前,运行以下初始化命令:aliyunbashaliyun configure ai-mode enable aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension" aliyun plugin update整个工作流完成(所有场景结束)后,禁用AI模式:bashaliyun configure ai-mode disable
CLI Command Standards
CLI命令标准
[MUST] Before executing any CLI command, readfor command format standards.references/related-commands.mdKey Rules:
- ALL
CLI commands must use plugin mode (lowercase-hyphenated) for both operation names and flags. This applies to every cloud service, not just OOS. Only lowercase-hyphenated format is allowed — any other format will causealiyunorunknown flagerrors.unknown command- OOS commands:
,list-templates,get-template,start-executionwith flagslist-executions,--biz-region-id,--template-type, etc.--template-name- ECS commands:
,describe-instances,describe-regions,run-command,describe-invocations,describe-invocation-resultswith flagsdescribe-cloud-assistant-status,--region-id,--instance-id, etc.--command-content[RECOMMENDED] Flag Verification: Run(e.g.,aliyun <service> <action> --help) to confirm the exact flags supported by the installed plugin version.aliyun ecs run-command --help
【必须】在执行任何CLI命令之前,请阅读了解命令格式标准。references/related-commands.md核心规则:
- 所有
CLI命令必须对操作名称和参数使用插件模式(小写连字符格式)。这适用于所有云服务,而不仅仅是OOS。【仅允许使用小写连字符格式】——任何其他格式都会导致aliyun或unknown flag错误。unknown command- OOS命令:
、list-templates、get-template、start-execution,搭配参数list-executions、--biz-region-id、--template-type等。--template-name- ECS命令:
、describe-instances、describe-regions、run-command、describe-invocations、describe-invocation-results,搭配参数describe-cloud-assistant-status、--region-id、--instance-id等。--command-content【推荐】参数验证:运行(例如aliyun <service> <action> --help)确认已安装插件版本支持的准确参数。aliyun ecs run-command --help
Required Permissions
所需权限
This skill requires the following RAM permissions:
- (query order details for billing verification)
bss:DescribeOrderDetail - (check Cloud Assistant status)
ecs:DescribeCloudAssistantStatus - (instance information verification)
ecs:DescribeInstances - (list Cloud Assistant command invocations)
ecs:DescribeInvocations - (view command execution results)
ecs:DescribeInvocationResults - (Cloud Assistant command execution during installation)
ecs:RunCommand - (get OOS application group information)
oos:GetApplicationGroup - (get OOS template details)
oos:GetTemplate - (query instance extension package status)
oos:ListInstancePackageStates - (list available extension packages)
oos:ListTemplates - (start OOS execution for installation)
oos:StartExecution - (update instance package state)
oos:UpdateInstancePackageState - (download extension package files from OSS)
oss:GetObject
See for detailed policy configuration.
references/ram-policies.md[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:
- Read
to get the full list of permissions required by this SKILLreferences/ram-policies.md- Use
skill to guide the user through requesting the necessary permissionsram-permission-diagnose- Pause and wait until the user confirms that the required permissions have been granted
本技能需要以下RAM权限:
- (查询订单详情以进行计费验证)
bss:DescribeOrderDetail - (检查Cloud Assistant状态)
ecs:DescribeCloudAssistantStatus - (实例信息验证)
ecs:DescribeInstances - (列出Cloud Assistant命令调用记录)
ecs:DescribeInvocations - (查看命令执行结果)
ecs:DescribeInvocationResults - (安装期间执行Cloud Assistant命令)
ecs:RunCommand - (获取OOS应用组信息)
oos:GetApplicationGroup - (获取OOS模板详情)
oos:GetTemplate - (查询实例扩展包状态)
oos:ListInstancePackageStates - (列出可用扩展包)
oos:ListTemplates - (启动OOS执行以进行安装)
oos:StartExecution - (更新实例包状态)
oos:UpdateInstancePackageState - (从OSS下载扩展包文件)
oss:GetObject
详细的策略配置请查看。
references/ram-policies.md【必须】权限失败处理:在执行过程中任何阶段因权限错误导致命令或API调用失败时,请遵循以下流程:
- 阅读
获取本技能所需的完整权限列表references/ram-policies.md- 使用
技能引导用户申请必要的权限ram-permission-diagnose- 暂停操作,等待用户确认已授予所需权限
Parameter Confirmation
参数确认
IMPORTANT: Parameter Confirmation — Before executing any installation command, ALL user-customizable parameters MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
| Parameter Name | Required/Optional | Description | Default Value |
|---|---|---|---|
| Required | Region where the target instances are located | N/A |
| Required | One or more ECS instance IDs to install the extension on | N/A |
| Required | Extension package name (e.g., | N/A |
| Optional | Installation parameters specific to the extension (version, etc.) | Determined by template |
【重要:参数确认】——在执行任何安装命令之前,所有用户可自定义的参数必须与用户确认。未经用户明确批准,不得假设或使用默认值。
| 参数名称 | 必填/可选 | 描述 | 默认值 |
|---|---|---|---|
| 必填 | 目标实例所在的地域 | N/A |
| 必填 | 要安装扩展的一台或多台ECS实例ID | N/A |
| 必填 | 扩展包名称(例如 | N/A |
| 可选 | 扩展特定的安装参数(版本等) | 由模板决定 |
Input Validation Rules
输入验证规则
[MUST] Before assembling any CLI command, validate ALL user-provided input values. Reject invalid input immediately and prompt the user to correct it. Never pass unvalidated user input into shell command strings.
| Parameter | Validation Rule | Example |
|---|---|---|
| Must match regex | |
| Must be a valid Alibaba Cloud region ID. Validate by calling | |
| Must match regex | |
| Maximum length: 50 instances per execution. | — |
Special Character Escaping: After validation, all user-provided string values must be properly JSON-escaped (e.g., quotes, backslashes) before embedding into theJSON string. Use--Parametersor equivalent tools to construct the JSON payload programmatically rather than manual string concatenation when possible.jq
【必须】在组装任何CLI命令之前,验证所有用户提供的输入值。立即拒绝无效输入并提示用户更正。绝对不要将未验证的用户输入传递到shell命令字符串中。
| 参数 | 验证规则 | 示例 |
|---|---|---|
| 必须匹配正则表达式 | |
| 必须是有效的阿里云地域ID。通过调用 | |
| 必须匹配正则表达式 | |
| 最大长度:每次执行最多50个实例。 | — |
**特殊字符转义:**验证后,所有用户提供的字符串值在嵌入到JSON字符串之前必须进行正确的JSON转义(例如引号、反斜杠)。尽可能使用--Parameters或类似工具以编程方式构造JSON负载,而不是手动字符串拼接。jq
Scenario-Based Routing
基于场景的路由
IMPORTANT: Before starting installation, identify the user's intent and follow the appropriate workflow.
Based on the user's request, route to the appropriate scenario:
| User Intent | Trigger Keywords | Handling Method |
|---|---|---|
| Query Available Extensions | "what extensions", "list", "available extensions", "show me" | Execute Scenario 1 |
| Query Extension Support | "can I install", "is it supported", "do you have", "support" | Execute Scenario 2 |
| Install Extension | "install", "deploy", "one-click install", "set up" | Execute Scenario 3 |
【重要:开始安装前,识别用户意图并遵循相应的工作流程。】
根据用户的请求,路由到相应的场景:
| 用户意图 | 触发关键词 | 处理方式 |
|---|---|---|
| 查询可用扩展 | "what extensions"、"list"、"available extensions"、"show me" | 执行场景1 |
| 查询扩展支持情况 | "can I install"、"is it supported"、"do you have"、"support" | 执行场景2 |
| 安装扩展 | "install"、"deploy"、"one-click install"、"set up" | 执行场景3 |
Scenario 1: Query Available Extensions List
场景1:查询可用扩展列表
When the user asks "What extensions are available?" or similar, follow these steps:
当用户询问“有哪些可用扩展?”或类似问题时,请遵循以下步骤:
Step 1: List Templates
步骤1:列出模板
Call to get all available public extension packages:
list-templatesbash
aliyun oos list-templates \
--biz-region-id cn-hangzhou \
--template-type Package \
--share-type Public \
--max-results 100 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension调用获取所有可用的公共扩展包:
list-templatesbash
aliyun oos list-templates \
--biz-region-id cn-hangzhou \
--template-type Package \
--share-type Public \
--max-results 100 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionStep 2: Parse and Display Results
步骤2:解析并显示结果
Parse the response and present the results in a table format to the user:
| Extension Name | Description | Category |
|---|---|---|
(from TemplateName, prefer | (from | (from |
Note: Thefield is a JSON string containing metadata. Parse it to extract:Description
: Chinese display name (preferred for display)name-zh-cn : English display namename-en : Chinese descriptionzh-cn : English descriptionen : Category tags arraycategories : Chinese documentation linkdoc-zh-cn : English documentation linkdoc-en : Icon URLimageExamplevalue:Descriptionjson"Description": "{\"categories\":[\"application\"],\"en\":\"BaoTa Panel free edition one-click installation\",\"zh-cn\":\"BaoTa Panel free edition one-click installation\",\"name-en\":\"BaoTaPanelFree-One-Click\",\"name-zh-cn\":\"BaoTaPanelFree-One-Click\",\"image\":\"https://oos-public-template.oss-cn-beijing.aliyuncs.com/BaoTaPanelFree/icon.png\"}"
Note: Thein the command is used for API endpoint routing. The returned public templates are available across all regions.--biz-region-id
解析响应并以表格形式向用户展示结果:
| 扩展名称 | 描述 | 分类 |
|---|---|---|
(来自TemplateName,优先使用解析后的Description JSON中的 | (来自解析后的Description JSON中的 | (来自解析后的Description JSON中的 |
注意:字段是包含元数据的JSON字符串。解析它以提取:Description
:中文显示名称(优先用于展示)name-zh-cn :英文显示名称name-en :中文描述zh-cn :英文描述en :分类标签数组categories :中文文档链接doc-zh-cn :英文文档链接doc-en :图标URLimage字段示例:Descriptionjson"Description": "{\"categories\":[\"application\"],\"en\":\"BaoTa Panel free edition one-click installation\",\"zh-cn\":\"宝塔面板免费版一键安装\",\"name-en\":\"BaoTaPanelFree-One-Click\",\"name-zh-cn\":\"宝塔面板免费版一键安装\",\"image\":\"https://oos-public-template.oss-cn-beijing.aliyuncs.com/BaoTaPanelFree/icon.png\"}"
**注意:**命令中的用于API端点路由。返回的公共模板在所有地域都可用。--biz-region-id
Scenario 2: Query if a Specific Extension is Supported
场景2:查询特定扩展是否支持
When the user asks "Can I install XXX?" or similar, follow these steps:
当用户询问“我可以安装XXX吗?”或类似问题时,请遵循以下步骤:
Step 1: List and Search
步骤1:列出并搜索
Call (same as Scenario 1) and search for the extension by keyword:
list-templatesbash
aliyun oos list-templates \
--biz-region-id cn-hangzhou \
--template-type Package \
--share-type Public \
--max-results 100 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension调用(与场景1相同)并按关键词搜索扩展:
list-templatesbash
aliyun oos list-templates \
--biz-region-id cn-hangzhou \
--template-type Package \
--share-type Public \
--max-results 100 \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionStep 2: Match Results
步骤2:匹配结果
- If matched: return the extension details (name, description, supported OS, etc.)
- If not matched: inform the user that the extension is not currently supported, and suggest similar alternatives or Scenario 1 to browse the full list
- 如果匹配:返回扩展详情(名称、描述、支持的操作系统等)
- 如果不匹配:告知用户该扩展目前不支持,并建议类似替代方案或场景1以浏览完整列表
Scenario 3: Install Extension
场景3:安装扩展
This is the core workflow. Follow these steps in strict order:
这是核心工作流程。请严格按顺序遵循以下步骤:
Step 1: Confirm Extension Name
步骤1:确认扩展名称
Confirm the exact extension name the user wants to install.
- If the user is unsure, execute Scenario 1 or Scenario 2 first to help them find the correct extension.
- If the user provides a vague name (e.g., "BT Panel"), search and confirm the exact (e.g.,
TemplateName).ACS-Extension-BaoTaPanelFree-One-Click-1853370294850618
确认用户想要安装的准确扩展名称。
- 如果用户不确定,先执行场景1或场景2帮助他们找到正确的扩展。
- 如果用户提供模糊名称(例如“BT Panel”),搜索并确认准确的(例如
TemplateName)。ACS-Extension-BaoTaPanelFree-One-Click-1853370294850618
Step 2: Get Template Details
步骤2:获取模板详情
Call to retrieve the extension template details. Redirect output to a temporary file to avoid terminal truncation (the field is usually very large):
get-templateContentbash
aliyun oos get-template \
--biz-region-id cn-hangzhou \
--template-name "【Extension-Name】" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension > /tmp/oos-template.jsonThen extract the from the template content:
Parametersbash
jq -r '(.Content | fromjson | .Parameters)' /tmp/oos-template.json[IMPORTANT] Output Truncation Warning:returns aget-templatefield that is typically very large (contains full installation scripts). Always redirect command output to a temporary file (Content) first, then use> /tmp/oos-template.jsonor file read tools to parse. Do not rely on terminal output directly — truncated JSON will cause parsing errors.jq
The field (JSON string) includes:
Content- : defines the installation parameters required (e.g., version number, installation path, etc.)
Parameters - : extension description
Description - : template version
TemplateVersion
Parse and extract all required and optional parameters.
Content.Parameters调用获取扩展模板详情。【将输出重定向到临时文件】以避免终端截断(字段通常非常大):
get-templateContentbash
aliyun oos get-template \
--biz-region-id cn-hangzhou \
--template-name "【扩展名称】" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension > /tmp/oos-template.json然后从模板内容中提取:
Parametersbash
jq -r '(.Content | fromjson | .Parameters)' /tmp/oos-template.json【重要:输出截断警告】返回的get-template字段通常非常大(包含完整的安装脚本)。始终先将命令输出重定向到临时文件(Content),然后使用> /tmp/oos-template.json或文件读取工具进行解析。绝对不要直接依赖终端输出——截断的JSON会导致解析错误。jq
Content- :定义所需的安装参数(例如版本号、安装路径等)
Parameters - :扩展描述
Description - :模板版本
TemplateVersion
解析并提取所有必填和可选参数。
Content.ParametersStep 3: Guide User to Provide Parameters
步骤3:引导用户提供参数
Based on the parsed in Step 2, guide the user to provide necessary values:
Parameters- Required parameters: must obtain user input
- Optional parameters: inform the user of defaults; if the user does not provide, use defaults
[IMPORTANT] Only extract parameters from. Do not infer parameters fromContent.Parametersor other template content — shell variables inside scripts are internal implementation details, not user-configurable parameters.InstallScript
Common parameter examples:
| Parameter | Type | Description |
|---|---|---|
| String | Software version number (e.g., |
| String | Extension package version (e.g., |
Note: Do not fabricate parameter values. Must be obtained from the user or template defaults.
根据步骤2中解析的,引导用户提供必要的值:
Parameters- 必填参数:必须获取用户输入
- 可选参数:告知用户默认值;如果用户未提供,则使用默认值
【重要】仅从提取参数。绝对不要从Content.Parameters或其他模板内容推断参数——脚本中的shell变量是内部实现细节,不是用户可配置的参数。InstallScript
常见参数示例:
| 参数 | 类型 | 描述 |
|---|---|---|
| 字符串 | 软件版本号(例如Node.js的 |
| 字符串 | 扩展包版本(例如 |
**注意:**不要编造参数值。必须从用户或模板默认值获取。
Step 4: Confirm All Parameters
步骤4:确认所有参数
[MUST] Before executing the installation, you MUST output a parameter confirmation table to the user containing ALL of the following items and explicitly ask "Please confirm the above parameters are correct before I proceed with installation." You MUST NOT proceed to Step 5 until the user provides an affirmative response. Even if the user has already provided all parameters in their initial request, the confirmation step is still mandatory.
| Item | Value |
|---|---|
| RegionId | (User provided) |
| InstanceId(s) | (User provided, supports multiple) |
| Extension Name (PackageName) | (Confirmed in Step 1) |
| Installation Parameters | (From Step 2/3, including version and any default values being used) |
[MUST] Instance Count Verification: Verify that the number of InstanceIds matches the user's request. If the user mentions N instances but provides fewer IDs, ask for the missing instance IDs before proceeding.[MUST] Installation operations will modify instance state. Must obtain explicit user confirmation before execution. Do NOT skip this step under any circumstances.
【必须】在执行安装之前,必须向用户输出包含以下所有项的参数确认表格,并明确询问“请确认以上参数正确后,我再继续安装。”在用户提供肯定答复之前,绝对不要进入步骤5。即使用户在初始请求中已提供所有参数,确认步骤仍然是强制性的。
| 项目 | 值 |
|---|---|
| RegionId | (用户提供) |
| InstanceId(s) | (用户提供,支持多个) |
| 扩展名称(PackageName) | (步骤1中确认) |
| 安装参数 | (来自步骤2/3,包括版本和正在使用的任何默认值) |
【必须】实例数量验证:验证InstanceId的数量是否与用户的请求一致。如果用户提到N个实例但提供的ID数量不足,请在继续之前询问缺失的实例ID。【必须】安装操作会修改实例状态。执行前必须获得用户的明确确认。在任何情况下都不得跳过此步骤。
Step 5: Execute Installation
步骤5:执行安装
[MUST] Idempotency Check: Before executing, query whether a running execution already exists for the same extension and target instances:bashaliyun oos list-executions \ --biz-region-id "【User-Provided-Region】" \ --template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL" \ --status Running \ --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionIf a running execution with the sameandpackageNameis found:targets
- Inform the user about the existing execution
- Ask the user whether to wait for it or create a new execution
- If the user does not respond or confirms to proceed, you MUST still call
to create a new execution — do NOT skipstart-executionunder any circumstancesstart-executionThecall is the mandatory core action of this step and must always be executed unless the user explicitly requests to wait for the existing execution.start-execution[RECOMMENDED] ClientToken: Generate a deterministicto prevent duplicate submissions caused by retries. TheClientTokenmust be a string of 1-64 ASCII characters.ClientTokenbash# Generate a deterministic ClientToken and save it for reuse CLIENT_TOKEN="${regionId}-${packageName}-$(date +%Y%m%d%H%M)" # All subsequent retries reuse the same token, ensuring idempotency aliyun oos start-execution \ ... \ --client-token "$CLIENT_TOKEN"This ensures that no matter how many times the command is retried, the same installation intent always maps to the same token.
[MUST] Call to execute the installation task (this call must NOT be skipped):
start-execution[MUST] Parameter Recording: Before executing , save the complete JSON to a file for traceability, then use the file content for the command:
start-execution--parametersbash
undefined【必须】幂等性检查:执行前,查询是否已存在针对同一扩展和目标实例的运行中执行任务:bashaliyun oos list-executions \ --biz-region-id "【用户提供的地域】" \ --template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL" \ --status Running \ --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension如果找到具有相同和packageName的运行中执行任务:targets
- 告知用户存在正在执行的任务
- 询问用户是等待该任务完成还是创建新的执行任务
- 【如果用户未响应或确认继续,必须仍然调用
创建新的执行任务——在任何情况下都不得跳过start-execution】start-execution调用是此步骤的强制性核心操作,除非用户明确要求等待现有执行任务,否则必须始终执行。start-execution【推荐】ClientToken:生成确定性的以避免重试导致的重复提交。ClientToken必须是1-64个ASCII字符组成的字符串。ClientTokenbash# 生成确定性的ClientToken并保存以便重用 CLIENT_TOKEN="${regionId}-${packageName}-$(date +%Y%m%d%H%M)" # 后续所有重试使用相同的token,确保幂等性 aliyun oos start-execution \ ... \ --client-token "$CLIENT_TOKEN"这确保无论命令重试多少次,相同的安装意图始终映射到相同的token。
【必须】调用执行安装任务(此调用不得跳过):
start-execution【必须】参数记录:执行之前,将完整的JSON保存到文件以便追溯,然后使用文件内容执行命令:
start-execution--parametersbash
undefinedSave parameters to file for traceability
将参数保存到文件以便追溯
cat > /tmp/oos-start-params.json << 'PARAMS_EOF'
{"regionId":"【User-Provided-Region】","OOSAssumeRole":"","targets":{"ResourceIds":["【User-Provided-InstanceId】"],"RegionId":"【User-Provided-Region】","Type":"ResourceIds"},"rateControl":{"Mode":"Concurrency","Concurrency":1,"MaxErrors":0},"action":"install","packageName":"【User-Specified-Package】","parameters":【User-Provided-Parameters】}
PARAMS_EOF
cat > /tmp/oos-start-params.json << 'PARAMS_EOF'
{"regionId":"【用户提供的地域】","OOSAssumeRole":"","targets":{"ResourceIds":["【用户提供的InstanceId】"],"RegionId":"【用户提供的地域】","Type":"ResourceIds"},"rateControl":{"Mode":"Concurrency","Concurrency":1,"MaxErrors":0},"action":"install","packageName":"【用户指定的包】","parameters":【用户提供的参数】}
PARAMS_EOF
Execute with parameters from file
使用文件中的参数执行命令
aliyun oos start-execution
--biz-region-id "【User-Provided-Region】"
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL"
--mode "Automatic"
--tags "{}"
--parameters "$(cat /tmp/oos-start-params.json)"
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension
--biz-region-id "【User-Provided-Region】"
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL"
--mode "Automatic"
--tags "{}"
--parameters "$(cat /tmp/oos-start-params.json)"
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension
**[MUST]** After executing, log the key parameter values that were passed:Parameters passed to OOS:
- packageName: <actual value>
- packageVersion: <actual value, if applicable>
- parameters.version: <actual value, if applicable>
- targets.ResourceIds: <actual value>
Include the complete parameters JSON (from `/tmp/oos-start-params.json`) in the Installation Report's "Installation Parameters" field.
**Parameter Description:**
| Parameter | Description |
|-----------|-------------|
| `regionId` | Must be consistent with `--biz-region-id` |
| `targets.ResourceIds` | Array of instance IDs to install on |
| `targets.RegionId` | Must be consistent with `--biz-region-id` |
| `targets.Type` | Fixed value `ResourceIds` |
| `rateControl.Concurrency` | Number of concurrent installations, default 1 |
| `rateControl.MaxErrors` | Maximum number of errors allowed, default 0 |
| `action` | Fixed value `install` |
| `packageName` | Extension package name |
| `parameters` | Extension-specific installation parameters (JSON object) |
**Example:**
```bash
aliyun oos start-execution \
--biz-region-id cn-hangzhou \
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL" \
--mode "Automatic" \
--tags "{}" \
--parameters "{\"regionId\":\"cn-hangzhou\",\"OOSAssumeRole\":\"\",\"targets\":{\"ResourceIds\":[\"i-bp12z30vh0xxxxxxxxxx\"],\"RegionId\":\"cn-hangzhou\",\"Type\":\"ResourceIds\"},\"rateControl\":{\"Mode\":\"Concurrency\",\"Concurrency\":1,\"MaxErrors\":0},\"action\":\"install\",\"packageName\":\"ACS-Extension-node-1853370294850618\",\"packageVersion\":\"v27\",\"parameters\":{\"version\":\"v22.13.1\"}}" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionaliyun oos start-execution
--biz-region-id "【用户提供的地域】"
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL"
--mode "Automatic"
--tags "{}"
--parameters "$(cat /tmp/oos-start-params.json)"
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension
--biz-region-id "【用户提供的地域】"
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL"
--mode "Automatic"
--tags "{}"
--parameters "$(cat /tmp/oos-start-params.json)"
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension
【必须】执行后,记录传递的关键参数值:传递给OOS的参数:
- packageName: <实际值>
- packageVersion: <实际值(如有)>
- parameters.version: <实际值(如有)>
- targets.ResourceIds: <实际值>
将完整的参数JSON(来自`/tmp/oos-start-params.json`)包含在安装报告的“安装参数”字段中。
**参数说明:**
| 参数 | 描述 |
|-----------|-------------|
| `regionId` | 必须与`--biz-region-id`一致 |
| `targets.ResourceIds` | 要安装的实例ID数组 |
| `targets.RegionId` | 必须与`--biz-region-id`一致 |
| `targets.Type` | 固定值`ResourceIds` |
| `rateControl.Concurrency` | 并发安装数量,默认值1 |
| `rateControl.MaxErrors` | 允许的最大错误数,默认值0 |
| `action` | 固定值`install` |
| `packageName` | 扩展包名称 |
| `parameters` | 扩展特定的安装参数(JSON对象) |
**示例:**
```bash
aliyun oos start-execution \
--biz-region-id cn-hangzhou \
--template-name "ACS-ECS-BulkyConfigureOOSPackageWithTemporaryURL" \
--mode "Automatic" \
--tags "{}" \
--parameters "{\"regionId\":\"cn-hangzhou\",\"OOSAssumeRole\":\"\",\"targets\":{\"ResourceIds\":[\"i-bp12z30vh0xxxxxxxxxx\"],\"RegionId\":\"cn-hangzhou\",\"Type\":\"ResourceIds\"},\"rateControl\":{\"Mode\":\"Concurrency\",\"Concurrency\":1,\"MaxErrors\":0},\"action\":\"install\",\"packageName\":\"ACS-Extension-node-1853370294850618\",\"packageVersion\":\"v27\",\"parameters\":{\"version\":\"v22.13.1\"}}" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionStep 6: Check Execution Result and Verify
步骤6:检查执行结果并验证
After the command returns, extract from the response and poll the execution status:
ExecutionIdbash
aliyun oos list-executions \
--biz-region-id "【User-Provided-Region】" \
--execution-id "【ExecutionId-from-Response】" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionPolling Strategy: Check execution status every 20 seconds. If the status is still, wait 20 seconds and check again. Maximum wait time is 20 minutes (60 checks).Running[MUST] Terminal Status Requirement: You MUST continue polling until the execution reaches a terminal status (,Success, orFailed). While the status isCancelled, it is absolutely forbidden to generate the Installation Report. You may ONLY stop polling and generate a report in these two cases:Running
- The execution has reached a terminal status (
,Success, orFailed)Cancelled- You have polled for the full 20 minutes (60 checks at 20-second intervals) and the status is still
— in this case, output a PENDING report with Execution Status set toRunningand include in Result Details: "Installation is still in progress, exceeded the 20-minute maximum wait time. Please check status manually using:Pending (timed out after 20 minutes)"aliyun oos list-executions --biz-region-id <region> --execution-id <exec-id> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extensionAny other situation (e.g., polling fewer than 60 times while status is still) absolutely forbids generating a report. You must keep polling.Running
Installation status explanation:
| Status | Description |
|---|---|
| Installation in progress — wait 20 seconds and check again. Do NOT output the report yet. |
| Installation successful — proceed to generate the report |
| Installation failed — view |
| Installation cancelled — generate the report |
命令返回后,从响应中提取并轮询执行状态:
ExecutionIdbash
aliyun oos list-executions \
--biz-region-id "【用户提供的地域】" \
--execution-id "【响应中的ExecutionId】" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension**轮询策略:**每20秒检查一次执行状态。如果状态仍为,等待20秒后再次检查。【最长等待时间为20分钟】(60次检查)。Running【必须】终端状态要求:必须持续轮询直到执行达到终端状态(、Success或Failed)。当状态为Cancelled时,绝对禁止生成安装报告。只有在以下两种情况下才能停止轮询并生成报告:Running
- 执行已达到终端状态(
、Success或Failed)Cancelled- 已轮询满20分钟(60次20秒间隔的检查)且状态仍为
——在这种情况下,输出PENDING报告,执行状态设置为Running,并在结果详情中包含:“安装仍在进行中,已超过20分钟最长等待时间。请使用以下命令手动检查状态:Pending (timed out after 20 minutes)”aliyun oos list-executions --biz-region-id <region> --execution-id <exec-id> --user-agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-install-extension【任何其他情况(例如轮询次数少于60次且状态仍为)绝对禁止生成报告。必须继续轮询。】Running
安装状态说明:
| 状态 | 描述 |
|---|---|
| 安装进行中——等待20秒后再次检查。【请勿输出报告。】 |
| 安装成功——继续生成报告 |
| 安装失败——查看 |
| 安装已取消——生成报告 |
Installation Report Output Format
安装报告输出格式
[MUST] Only generate this report when one of the following conditions is met:
- The execution has reached a terminal status (
,Success,Failed)Cancelled- You have polled for the full 20 minutes (60 checks) and the status is still
(report asRunning)Pending (timed out after 20 minutes)It is absolutely forbidden to generate this report if polling has not reached 60 checks and the status is still. You must keep polling.Running
================== ECS Extension Installation Report ==================
【Extension Name】 : (Extension package name)
【Installation Target】 : (List of instance IDs)
【Installation Parameters】: (JSON-formatted installation parameters)
【Execution ID】 : (OOS ExecutionId)
【Execution Status】 : (Success / Failed / Cancelled / Pending-timed out)
【Completion Time】 : (Execution end time, or "N/A — still running" if timed out)
【Result Details】 : (Execution output or error information)
【Follow-up Suggestions】 :
1. (Suggestion 1, e.g., verify service status)
2. (Suggestion 2, e.g., security group port opening)
3. (Suggestion 3, e.g., check installation logs)
=======================================================================【必须】仅在以下条件之一满足时生成此报告:
- 执行已达到终端状态(
、Success或Failed)Cancelled- 已轮询满20分钟(60次检查)且状态仍为
(报告为Running)Pending (timed out after 20 minutes)【如果轮询次数未达到60次且状态仍为,绝对禁止生成此报告。必须继续轮询。】Running
================== ECS扩展安装报告 ==================
【扩展名称】 : (扩展包名称)
【安装目标】 : (实例ID列表)
【安装参数】: (JSON格式的安装参数)
【执行ID】 : (OOS ExecutionId)
【执行状态】 : (Success / Failed / Cancelled / Pending-timed out)
【完成时间】 : (执行结束时间,如果超时则为"N/A — 仍在运行")
【结果详情】 : (执行输出或错误信息)
【后续建议】 :
1. (建议1,例如验证服务状态)
2. (建议2,例如安全组端口开放)
3. (建议3,例如检查安装日志)
=======================================================================Best Practices
最佳实践
- Confirm parameters before installation — Extension installation will modify the instance environment; must confirm all parameters with the user before execution
- Check instance status — Ensure the target instance is in the state before installation
Running - Choose the correct version — Version parameters vary by extension; obtain the correct version number from the user
- Multiple instances supported — supports arrays; can install the same extension on multiple instances at once
ResourceIds - Security awareness — Never expose AK/SK in commands or reports
- 安装前确认参数——扩展安装会修改实例环境;执行前必须与用户确认所有参数
- 检查实例状态——安装前确保目标实例处于状态
Running - 选择正确版本——不同扩展的版本参数不同;从用户处获取正确的版本号
- 支持多实例——支持数组;可同时在多个实例上安装同一扩展
ResourceIds - 安全意识——切勿在命令或报告中暴露AK/SK
Reference Links
参考链接
| Document | Description |
|---|---|
| Related Commands | CLI command standards and all commands reference |
| RAM Policies | Required RAM permissions list |
| CLI Installation Guide | Aliyun CLI installation instructions |
| 文档 | 描述 |
|---|---|
| 相关命令 | CLI命令标准和所有命令参考 |
| RAM策略 | 所需RAM权限列表 |
| CLI安装指南 | Aliyun CLI安装说明 |
Notes
注意事项
- Extension installation may take several minutes; wait patiently and regularly query execution status
- On API failure, read error messages, check permissions, and retry
- Sensitive information (AccessKey, passwords) must never appear in reports or commands
- Some extensions may require specific operating system versions; confirm OS compatibility in response
get-template - Extension installation failures are usually caused by: instance not running, network issues, incompatible OS versions, or insufficient disk space
- 扩展安装可能需要几分钟时间;请耐心等待并定期查询执行状态
- API失败时,读取错误信息、检查权限并重试
- 敏感信息(AccessKey、密码)绝对不得出现在报告或命令中
- 部分扩展可能需要特定的操作系统版本;在响应中确认操作系统兼容性
get-template - 扩展安装失败通常由以下原因导致:实例未运行、网络问题、操作系统版本不兼容或磁盘空间不足