Loading...
Loading...
Guide users to manage Alibaba Cloud resources using the Aliyun CLI command-line tool. Covers CLI installation, credential configuration, plugin management, command construction, and error troubleshooting. Use this skill when the user wants to operate Alibaba Cloud services from the terminal — including ECS (云服务器, cloud servers), Function Compute (函数计算, serverless), RDS (云数据库, databases), OSS (对象存储, object storage), SLS (日志服务, log service), VPC (专有网络, networking), ESS (弹性伸缩, auto scaling), and any other Alibaba Cloud product. Also use when the user mentions "aliyun", "阿里云", "阿里云CLI", "命令行", asks about CLI plugin installation, encounters Aliyun CLI errors (InvalidAccessKeyId, SignatureDoesNotMatch, Throttling), or needs help constructing aliyun commands with correct parameter syntax.
npx skill4agent add aliyun/alibabacloud-aiops-skills alibabacloud-cli-guidancealiyun./references/ram-policies.md## required_permissionsaliyunexport ALIBABA_CLOUD_USER_AGENT=AlibabaCloud-Agent-SkillsALIBABA_CLOUD_USER_AGENT=AlibabaCloud-Agent-Skills aliyun ...aliyun configureexportaliyunALIBABA_CLOUD_USER_AGENTaliyun./references/installation-guide.md# Install or update (macOS / Linux — one command)
/bin/bash -c "$(curl -fsSL --connect-timeout 10 --max-time 120 https://aliyuncli.alicdn.com/setup.sh)"aliyun configure --profile <your-profile-name> --mode OAuthCNINTL./references/installation-guide.md# Credentials via environment variables (automation, CI/CD, headless, or when OAuth is not available)
export ALIBABA_CLOUD_ACCESS_KEY_ID=<key-id>
export ALIBABA_CLOUD_ACCESS_KEY_SECRET=<key-secret>
export ALIBABA_CLOUD_REGION_ID=cn-hangzhou
# Temporary credentials (StsToken) — add:
# export ALIBABA_CLOUD_SECURITY_TOKEN=<sts-token>
# Required when using this skill for API calls — see "User-Agent (this skill)" above
export ALIBABA_CLOUD_USER_AGENT=AlibabaCloud-Agent-Skills
# Verify
aliyun version # Should be >= 3.3.0
aliyun ecs describe-regions # Tests authentication~/.aliyun/config.json| Mode | When to use | Environment variables |
|---|---|---|
| AK | Development, long-lived credentials | |
| StsToken | CI/CD, temporary credentials | Same as AK, plus |
| RamRoleArn | After AssumeRole or cross-account session | Export the temporary pair from the role session: same variables as StsToken (AK + secret + |
exportALIBABA_CLOUD_ACCESS_KEY_IDALIBABA_CLOUD_ACCESS_KEY_SECRETALIBABA_CLOUD_REGION_ID./references/installation-guide.md--help--helpaliyun <product> --help # Discover available subcommands
aliyun <product> <subcommand> --help # Get exact parameter names, types, structurealiyun <product> --helpALIBABA_CLOUD_ORIGINAL_PRODUCT_HELP=true aliyun ecs --helpplugin installaliyun plugin install --names ecs # Install (short name, case-insensitive)
aliyun plugin install --names ECS VPC RDS # Multiple at oncealiyun plugin list # Installed plugins
aliyun plugin list-remote # All available plugins
aliyun plugin search <keyword> # Search by keywordecsaliyun-cli-ecsaliyun plugin update --name ecs # Update a plugin
aliyun plugin uninstall --name ecs # Remove a plugin--help# Plugin (preferred): consistent kebab-case
aliyun ecs describe-instances --biz-region-id cn-hangzhou
# Built-in (fallback): PascalCase subcommand, inconsistent params
aliyun ecs DescribeInstances --RegionId cn-hangzhouecsEcsECS| Aspect | Plugin (CLI Native) | Built-in (OpenAPI) |
|---|---|---|
| Subcommand | | |
| Parameters | kebab-case (consistent) | Mixed (inconsistent) |
| ROA Body | Expanded to individual params | Single |
| Header params | Visible in help, usable directly | Hidden, manual |
| Help | Comprehensive with structure | Basic |
--region-id--regionecs.cn-hangzhou.aliyuncs.com--profile--api-version--outputRegionIdRegion--region-idRegionId--biz-RegionId--biz-region-id--<product>---biz-region-id--<product>-region-id--ecs-region-id--region-id--biz-region-id--<product>-region-id--region-id--help--biz-region-id--<product>-region-id--Tag.N.Key--Param.N=value--instance-id i-abc123 # single value
--security-group-ids sg-001 sg-002 sg-003 # space-separated list
--instance-id i-abc --instance-id i-def # repeated param (also valid)--tag Key=env Value=prod --tag Key=app Value=web # repeatable key-value
--capacity-options OnDemandBaseCapacity=12 CompensateWithOnDemand=true # object
--data-disk '{"DiskName":"d1","Size":100}' # complex structure (JSON)--helpPutBucketGetObjectaliyun oss --help # Basic operations (cp, ls, mb, rm, etc.)
aliyun ossutil --help # Advanced utilities (sync, stat, etc.)<your-*>aliyun oss cp <your-file-name>.txt oss://<your-bucket-name>/ # Upload
aliyun oss mb oss://<your-bucket-name> # Create bucket
aliyun ossutil sync ./<your-folder-name>/ oss://<your-bucket-name>/ # Sync directory--cli-query--output# JMESPath filter: only running instances, selected fields
aliyun ecs describe-instances \
--biz-region-id cn-hangzhou \
--cli-query "Instances.Instance[?Status=='Running'].{ID:InstanceId,Name:InstanceName}"
# Output formats
aliyun ecs describe-instances --biz-region-id cn-hangzhou --output json # default
aliyun ecs describe-instances --biz-region-id cn-hangzhou --output table # human-readable table
aliyun ecs describe-instances --biz-region-id cn-hangzhou --output cols=InstanceId,InstanceName,Status rows="Instances.Instance[]" # custom columns--page-number--page-sizealiyun ecs describe-instances \
--biz-region-id cn-hangzhou \
--page-number 1 \
--page-size 50--pageraliyun ecs describe-instances \
--biz-region-id cn-hangzhou \
--pager path='Instances.Instance[]' PageNumber=PageNumber PageSize=PageSizepathaliyun vpc describe-vpc-attribute \
--biz-region-id cn-shanghai \
--vpc-id <your-vpc-id> \
--waiter expr='Status' to='Available'--log-level debug--cli-dry-runALIBABA_CLOUD_CLI_LOG_CONFIG=debug./references/ram-policies.mdrequired_permissionslist-api-versionsaliyun <product> list-api-versionsProduct: ESS
Supported API versions:
* 2014-08-28 (default)
2016-07-22
2022-02-22*aliyun ess describe-scaling-groups --api-version 2022-02-22 --biz-region-id cn-hangzhou--api-versionexport ALIBABA_CLOUD_ESS_API_VERSION=2022-02-22
export ALIBABA_CLOUD_SLB_API_VERSION=2014-05-15ALIBABA_CLOUD_<PRODUCT_CODE>_API_VERSIONaliyun ess --api-version 2022-02-22 # List commands in this version
aliyun ess <cmd> --api-version 2022-02-22 --help # Help for a specific command in this version--help| Flag | Purpose |
|---|---|
| API endpoint region (global, not business region) |
| Use a named credential profile |
| Override API version for this command |
| Response format |
| JMESPath filter on response |
| Verbose request/response logging |
| Validate without executing |
| Override service endpoint |
| Retry count for failed requests |
| Suppress output |
| Auto-merge all pages for pageable APIs |
aliyun plugin list | grep ecs
# If missing: aliyun plugin install --names ecs
aliyun ecs describe-instances --biz-region-id cn-hangzhoucreate-instancealiyun ecs create-instance \
--biz-region-id cn-hangzhou \
--instance-type ecs.g7.large \
--image-id ubuntu_20_04_arm64_20G_alibase_20250625.vhd \
--data-disk Category=cloud_essd Size=100 \
--tag Key=env Value=prod --tag Key=app Value=webaliyun plugin list | grep fc
# If missing: aliyun plugin install --names fc<your-function-name>--bodyaliyun fc create-function \
--function-name <your-function-name> \
--runtime python3.9 \
--handler index.handler \
--memory-size 512 \
--timeout 60 \
--description "Process uploaded images"# Check available versions
aliyun ess list-api-versions
# Use the latest version for new features
export ALIBABA_CLOUD_ESS_API_VERSION=2022-02-22
aliyun ess describe-scaling-groups --biz-region-id cn-hangzhou
# Or specify per command without env var
aliyun ess describe-scaling-groups --api-version 2022-02-22 --biz-region-id cn-hangzhou--biz---log-level debugALIBABA_CLOUD_USER_AGENT=AlibabaCloud-Agent-Skillsaliyun./references/installation-guide.md./references/command-syntax.md./references/global-flags.md./references/ram-policies.md