alibabacloud-odps-quota-manage

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

MaxCompute 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

限制与注意事项

FeatureCLI SupportSDK SupportNotes
Create Pay-as-you-go Quota✅ Yes✅ YesFully supported
Create Subscription Quota❌ Not Supported❌ Not SupportedTemporarily unavailable
Query Quota (GetQuota)✅ Yes✅ Yes⚠️ Deprecated - Use QueryQuota instead
Query Quota (QueryQuota)✅ Yes✅ YesRecommended replacement for GetQuota
List Quotas✅ Yes✅ YesFully supported (both payasyougo and subscription)
Delete Quota❌ No API❌ No APINot available via API - Must use Console
Modify Quota❌ Not in scope❌ Not in scopeNot 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 操作 - 必须使用控制台
修改配额❌ 不在覆盖范围内❌ 不在覆盖范围内本方案不涉及相关操作
重要提示
  • 本技能暂不支持创建包年包月配额,如需创建包年包月配额,请使用阿里云控制台
  • 无法通过 CLI 或 SDK 执行删除配额操作,你必须使用阿里云控制台删除配额。
  • 优先使用 QueryQuota - GetQuota 已废弃,但若返回成功也可接受
  • ⚠️ 关键提示:检查配额是否存在时,始终使用 ListQuotas API,绝对不要使用 GetQuota
  • 🚨 强制要求:创建配额前,必须先调用 ListQuotas - 绝对不要跳过该步骤

Architecture

架构

Alibaba Cloud Account → MaxCompute Service → Quota Resources (CU)
                                           ├── Pay-as-you-go Quota (后付费) ← **Creation Supported**
                                           └── Subscription Quota (预付费) ← Query/List only
Alibaba Cloud Account → MaxCompute Service → Quota Resources (CU)
                                           ├── Pay-as-you-go Quota (后付费) ← **支持创建**
                                           └── Subscription Quota (预付费) ← 仅支持查询/列表

Installation

安装

Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun version
to verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] run
aliyun configure set --auto-plugin-install true
to enable automatic plugin installation.
bash
undefined
前置检查:要求 Aliyun CLI 版本 >= 3.3.1 运行
aliyun version
确认版本 >= 3.3.1。如果未安装或版本过低,请参考 references/cli-installation-guide.md 的安装指引。然后**[必须]**运行
aliyun configure set --auto-plugin-install true
开启自动插件安装功能。
bash
undefined

Verify CLI version

验证 CLI 版本

aliyun version
aliyun version

Enable auto plugin installation

开启自动插件安装

aliyun configure set --auto-plugin-install true
undefined
aliyun configure set --auto-plugin-install true
undefined

Environment Variables

环境变量

VariableRequiredDescription
ALIBABA_CLOUD_ACCESS_KEY_ID
YesAlibaba Cloud Access Key ID
ALIBABA_CLOUD_ACCESS_KEY_SECRET
YesAlibaba Cloud Access Key Secret
变量必填描述
ALIBABA_CLOUD_ACCESS_KEY_ID
阿里云 Access Key ID
ALIBABA_CLOUD_ACCESS_KEY_SECRET
阿里云 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 NameRequired/OptionalDescriptionDefault Value
RegionId
RequiredAlibaba Cloud region (e.g., cn-hangzhou, cn-shanghai)-
chargeType
RequiredBilling type:
payasyougo
only (subscription not supported)
-
commodityCode
RequiredProduct code (see table below)-
billingType
OptionalFilter for listing:
subscription
or
payasyougo
or
ALL
ALL
maxItem
OptionalMax items per page for listing
100
重要提示:参数确认 — 执行任何命令或 API 调用前,所有用户可自定义参数(例如 RegionId、配额别名、计费类型等)必须与用户确认。没有用户明确批准的情况下,不要假设参数值或使用默认值。
参数名称必填/可选描述默认值
RegionId
必填阿里云区域(例如 cn-hangzhou、cn-shanghai)-
chargeType
必填计费类型:仅支持
payasyougo
(不支持包年包月)
-
commodityCode
必填产品编码(见下表)-
billingType
可选列表过滤条件:
subscription
payasyougo
ALL
ALL
maxItem
可选列表每页最大返回条数
100

Commodity Codes (for Pay-as-you-go)

按量付费产品编码

SiteCommodity Code
China (国内站)
odps
International (国际站)
odps_intl
站点产品编码
国内站
odps
国际站
odps_intl

Authentication

身份认证

Security: Never expose credentials
  • Don't print AK/SK values
  • Don't ask user to type AK/SK in chat
  • Don't use
    aliyun configure set
    with hardcoded values
Check credentials:
bash
aliyun configure list
If no credentials, ask user to run
aliyun configure
first, then continue.
安全提示:永远不要泄露凭证
  • 不要打印 AK/SK 数值
  • 不要要求用户在聊天中输入 AK/SK
  • 不要使用硬编码值执行
    aliyun configure set
检查凭证:
bash
aliyun configure list
如果没有凭证,要求用户先运行
aliyun configure
配置凭证,再继续操作。

Core Workflow

核心工作流

🚨 CRITICAL RULE FOR ALL OPERATIONS:
OperationFirst CommandThen
CREATE quota
list-quotas
If empty → Create; If exists → Stop
QUERY quota
query-quota
Show results
LIST quotas
list-quotas
Show list
⚠️ CREATE without ListQuotas first = ERROR

FORBIDDEN COMMANDS - NEVER USE:
  • aliyun maxcompute create-quota
    - WRONG CASE (kebab-case), use PascalCase
    CreateQuota
  • aliyun maxcompute GetQuota
    - DEPRECATED, use
    query-quota
    instead
  • aliyun bssopenapi CreateInstance
    - WRONG API (BssOpenApi), use MaxCompute CreateQuota instead
  • aliyun bssopenapi QueryAvailableInstances
    - WRONG API for listing quotas, use MaxCompute ListQuotas instead
  • aliyun quotas
    commands - WRONG SERVICE (Quota Center), use MaxCompute instead
MUST USE INSTEAD:
  • aliyun maxcompute list-quotas
    - For listing/checking quotas (MaxCompute service, NOT BssOpenApi)
  • aliyun maxcompute query-quota
    - For querying quota details (MaxCompute service)
  • aliyun maxcompute CreateQuota
    - For creating quota (MaxCompute service)
⚠️ IMPORTANT: Use
aliyun maxcompute
commands (MaxCompute service), NOT
aliyun quotas
commands (Quota Center service).
Command Case Rules:
  • API actions use PascalCase:
    CreateQuota
  • CLI commands use kebab-case:
    list-quotas
    ,
    query-quota

🚨 所有操作的关键规则:
操作第一个执行的命令后续操作
创建配额
list-quotas
结果为空 → 创建;结果存在 → 终止操作
查询配额
query-quota
展示结果
列出配额
list-quotas
展示列表
⚠️ 创建配额前未先调用 ListQuotas = 错误

禁用命令 - 绝对不要使用:
  • aliyun maxcompute create-quota
    - 命名格式错误(短横线命名),请使用大驼峰命名的
    CreateQuota
  • aliyun maxcompute GetQuota
    - 已废弃,请使用
    query-quota
    替代
  • aliyun bssopenapi CreateInstance
    - 调用 API 错误(BssOpenApi),请使用 MaxCompute 的 CreateQuota 替代
  • aliyun bssopenapi QueryAvailableInstances
    - 列出配额调用 API 错误,请使用 MaxCompute 的 ListQuotas 替代
  • aliyun quotas
    相关命令 - 调用服务错误(配额中心),请使用 MaxCompute 服务相关命令
必须使用的对应命令:
  • aliyun maxcompute list-quotas
    - 用于列出/检查配额(MaxCompute 服务,非 BssOpenApi)
  • aliyun maxcompute query-quota
    - 用于查询配额详情(MaxCompute 服务)
  • aliyun maxcompute CreateQuota
    - 用于创建配额(MaxCompute 服务)
⚠️ 重要提示:使用
aliyun maxcompute
相关命令(MaxCompute 服务),不要使用
aliyun quotas
相关命令(配额中心服务)。
命令命名规则:
  • API 动作使用大驼峰命名:
    CreateQuota
  • CLI 命令使用短横线命名:
    list-quotas
    query-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 (
aliyun maxcompute
), NOT Quota Center (
aliyun quotas
).
AFTER ListQuotas result (STEP 2):
ResultAction
List shows quotaDO NOT CREATE - Inform user "Quota already exists" → Done
List is emptyGo 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
    CreateQuota
    (PascalCase), NOT
    create-quota
    (kebab-case)
  • FORBIDDEN:
    create-quota
    ,
    create-quota-odps-paygo
    , or any kebab-case variant
  • Use MaxCompute CreateQuota, NOT BssOpenApi CreateInstance
  • Do NOT use
    aliyun bssopenapi CreateInstance
  • commodityCode values:
    • China site:
      odps
      or
      odpsplus
    • International site:
      odps_intl
      or
      odpsplus_intl
    • NEVER use
      maxcompute
      as commodityCode
    • Note: When
      chargeType=payasyougo
      is set, commodityCode validation is not strict
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 maxcompute
),不要使用配额中心命令(
aliyun 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 取值:
    • 国内站:
      odps
      odpsplus
    • 国际站:
      odps_intl
      odpsplus_intl
    • 绝对不要使用
      maxcompute
      作为 commodityCode
    • 注意:设置
      chargeType=payasyougo
      时,commodityCode 校验不会很严格
最后:
  • 解析返回结果
  • 展示给用户
  • 操作完成
⚠️ 永远不要在调用 ListQuotas 前调用 CreateQuota,这会导致错误。
注意:如果配额已存在,不要创建。仅当 ListQuotas 返回空列表时才执行创建操作。

QUERY Quota (when user provides nickname):

查询配额(用户提供配额别名时):

PRIORITY: Use
query-quota
as the primary API for querying specific quota details by nickname.
CHECKLIST:
  • User provided quota nickname
  • Use
    query-quota
    (NOT
    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:
aliyun maxcompute GetQuota
- use
query-quota
instead.
  • Parse JSON
  • Extract:
    nickName
    ,
    name
    ,
    id
    ,
    status
  • Show all fields → Done
优先级: 使用
query-quota
作为通过别名查询指定配额详情的主 API。
检查清单:
  • 用户已提供配额别名
  • 使用
    query-quota
    (非
    GetQuota
使用命令:
bash
aliyun maxcompute query-quota --nickname <N> --region <R>
重要提示:如果别名包含中文字符,传入命令前需要先进行 URL 编码。
禁用:
aliyun maxcompute GetQuota
- 请使用
query-quota
替代。
  • 解析 JSON 结果
  • 提取字段:
    nickName
    name
    id
    status
  • 展示所有字段 → 操作完成

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
--billing-type payasyougo
to filter at API level.
When listing all quotas (user request):
bash
aliyun maxcompute list-quotas --billing-type ALL --region <R>
billingType parameter:
  • Valid values:
    payasyougo
    ,
    subscription
    ,
    ALL
  • If not set, defaults to
    ALL
  • Use
    payasyougo
    when checking for existing pay-as-you-go quotas
  • Parse JSON
  • Extract
    quotaInfoList
    array
  • Show list → Done

⚠️ 列出配额时:仅使用 MaxCompute 的 ListQuotas,不要使用 BssOpenApi 的 QueryAvailableInstances
创建前检查已有的按量付费配额时:
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region <R>
必须包含
--billing-type payasyougo
在 API 层面过滤结果。
用户要求列出所有配额时:
bash
aliyun maxcompute list-quotas --billing-type ALL --region <R>
billingType 参数说明:
  • 合法取值:
    payasyougo
    subscription
    ALL
  • 未设置时默认值为
    ALL
  • 检查已有的按量付费配额时使用
    payasyougo
  • 解析 JSON 结果
  • 提取
    quotaInfoList
    数组
  • 展示列表 → 操作完成

Quick Reference

快速参考

See references/related-apis.md for complete CLI command reference and response format details.
Key Points:
  • Use
    list-quotas --billing-type payasyougo
    before creating
  • Use
    query-quota
    (not
    get-quota
    ) for querying
  • Use
    CreateQuota
    (PascalCase) for creating
  • 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 CodeWhat to Do
QuotaAlreadyExists
Quota exists → Query it and show details → Task complete
QuotaNotFound
Quota doesn't exist → Inform user
InvalidParameter
Wrong parameter format → Check with user
Forbidden
No permission → Direct to Console
INTERNAL_ERROR
Retry once or contact support

错误码处理方式
QuotaAlreadyExists
配额已存在 → 查询并展示详情 → 任务完成
QuotaNotFound
配额不存在 → 告知用户
InvalidParameter
参数格式错误 → 和用户核对参数
Forbidden
无权限 → 引导用户使用控制台操作
INTERNAL_ERROR
重试一次或联系支持

Cleanup

清理

No Delete API - Must use Console to delete quotas
无删除 API - 必须使用控制台删除配额

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

最佳实践

  1. Always confirm region with user before any operation
  2. For creation: First list to check if quota exists (one per region limit)
  3. If quota exists: Query it for user instead of trying to create
  4. Use query-quota (NOT get-quota) for quota details
  5. For subscription quotas: Direct user to Alibaba Cloud Console
  1. 任何操作前始终和用户确认区域
  2. 创建操作:先列表检查配额是否存在(单区域配额限制)
  3. 配额已存在时:为用户查询配额详情,不要尝试创建
  4. 查询配额详情使用
    query-quota
    (而非
    get-quota
  5. 包年包月配额相关需求:引导用户使用阿里云控制台操作

Reference Links

参考链接

ReferenceDescription
references/related-apis.mdComplete CLI commands and API reference
references/ram-policies.mdRequired RAM permissions
references/verification-method.mdSuccess verification steps
references/acceptance-criteria.mdTesting acceptance criteria
references/cli-installation-guide.mdCLI 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.mdCLI 安装指引

Related Documentation

相关文档