alibabacloud-odps-quota-manage
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMaxCompute Quota Management
MaxCompute 配额管理
Manage MaxCompute (ODPS) Quota resources using Alibaba Cloud CLI and SDK. This skill covers pay-as-you-go quota creation, quota query, and quota listing operations.
Solution Source: Based on odps-open-api-example/quota-manage
使用阿里云 CLI 和 SDK 管理 MaxCompute (ODPS) 配额资源。本技能覆盖按量付费配额创建、配额查询和配额列表操作。
Limitations and Notes
限制与注意事项
| Feature | CLI Support | SDK Support | Notes |
|---|---|---|---|
| Create Pay-as-you-go Quota | ✅ Yes | ✅ Yes | Fully supported |
| Create Subscription Quota | ❌ Not Supported | ❌ Not Supported | Temporarily unavailable |
| Query Quota (GetQuota) | ✅ Yes | ✅ Yes | ⚠️ Deprecated - Use QueryQuota instead |
| Query Quota (QueryQuota) | ✅ Yes | ✅ Yes | Recommended replacement for GetQuota |
| List Quotas | ✅ Yes | ✅ Yes | Fully supported (both payasyougo and subscription) |
| Delete Quota | ❌ No API | ❌ No API | Not available via API - Must use Console |
| Modify Quota | ❌ Not in scope | ❌ Not in scope | Not covered in this solution |
Important:
- Create Subscription Quota is temporarily NOT supported in this skill. For subscription quota creation, please use the Alibaba Cloud Console.
- Delete Quota operation is NOT available through CLI or SDK. You must use the Alibaba Cloud Console to delete quotas.
- QueryQuota is preferred - GetQuota is deprecated but acceptable if it returns success
- ⚠️ CRITICAL: When checking if quota exists, ALWAYS use ListQuotas API, NEVER use GetQuota
- 🚨 MANDATORY: Before CreateQuota, MUST call ListQuotas first - NEVER skip this step
| 功能 | CLI 支持 | SDK 支持 | 备注 |
|---|---|---|---|
| 创建按量付费配额 | ✅ 支持 | ✅ 支持 | 完全支持 |
| 创建包年包月配额 | ❌ 不支持 | ❌ 不支持 | 暂不可用 |
| 查询配额(GetQuota) | ✅ 支持 | ✅ 支持 | ⚠️ 已废弃 - 请使用 QueryQuota 替代 |
| 查询配额(QueryQuota) | ✅ 支持 | ✅ 支持 | 推荐替代 GetQuota 的方案 |
| 列出配额 | ✅ 支持 | ✅ 支持 | 完全支持(包含按量付费和包年包月) |
| 删除配额 | ❌ 无对应 API | ❌ 无对应 API | 无法通过 API 操作 - 必须使用控制台 |
| 修改配额 | ❌ 不在覆盖范围内 | ❌ 不在覆盖范围内 | 本方案不涉及相关操作 |
重要提示:
Architecture
架构
Alibaba Cloud Account → MaxCompute Service → Quota Resources (CU)
├── Pay-as-you-go Quota (后付费) ← **Creation Supported**
└── Subscription Quota (预付费) ← Query/List onlyAlibaba Cloud Account → MaxCompute Service → Quota Resources (CU)
├── Pay-as-you-go Quota (后付费) ← **支持创建**
└── Subscription Quota (预付费) ← 仅支持查询/列表Installation
安装
Pre-check: Aliyun CLI >= 3.3.1 required Runto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun versionto enable automatic plugin installation.aliyun configure set --auto-plugin-install true
bash
undefined前置检查:要求 Aliyun CLI 版本 >= 3.3.1 运行确认版本 >= 3.3.1。如果未安装或版本过低,请参考 references/cli-installation-guide.md 的安装指引。然后**[必须]**运行aliyun version开启自动插件安装功能。aliyun configure set --auto-plugin-install true
bash
undefinedVerify CLI version
验证 CLI 版本
aliyun version
aliyun version
Enable auto plugin installation
开启自动插件安装
aliyun configure set --auto-plugin-install true
undefinedaliyun configure set --auto-plugin-install true
undefinedEnvironment Variables
环境变量
| Variable | Required | Description |
|---|---|---|
| Yes | Alibaba Cloud Access Key ID |
| Yes | Alibaba Cloud Access Key Secret |
| 变量 | 必填 | 描述 |
|---|---|---|
| 是 | 阿里云 Access Key ID |
| 是 | 阿里云 Access Key Secret |
Parameter Confirmation
参数确认
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, quota nicknames, billing types, etc.) 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 | Alibaba Cloud region (e.g., cn-hangzhou, cn-shanghai) | - |
| Required | Billing type: | - |
| Required | Product code (see table below) | - |
| Optional | Filter for listing: | |
| Optional | Max items per page for listing | |
重要提示:参数确认 — 执行任何命令或 API 调用前,所有用户可自定义参数(例如 RegionId、配额别名、计费类型等)必须与用户确认。没有用户明确批准的情况下,不要假设参数值或使用默认值。
| 参数名称 | 必填/可选 | 描述 | 默认值 |
|---|---|---|---|
| 必填 | 阿里云区域(例如 cn-hangzhou、cn-shanghai) | - |
| 必填 | 计费类型:仅支持 | - |
| 必填 | 产品编码(见下表) | - |
| 可选 | 列表过滤条件: | |
| 可选 | 列表每页最大返回条数 | |
Commodity Codes (for Pay-as-you-go)
按量付费产品编码
| Site | Commodity Code |
|---|---|
| China (国内站) | |
| International (国际站) | |
| 站点 | 产品编码 |
|---|---|
| 国内站 | |
| 国际站 | |
Authentication
身份认证
Security: Never expose credentials
- Don't print AK/SK values
- Don't ask user to type AK/SK in chat
- Don't use with hardcoded values
aliyun configure set
Check credentials:
bash
aliyun configure listIf no credentials, ask user to run first, then continue.
aliyun configure安全提示:永远不要泄露凭证
- 不要打印 AK/SK 数值
- 不要要求用户在聊天中输入 AK/SK
- 不要使用硬编码值执行
aliyun configure set
检查凭证:
bash
aliyun configure list如果没有凭证,要求用户先运行 配置凭证,再继续操作。
aliyun configureCore Workflow
核心工作流
🚨 CRITICAL RULE FOR ALL OPERATIONS:
| Operation | First Command | Then |
|---|---|---|
| CREATE quota | | If empty → Create; If exists → Stop |
| QUERY quota | | Show results |
| LIST quotas | | Show list |
⚠️ CREATE without ListQuotas first = ERROR
FORBIDDEN COMMANDS - NEVER USE:
- ❌ - WRONG CASE (kebab-case), use PascalCase
aliyun maxcompute create-quotaCreateQuota - ❌ - DEPRECATED, use
aliyun maxcompute GetQuotainsteadquery-quota - ❌ - WRONG API (BssOpenApi), use MaxCompute CreateQuota instead
aliyun bssopenapi CreateInstance - ❌ - WRONG API for listing quotas, use MaxCompute ListQuotas instead
aliyun bssopenapi QueryAvailableInstances - ❌ commands - WRONG SERVICE (Quota Center), use MaxCompute instead
aliyun quotas
MUST USE INSTEAD:
- ✅ - For listing/checking quotas (MaxCompute service, NOT BssOpenApi)
aliyun maxcompute list-quotas - ✅ - For querying quota details (MaxCompute service)
aliyun maxcompute query-quota - ✅ - For creating quota (MaxCompute service)
aliyun maxcompute CreateQuota
⚠️ IMPORTANT: Use commands (MaxCompute service), NOT commands (Quota Center service).
aliyun maxcomputealiyun quotasCommand Case Rules:
- API actions use PascalCase:
CreateQuota - CLI commands use kebab-case: ,
list-quotasquery-quota
🚨 所有操作的关键规则:
| 操作 | 第一个执行的命令 | 后续操作 |
|---|---|---|
| 创建配额 | | 结果为空 → 创建;结果存在 → 终止操作 |
| 查询配额 | | 展示结果 |
| 列出配额 | | 展示列表 |
⚠️ 创建配额前未先调用 ListQuotas = 错误
禁用命令 - 绝对不要使用:
- ❌ - 命名格式错误(短横线命名),请使用大驼峰命名的
aliyun maxcompute create-quotaCreateQuota - ❌ - 已废弃,请使用
aliyun maxcompute GetQuota替代query-quota - ❌ - 调用 API 错误(BssOpenApi),请使用 MaxCompute 的 CreateQuota 替代
aliyun bssopenapi CreateInstance - ❌ - 列出配额调用 API 错误,请使用 MaxCompute 的 ListQuotas 替代
aliyun bssopenapi QueryAvailableInstances - ❌ 相关命令 - 调用服务错误(配额中心),请使用 MaxCompute 服务相关命令
aliyun quotas
必须使用的对应命令:
- ✅ - 用于列出/检查配额(MaxCompute 服务,非 BssOpenApi)
aliyun maxcompute list-quotas - ✅ - 用于查询配额详情(MaxCompute 服务)
aliyun maxcompute query-quota - ✅ - 用于创建配额(MaxCompute 服务)
aliyun maxcompute CreateQuota
⚠️ 重要提示:使用 相关命令(MaxCompute 服务),不要使用 相关命令(配额中心服务)。
aliyun maxcomputealiyun quotas命令命名规则:
- API 动作使用大驼峰命名:
CreateQuota - CLI 命令使用短横线命名:、
list-quotasquery-quota
CREATE Quota (CHECK FIRST - THEN CREATE):
创建配额(先检查 - 再创建):
🚨 PREPAID/SUBSCRIPTION QUOTAS ARE FORBIDDEN:
This skill ONLY supports pay-as-you-go quota creation.
- If user wants prepaid/subscription quota → Tell them to use Alibaba Cloud Console
- Do NOT attempt to create prepaid quotas
🚨 FOR CREATE: FIRST RUN LISTQUOTAS - NEVER SKIP THIS:
STEP 1 - MANDATORY: Call ListQuotas FIRST
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region <R>DO NOT proceed to Step 2 until you get ListQuotas result
Use MaxCompute service (), NOT Quota Center ().
aliyun maxcomputealiyun quotasAFTER ListQuotas result (STEP 2):
| Result | Action |
|---|---|
| List shows quota | DO NOT CREATE - Inform user "Quota already exists" → Done |
| List is empty | Go to Step 3 (Create) |
STEP 3 - ONLY IF LIST WAS EMPTY:
PRE-CREATE CHECKLIST - ALL MUST BE TRUE:
- User wants pay-as-you-go (NOT prepaid/subscription)
- ListQuotas was called and returned empty list
- No existing pay-as-you-go quota in the region
- User confirmed they want to create
bash
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps --region <R>For International Site:
bash
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps_intl --region <R>CRITICAL:
- Use (PascalCase), NOT
CreateQuota(kebab-case)create-quota - FORBIDDEN: ,
create-quota, or any kebab-case variantcreate-quota-odps-paygo - Use MaxCompute CreateQuota, NOT BssOpenApi CreateInstance
- Do NOT use
aliyun bssopenapi CreateInstance - commodityCode values:
- China site: or
odpsodpsplus - International site: or
odps_intlodpsplus_intl - NEVER use as commodityCode
maxcompute - Note: When is set, commodityCode validation is not strict
chargeType=payasyougo
- China site:
FINALLY:
- Parse result
- Show user
- Done
⚠️ NEVER call CreateQuota before ListQuotas. This causes errors.
Note: If quota already exists, DO NOT create. Only create when ListQuotas returns empty list.
🚨 禁止创建预付费/包年包月配额:
本技能仅支持创建按量付费配额。
- 如果用户需要预付费/包年包月配额 → 告知用户使用阿里云控制台操作
- 不要尝试创建预付费配额
🚨 创建操作要求:必须先运行 ListQuotas - 绝对不要跳过:
步骤 1 - 强制要求:先调用 ListQuotas
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region <R>获取到 ListQuotas 结果前,不要继续执行步骤 2
使用 MaxCompute 服务命令(),不要使用配额中心命令()。
aliyun maxcomputealiyun quotas获取 ListQuotas 结果后(步骤 2):
| 结果 | 操作 |
|---|---|
| 列表展示对应配额 | 不要创建 - 告知用户“配额已存在” → 操作完成 |
| 列表为空 | 进入步骤 3(创建) |
步骤 3 - 仅当列表为空时执行:
创建前检查清单 - 所有项必须满足:
- 用户需要的是按量付费配额(非预付费/包年包月)
- 已调用 ListQuotas 且返回空列表
- 当前区域不存在已有的按量付费配额
- 用户已确认需要创建配额
bash
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps --region <R>国际站使用命令:
bash
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps_intl --region <R>关键提示:
- 使用 (大驼峰命名),不要使用
CreateQuota(短横线命名)create-quota - 禁用: 、
create-quota或任何短横线命名的变体create-quota-odps-paygo - 使用 MaxCompute 的 CreateQuota,不要使用 BssOpenApi 的 CreateInstance
- 不要使用
aliyun bssopenapi CreateInstance - commodityCode 取值:
- 国内站:或
odpsodpsplus - 国际站:或
odps_intlodpsplus_intl - 绝对不要使用 作为 commodityCode
maxcompute - 注意:设置 时,commodityCode 校验不会很严格
chargeType=payasyougo
- 国内站:
最后:
- 解析返回结果
- 展示给用户
- 操作完成
⚠️ 永远不要在调用 ListQuotas 前调用 CreateQuota,这会导致错误。
注意:如果配额已存在,不要创建。仅当 ListQuotas 返回空列表时才执行创建操作。
QUERY Quota (when user provides nickname):
查询配额(用户提供配额别名时):
PRIORITY: Use as the primary API for querying specific quota details by nickname.
query-quotaCHECKLIST:
- User provided quota nickname
- Use (NOT
query-quota)GetQuota
USE THIS COMMAND:
bash
aliyun maxcompute query-quota --nickname <N> --region <R>IMPORTANT: If nickname contains Chinese characters, URL-encode it first before passing to the command.
FORBIDDEN: - use instead.
aliyun maxcompute GetQuotaquery-quota- Parse JSON
- Extract: ,
nickName,name,idstatus - Show all fields → Done
优先级: 使用 作为通过别名查询指定配额详情的主 API。
query-quota检查清单:
- 用户已提供配额别名
- 使用 (非
query-quota)GetQuota
使用命令:
bash
aliyun maxcompute query-quota --nickname <N> --region <R>重要提示:如果别名包含中文字符,传入命令前需要先进行 URL 编码。
禁用: - 请使用 替代。
aliyun maxcompute GetQuotaquery-quota- 解析 JSON 结果
- 提取字段:、
nickName、name、idstatus - 展示所有字段 → 操作完成
LIST Quotas:
列出配额:
⚠️ FOR LISTING QUOTAS: ONLY use MaxCompute ListQuotas, NOT BssOpenApi QueryAvailableInstances
When checking for existing pay-as-you-go quotas (before creation):
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region <R>MUST include to filter at API level.
--billing-type payasyougoWhen listing all quotas (user request):
bash
aliyun maxcompute list-quotas --billing-type ALL --region <R>billingType parameter:
-
Valid values:,
payasyougo,subscriptionALL -
If not set, defaults to
ALL -
Usewhen checking for existing pay-as-you-go quotas
payasyougo -
Parse JSON
-
Extractarray
quotaInfoList -
Show list → Done
⚠️ 列出配额时:仅使用 MaxCompute 的 ListQuotas,不要使用 BssOpenApi 的 QueryAvailableInstances
创建前检查已有的按量付费配额时:
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region <R>必须包含 在 API 层面过滤结果。
--billing-type payasyougo用户要求列出所有配额时:
bash
aliyun maxcompute list-quotas --billing-type ALL --region <R>billingType 参数说明:
-
合法取值:、
payasyougo、subscriptionALL -
未设置时默认值为
ALL -
检查已有的按量付费配额时使用
payasyougo -
解析 JSON 结果
-
提取数组
quotaInfoList -
展示列表 → 操作完成
Quick Reference
快速参考
See references/related-apis.md for complete CLI command reference and response format details.
Key Points:
- Use before creating
list-quotas --billing-type payasyougo - Use (not
query-quota) for queryingget-quota - Use (PascalCase) for creating
CreateQuota - Always include
--user-agent AlibabaCloud-Agent-Skills
完整的 CLI 命令参考和返回格式详情请查看 references/related-apis.md。
核心要点:
- 创建前使用 检查
list-quotas --billing-type payasyougo - 查询时使用 (而非
query-quota)get-quota - 创建时使用 (大驼峰命名)
CreateQuota - 始终添加 参数
--user-agent AlibabaCloud-Agent-Skills
Task Completion
任务完成
Finish with:
- Summary of what was done
- Key results (nickname, region, status)
- "✅ Complete"
结束时需包含:
- 已完成操作的总结
- 核心结果(别名、区域、状态)
- "✅ 操作完成"
Error Handling
错误处理
| Error Code | What to Do |
|---|---|
| Quota exists → Query it and show details → Task complete |
| Quota doesn't exist → Inform user |
| Wrong parameter format → Check with user |
| No permission → Direct to Console |
| Retry once or contact support |
| 错误码 | 处理方式 |
|---|---|
| 配额已存在 → 查询并展示详情 → 任务完成 |
| 配额不存在 → 告知用户 |
| 参数格式错误 → 和用户核对参数 |
| 无权限 → 引导用户使用控制台操作 |
| 重试一次或联系支持 |
Cleanup
清理
API Reference
API 参考
See references/related-apis.md for complete API reference, CLI commands, and response formats.
完整的 API 参考、CLI 命令和返回格式请查看 references/related-apis.md。
Best Practices
最佳实践
- Always confirm region with user before any operation
- For creation: First list to check if quota exists (one per region limit)
- If quota exists: Query it for user instead of trying to create
- Use query-quota (NOT get-quota) for quota details
- For subscription quotas: Direct user to Alibaba Cloud Console
- 任何操作前始终和用户确认区域
- 创建操作:先列表检查配额是否存在(单区域配额限制)
- 配额已存在时:为用户查询配额详情,不要尝试创建
- 查询配额详情使用 (而非
query-quota)get-quota - 包年包月配额相关需求:引导用户使用阿里云控制台操作
Reference Links
参考链接
| Reference | Description |
|---|---|
| references/related-apis.md | Complete CLI commands and API reference |
| references/ram-policies.md | Required RAM permissions |
| references/verification-method.md | Success verification steps |
| references/acceptance-criteria.md | Testing acceptance criteria |
| references/cli-installation-guide.md | CLI installation guide |
| 参考文档 | 描述 |
|---|---|
| references/related-apis.md | 完整的 CLI 命令和 API 参考 |
| references/ram-policies.md | 所需的 RAM 权限 |
| references/verification-method.md | 成功验证步骤 |
| references/acceptance-criteria.md | 测试验收标准 |
| references/cli-installation-guide.md | CLI 安装指引 |