MaxCompute Quota Management
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.
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
Architecture
CODEBLOCK0
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.
CODEBLOCK1
Environment Variables
| Variable | Required | Description |
|---|
| INLINECODE2 | Yes | Alibaba Cloud Access Key ID |
| INLINECODE3 |
Yes | Alibaba Cloud Access Key Secret |
Timeout Configuration:
- -
ALIBABA_CLOUD_CONNECT_TIMEOUT: Connection timeout (default: 10s) - INLINECODE5 : Read timeout (default: 10s)
- These defaults are sufficient for quota operations; no explicit configuration required
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.
Input Validation
| Parameter | Validation Rules |
|---|
| INLINECODE6 | Must be valid Alibaba Cloud region ID (e.g., cn-hangzhou, cn-shanghai) |
| INLINECODE7 |
Max 64 characters; alphanumeric, hyphens (-), underscores (_); URL-encode if contains Chinese characters |
|
chargeType | Must be
payasyougo (subscription not supported) |
|
commodityCode | Must be
odps,
odpsplus,
odps_intl, or
odpsplus_intl |
|
billingType | Must be
payasyougo,
subscription, or
ALL |
Security Note: All user inputs are passed to aliyun CLI which handles parameter sanitization. Do NOT construct commands using string concatenation with raw user input.
| Parameter Name | Required/Optional | Description | Default Value |
|---|
| INLINECODE19 | Required | Alibaba Cloud region (e.g., cn-hangzhou, cn-shanghai) | - |
| INLINECODE20 |
Required | Billing type:
payasyougo only (subscription not supported) | - |
|
commodityCode | Required | Product code (see table below) | - |
|
billingType | Optional | Filter for listing:
subscription or
payasyougo or
ALL |
ALL |
|
maxItem | Optional | Max items per page for listing |
100 |
Commodity Codes (for Pay-as-you-go)
| Site | Commodity Code |
|---|
| China (国内站) | INLINECODE30 |
| International (国际站) |
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:
CODEBLOCK2
If no credentials, ask user to run aliyun configure first, then continue.
Core Workflow
🚨 CRITICAL RULE FOR ALL OPERATIONS:
| Operation | First Command | Then |
|---|
| CREATE quota | INLINECODE34 | 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 INLINECODE38 - ❌
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: INLINECODE49
- CLI commands use kebab-case:
list-quotas, INLINECODE51
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
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):
| 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
CODEBLOCK4
For International Site:
CODEBLOCK5
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 INLINECODE58
- ClientToken: Generate a unique token (e.g., UUID) for idempotency on retries
- 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.
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:
CODEBLOCK6
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, INLINECODE73 - Show all fields → Done
LIST Quotas:
⚠️ FOR LISTING QUOTAS: ONLY use MaxCompute ListQuotas, NOT BssOpenApi QueryAvailableInstances
When checking for existing pay-as-you-go quotas (before creation):
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):
CODEBLOCK8
billingType parameter:
- - Valid values:
payasyougo, subscription, INLINECODE77 - If not set, defaults to INLINECODE78
- Use
payasyougo when checking for existing pay-as-you-go quotas
- - Parse JSON
- Extract
quotaInfoList array - Show list → Done
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 INLINECODE85
Task Completion
Finish with:
- - Summary of what was done
- Key results (nickname, region, status)
- "✅ Complete"
Error Handling
| Error Code | What to Do |
|---|
| INLINECODE86 | Quota exists → Query it and show details → Task complete |
| INLINECODE87 |
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 |
Cleanup
No Delete API - Must use Console to delete quotas
API Reference
See references/related-apis.md for complete API reference, CLI commands, and response formats.
Best Practices
- 1. 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
Reference Links
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 |
Related Documentation
MaxCompute 配额管理
使用阿里云CLI和SDK管理MaxCompute(ODPS)配额资源。本技能涵盖按量付费配额创建、配额查询和配额列表操作。
限制与说明
| 功能 | CLI支持 | SDK支持 | 说明 |
|---|
| 创建按量付费配额 | ✅ 支持 | ✅ 支持 | 完全支持 |
| 创建包年包月配额 |
❌ 不支持 | ❌ 不支持 |
暂时不可用 |
| 查询配额(GetQuota) | ✅ 支持 | ✅ 支持 | ⚠️
已弃用 - 请改用QueryQuota |
| 查询配额(QueryQuota) | ✅ 支持 | ✅ 支持 | 推荐替代GetQuota |
| 列出配额 | ✅ 支持 | ✅ 支持 | 完全支持(按量付费和包年包月) |
| 删除配额 | ❌ 无API | ❌ 无API |
无法通过API操作 - 必须使用控制台 |
| 修改配额 | ❌ 不在范围内 | ❌ 不在范围内 | 本方案不涉及 |
重要提示:
- - 创建包年包月配额在本技能中暂时不支持。如需创建包年包月配额,请使用阿里云控制台。
- 删除配额操作无法通过CLI或SDK执行。您必须使用阿里云控制台删除配额。
- 推荐使用QueryQuota - GetQuota已弃用,但如果能成功返回结果也可接受
- ⚠️ 关键:检查配额是否存在时,始终使用ListQuotas API,切勿使用GetQuota
- 🚨 强制要求:在CreateQuota之前,必须先调用ListQuotas - 切勿跳过此步骤
架构
阿里云账号 → MaxCompute服务 → 配额资源(CU)
├── 按量付费配额(后付费)← 支持创建
└── 包年包月配额(预付费)← 仅支持查询/列出
安装
前置检查:需要Aliyun CLI >= 3.3.1
运行 aliyun version 确认版本 >= 3.3.1。如果未安装或版本过低,
请参阅 references/cli-installation-guide.md 获取安装说明。
然后 [必须] 运行 aliyun configure set --auto-plugin-install true 启用自动插件安装。
bash
验证CLI版本
aliyun version
启用自动插件安装
aliyun configure set --auto-plugin-install true
环境变量
| 变量 | 是否必需 | 说明 |
|---|
| ALIBABACLOUDACCESSKEYID | 是 | 阿里云访问密钥ID |
| ALIBABACLOUDACCESSKEYSECRET |
是 | 阿里云访问密钥Secret |
超时配置:
- - ALIBABACLOUDCONNECTTIMEOUT:连接超时(默认:10秒)
- ALIBABACLOUDREADTIMEOUT:读取超时(默认:10秒)
- 这些默认值对于配额操作已足够;无需显式配置
参数确认
重要提示:参数确认 — 在执行任何命令或API调用之前,
所有用户可自定义的参数(例如RegionId、配额别名、计费类型等)
必须与用户确认。未经用户明确批准,不得假设或使用默认值。
输入验证
| 参数 | 验证规则 |
|---|
| RegionId | 必须是有效的阿里云地域ID(例如cn-hangzhou、cn-shanghai) |
| nickname |
最多64个字符;字母数字、连字符(-)、下划线(_);如果包含中文字符需进行URL编码 |
| chargeType | 必须是 payasyougo(不支持包年包月) |
| commodityCode | 必须是 odps、odpsplus、odps
intl 或 odpsplusintl |
| billingType | 必须是 payasyougo、subscription 或 ALL |
安全说明: 所有用户输入都会传递给aliyun CLI,由CLI处理参数清理。请勿使用字符串拼接原始用户输入的方式构造命令。
| 参数名称 | 必需/可选 | 说明 | 默认值 |
|---|
| RegionId | 必需 | 阿里云地域(例如cn-hangzhou、cn-shanghai) | - |
| chargeType |
必需 | 计费类型:仅支持 payasyougo(不支持包年包月) | - |
| commodityCode | 必需 | 产品代码(见下表) | - |
| billingType | 可选 | 列表筛选:subscription 或 payasyougo 或 ALL | ALL |
| maxItem | 可选 | 列表每页最大条目数 | 100 |
商品代码(按量付费)
odps_intl |
身份认证
安全:切勿泄露凭证
- - 不要打印AK/SK值
- 不要要求用户在聊天中输入AK/SK
- 不要使用硬编码值的 aliyun configure set
检查凭证:
bash
aliyun configure list
如果没有凭证,请用户先运行 aliyun configure,然后继续。
核心工作流
🚨 所有操作的关键规则:
| 操作 | 第一步命令 | 然后 |
|---|
| 创建配额 | list-quotas | 如果为空 → 创建;如果存在 → 停止 |
| 查询配额 |
query-quota | 显示结果 |
|
列出配额 | list-quotas | 显示列表 |
⚠️ 不先执行ListQuotas就执行CREATE = 错误
禁止使用的命令 - 切勿使用:
- - ❌ aliyun maxcompute create-quota - 错误的大小写(kebab-case),应使用PascalCase 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操作使用PascalCase:CreateQuota
- CLI命令使用kebab-case:list-quotas、query-quota
创建配额(先检查 - 再创建):
🚨 禁止创建预付费/包年包月配额:
本技能仅支持按量付费配额创建。
- - 如果用户需要预付费/包年包月配额 → 告知用户使用阿里云控制台
- 不要尝试创建预付费配额
🚨 创建前:先运行LISTQUOTAS - 切勿跳过此步骤:
第1步 - 强制要求:先调用ListQuotas
bash
aliyun maxcompute list-quotas --billing-type payasyougo --region
在获取ListQuotas结果之前,不要进入第2步
使用MaxCompute服务(aliyun maxcompute),而不是配额中心(aliyun quotas)。
获取ListQuotas结果后(第2步):
| 结果 | 操作 |
|---|
| 列表显示有配额 | 不要创建 - 告知用户配额已存在 → 完成 |
| 列表为空 |
进入第3步(创建) |
第3步 - 仅当列表为空时:
创建前检查清单 - 所有条件必须为