This skill teaches you how to use the Aliyun CLI to manage
Alibaba Cloud resources. You will construct and explain aliyun commands, interpret their output,
and guide users through cloud resource management tasks.
ResourceReference FileCommon OperationsSetup & Authreferences/setup.mdinstall, configure, switch profilesECS (Elastic Compute Service)references/ecs.mdlist, start/stop/reboot, resize disk, create snapshotVPC (Virtual Private Cloud)references/vpc.mdmanage VPCs, VSwitches, EIPs, NAT gateways, route tablesOSS (Object Storage Service)references/oss.mdbuckets, upload/download, sync, presigned URLsRDS (Relational Database Service)references/rds.mdinstances, databases, accounts, backups, IP whitelistSLB / CLB (Load Balancer)references/slb.mdcreate LB, manage listeners, add/remove backend serversRAM (Resource Access Management)references/ram.mdusers, groups, roles, policies, access keysDNS (AliDNS)references/dns.mdlist domains, add/update/delete recordsACR (Container Registry)references/acr.mdinstances, namespaces, repositories, image tags, docker login
Read the relevant reference file before responding to a request.
Every aliyun command follows this structure:
text
aliyun <Product> <Operation> [--Parameter Value ...]
ecs, oss, vpc, rds, ram)DescribeInstances, StartInstance)-- (e.g., --RegionId cn-hangzhou, --InstanceId i-xxxx)OSS is an exception — it uses a subcommand style like aliyun oss ls, aliyun oss cp.
Before constructing any command:
Region — Most operations require --RegionId. Common regions:
cn-hangzhou (Hangzhou), cn-beijing (Beijing), cn-shanghai (Shanghai)cn-shenzhen (Shenzhen), ap-southeast-1 (Singapore), us-west-1 (US West)aliyun configure get to find the default.Resource IDs — Most mutating operations (start, stop, delete) need a specific resource ID. If the user hasn't provided one, first run a Describe/List command to find it.
Pagination — Describe* APIs return paginated results. Default page size is typically 10.
Use --PageSize 100 and --PageNumber to retrieve more. Mention this if results seem incomplete.
Dry run — Aliyun CLI does not have a universal dry-run flag. For destructive operations, always confirm resource IDs with the user before executing.
The CLI supports multiple output formats via the --output flag:
--output cols=<col1>,<col2> — tabular output for quick scanning--output table — aligned tableFor human-readable summaries, use --output cols=InstanceId,InstanceName,Status style where available.
zsh gotcha: If you use rows=Instances.Instance[], the [] will be interpreted as a glob by zsh
and cause a "no matches found" error. Quote the argument to avoid this:
bash
aliyun ecs DescribeInstances \
--output 'cols=InstanceId,InstanceName,Status' 'rows=Instances.Instance[]'
Or simply omit rows= and use the default JSON output when tabular formatting isn't critical.
When the user asks to perform an operation on a named resource (e.g., "restart my server called web-prod"):
Discover — Run a Describe command to find the resource ID bash
aliyun ecs DescribeInstances --RegionId cn-hangzhou
Confirm — Show the result and confirm the target with the user if there's any ambiguity
Act — Run the mutating command with the confirmed resource ID
Verify — Optionally run another Describe to confirm the new state
Common errors and what to do:
ErrorCauseSolutionInvalidAccessKeyIdWrong or expired credentialsRun aliyun configure to reconfigureForbidden.RAMInsufficient RAM permissionsCheck RAM policy for required actionIncorrectInstanceStatusWrong instance state for operationDescribe instance status firstInvalidRegionIdUnsupported region for this productCheck product availability in that regionThrottlingAPI rate limit hitAdd a brief delay and retry
If the user has not yet installed or configured the CLI, read references/setup.md and guide them
through it before attempting any commands.
For destructive operations (delete instance, release EIP, drop RDS database), always:
For cost-incurring operations (create ECS, purchase bandwidth), mention the cost implications
Never expose or log AccessKey secrets — remind users to use RAM roles or environment variables instead of hardcoding credentials
When the user needs to operate on multiple resources (e.g., "list all instances in all regions"), you can run several commands and combine the results. For shell loops:
bash
for region in cn-hangzhou cn-beijing cn-shanghai cn-shenzhen ap-southeast-1; do
echo "=== $region ==="
aliyun ecs DescribeInstances --RegionId $region
done