alibabacloud-odps-quota-manage
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.
Solution Source: Based on odps-open-api-example/quota-manage
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
Alibaba Cloud Account → MaxCompute Service → Quota Resources (CU)
├── Pay-as-you-go Quota (后付费) ← **Creation Supported**
└── Subscription Quota (预付费) ← Query/List only
Installation
Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun versionto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation.
# Verify CLI version
aliyun version
# Enable auto plugin installation
aliyun configure set --auto-plugin-install true
Environment Variables
| Variable | Required | Description |
|---|---|---|
ALIBABA_CLOUD_ACCESS_KEY_ID |
Yes | Alibaba Cloud Access Key ID |
ALIBABA_CLOUD_ACCESS_KEY_SECRET |
Yes | Alibaba Cloud 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 |
|---|---|---|---|
RegionId |
Required | Alibaba Cloud region (e.g., cn-hangzhou, cn-shanghai) | - |
chargeType |
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 (国内站) | odps |
| 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 setwith hardcoded values
Check credentials:
aliyun configure list
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 | 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 PascalCaseCreateQuota - ❌
aliyun maxcompute GetQuota- DEPRECATED, usequery-quotainstead - ❌
aliyun bssopenapi CreateInstance- WRONG API (BssOpenApi), use MaxCompute CreateQuota instead - ❌
aliyun bssopenapi QueryAvailableInstances- WRONG API for listing quotas, use MaxCompute ListQuotas instead - ❌
aliyun quotascommands - 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
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
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps --region <R>
For International Site:
aliyun maxcompute CreateQuota --chargeType payasyougo --commodityCode odps_intl --region <R>
CRITICAL:
- Use
CreateQuota(PascalCase), NOTcreate-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:
odpsorodpsplus - International site:
odps_intlorodpsplus_intl - NEVER use
maxcomputeas commodityCode - Note: When
chargeType=payasyougois set, commodityCode validation is not strict
- 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.
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(NOTGetQuota)
USE THIS COMMAND:
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
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):
aliyun maxcompute list-quotas --billing-type ALL --region <R>
billingType parameter:
-
Valid values:
payasyougo,subscription,ALL -
If not set, defaults to
ALL -
Use
payasyougowhen checking for existing pay-as-you-go quotas -
Parse JSON
-
Extract
quotaInfoListarray -
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 payasyougobefore creating - Use
query-quota(notget-quota) for querying - Use
CreateQuota(PascalCase) for creating - Always include
--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 |
|---|---|
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 |
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
- 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
| 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 |