[MUST] CLI User-Agent — Every
aliyunCLI command invocation must include:--user-agent AlibabaCloud-Agent-Skills/alibabacloud-resourcecenter-search
[MUST] Enable AI-Mode — AI-mode is required for Agent Skill execution. Run the following commands before any other
aliyunCLI invocation:bash
aliyun configure ai-mode enable aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-resourcecenter-search"
Pre-check: Aliyun CLI >= 3.3.3 required Run
aliyun versionto verify >= 3.3.3. If not installed or version too low, runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto install/update, or seereferences/cli-installation-guide.mdfor installation instructions. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation. Then [MUST] runaliyun plugin updateto ensure that any existing plugins on your local machine are always up-to-date.
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusbash
aliyun 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
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
[MUST] Disable AI-Mode at EVERY exit point — Before delivering the final response for ANY reason, always disable AI-mode first. This applies to ALL exit paths: workflow success, workflow failure, error/exception, user cancellation, session end, or any other scenario where no further CLI commands will be executed. AI-mode is only used for Agent Skill invocation scenarios and MUST NOT remain enabled after the skill stops running.
bash
aliyun configure ai-mode disable
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks, passwords, domain names, resource specifications, etc.) MUST be confirmed with the user. Do NOT assume and use default values without explicit user approval.
ParameterRequired/OptionalDescriptionDefault ValueScopeRequired (cross-account)Cross-account search scope: Resource Directory ID, Root Folder ID, Folder ID, or Member IDNoneResourceTypeOptionalResource type (e.g., ACS::ECS::Instance)None (all types)RegionIdOptionalResource Region ID (e.g., cn-hangzhou)None (all regions)ResourceIdOptionalResource IDNoneResourceNameOptionalResource nameNoneVpcIdOptionalVPC ID (e.g., vpc-xxx)NoneVSwitchIdOptionalVSwitch (e.g., vsw-xxx)NoneIpAddressOptionalIP addressNoneGroupByKeyOptionalStatistics grouping dimension: ResourceType, RegionId, ResourceGroupIdNoneMaxResultsOptionalPage size for paginated APIs.20
See references/ram-policies.md for full permission lists.
Recommended system policies:
AliyunResourceCenterReadOnlyAccessAliyunResourceCenterFullAccessOpening Resource Center will auto-create the service-linked role
AliyunServiceRoleForResourceMetaCenter.
RAM policies (defined in ram-policies.md) control whether a user can call a Resource Center API. However, for search APIs ( SearchResources, GetResourceCounts, GetResourceConfiguration, SearchMultiAccountResources, GetMultiAccountResourceCounts, GetMultiAccountResourceConfiguration), the scope of resources visible in results is determined by each cloud product's own permissions:
ReadOnlyAccess lets the user see all resources they have access to; granting only AliyunVPCReadOnlyAccess limits visibility to VPC resources.AliyunResourceCenterFullAccess to the RAM user of the Resource Directory management account to enable cross-account resource search.Determine which APIs are needed based on the user's specific scenario. Refer to the scenario cards below.
CRITICAL WARNING: DO NOT execute any
aliyun resourcecentercommand without first reading the exact parameter format inreferences/related-apis.md.Failure Pattern: Guessing parameters like
--filterformat will cause errors. The correct JSON structure MUST be copied from the documentation.Mandatory Action: Open and read the specific API section in references/related-apis.md BEFORE constructing any CLI command.
RequirementAccount TypeAPIDescriptionCheck if enabledSingle-accountget-resource-center-service-statusReturns service statusEnable serviceSingle-accountenable-resource-centerRequired for first-time useCheck cross-account statusResource Directoryget-multi-account-resource-center-service-statusMulti-account scenarioEnable cross-account serviceResource Directoryenable-multi-account-resource-centerRequires management account or delegated admin
RequirementAccount TypeScriptDescriptionFind resource type codes by keywordSingle-accountscripts/query-resource-types.pySearch across ResourceType, ProductName, and ResourceTypeName fields
Decision Logic:
ResourceType code -> Use it in search or count API with --filter parameterRequirementAccount ScopeAPIKey ParametersSearch resources by criteriaCurrent accountsearch-resources``--filterCross-account resource searchResource Directorysearch-multi-account-resources``--scope + --filterSearch including deleted resourcesCurrent accountsearch-resources``--include-deleted-resources=true
RequirementAccount ScopeAPIUse CaseGet single resource configurationCurrent accountget-resource-configurationGet complete configuration detailsBatch get multiple resource configurationsCurrent accountbatch-get-resource-configurationsGet multiple resources at onceGet resource configuration from another accountResource Directoryget-multi-account-resource-configurationCross-account view
RequirementAccount ScopeAPIGrouping DimensionsCount resourcesCurrent accountget-resource-counts``ResourceType, RegionId, ResourceGroupIdCross-account statisticsResource Directoryget-multi-account-resource-counts``ResourceType, RegionId, ResourceGroupId
RequirementAccount ScopeAPIDescriptionList all tag keysCurrent accountlist-tag-keysBrowse tag catalogList values for a specific tag keyCurrent accountlist-tag-valuese.g., list all values for envCross-account tag keysResource Directorylist-multi-account-tag-keysMulti-account scenarioCross-account tag valuesResource Directorylist-multi-account-tag-valuesMulti-account scenario
See references/verification-method.md for detailed verification steps and commands for each workflow step.
[MUST] High-Risk Operation Confirmation — Before executing
disable-resource-centerordisable-multi-account-resource-center:
MUST explicitly inform the user of the impacts:
- Disable Impact
- After disabling Resource Center, resource data will no longer be viewable in Resource Center. Specifically:
- For a single Alibaba Cloud account, after disabling Resource Center, resource data in the current account will no longer be viewable.
- For the management account of a Resource Directory and the delegated administrator account of Resource Center, disabling Resource Center will also disable the cross-account resource search feature. Resource data in the current account and members of the Resource Directory will no longer be viewable. Additionally, members will not be able to view resource data in their own accounts.
- After disabling Resource Center, the resource management module on the console homepage, Config Audit service, and other related scenarios will also be unable to view resource data.
- Disable Restrictions
If the management account of a Resource Directory or the delegated administrator account of Resource Center has cross-account resource features enabled by another account, Resource Center cannot be disabled.
If there are cloud products or features that have strong dependencies on Resource Center, such as Config Audit and associated resource transfer, you must first disable those cloud products or features before you can disable Resource Center.
- MUST obtain explicit user confirmation (e.g., user types "confirm disable" or similar clear affirmation)
- DO NOT proceed without user's explicit acknowledgment
Warning: Disabling will remove all resource data and affect dependent services (e.g., Config Audit). Must first disable cross-account if enabled.
bash
aliyun resourcecenter disable-resource-center \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-resourcecenter-search
Must be done before disabling single-account resource center (if cross-account is enabled). Requires management account or delegated admin.
bash
aliyun resourcecenter disable-multi-account-resource-center \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-resourcecenter-search
--user-agent on every Resource Center CLI call — All aliyun resourcecenter examples in this skill include --user-agent AlibabaCloud-Agent-Skills/alibabacloud-resourcecenter-search. When executing commands for this skill, always pass the same flag so usage is consistent with verification, maintainers’ expectations, and any automated checks.ResourceType, RegionId, and Tag filters improves search efficiencyGroupByKey for quick statistics — Get resource distribution by type, region, or resource group without iteratingAliyunResourceCenterReadOnlyAccess for securitylist-tag-keys / list-tag-values (and multi-account variants with --scope). Reserve search-resources for finding resources that match tag conditions.ScriptPurposeUsagescripts/query-resource-types.pyQueries resource types by keyword from Alibaba Cloud Resource Center; stdout is JSON ( resourceTypes, count, keyword, language; failures use success: false and error)python3 scripts/query-resource-types.py <keyword> [--language LANGUAGE]
When a Resource Center API call or aliyun resourcecenter command fails, read the response’s HTTP status, Code (error code), and Message, then match them against the catalog.
Full error list: references/error-codes.md
ReferenceDescriptionreferences/related-apis.mdAll CLI commands listreferences/ram-policies.mdRAM permission policiesreferences/verification-method.mdVerification steps for each workflowreferences/error-codes.mdDeduplicated Resource Center API error code catalog (HTTP, Code, Message) and lookup hintsreferences/cli-installation-guide.mdAliyun CLI installation guidereferences/acceptance-criteria.mdFor maintainers/CI only: Skill testing acceptance criteria, correct CLI command patterns, parameter validation rules. Note: This document is intended for human maintainers and automated testing, not required reading for end users.