| name | hcloud-cli |
| description | Manage Huawei Cloud resources through KooCLI. Discover before acting โ always query existing resources before creating. Use dryrun to validate, waiter to poll async operations. |
| license | MIT |
| compatibility | opencode |
| metadata | {"audience":"cloud-engineers","workflow":"huaweicloud-operations"} |
Huawei Cloud CLI (KooCLI)
Rules
- DISCOVER before ACT โ always query existing resources with
List/Show operations before creating or modifying anything. Avoid duplicates. Reuse existing infrastructure when possible.
- DRYRUN before EXECUTE โ always
--dryrun create/update/delete calls first. Show the user what will happen. Only execute after confirmation or when the user has explicitly asked to proceed.
- Never hardcode IDs โ use resource names to look up IDs via list operations, then reference the IDs. In Terraform output, use data blocks or resource references.
- Use JMESPath โ
--cli-query to filter output and keep token usage minimal. Never dump full API responses when you only need a few fields.
- Use waiter โ
--cli-waiter for async operations (ECS create, RDS create, CCE create, etc.). Never poll manually with sleep loops.
- Discover services dynamically โ
hcloud <Service> --help to find operations; hcloud <Service> <Operation> --help to find parameters. Never guess API names or parameters.
- Batch independent queries โ call multiple independent list operations in parallel. Only serialize when there's a dependency (subnets need VPC ID, RDS flavors need engine).
- Batch questions โ ask related questions together, not one at a time.
- OBS is a separate tool โ
hcloud obs is obsutil, not a standard hcloud API. It uses single-dash flags (-flag=value), obs://bucket/key URLs, its own config (~/.obsutilconfig), and has no JMESPath/JSON output. See references/obs.md.
Quick Start
hcloud version
hcloud configure test
hcloud --help
hcloud ECS --help
hcloud ECS ListServersDetails --help
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[].{name:name,id:id,cidr:cidr}'
hcloud --dryrun VPC CreateVpc --cli-region=la-north-2 --vpc.name=demo-vpc --vpc.cidr=10.0.0.0/16
hcloud --skeleton ECS CreateServers
hcloud ECS CreateServers --cli-region=la-north-2 --cli-waiter='{"expr":"server.status","to":"ACTIVE","timeout":300}' ...
Core Pattern
hcloud <Service> <Operation> --param1=value1 --param2=value2
- Service: cloud service name (ECS, VPC, RDS, IAM, etc.)
- Operation: API operation name (ListServersDetails, CreateVpc, etc.)
- Parameters:
--param=value format (always --param=value, never --param value)
Parameter naming
- Simple params:
--name=demo-vpc
- Nested params (body objects):
--vpc.name=demo-vpc --vpc.cidr=10.0.0.0/16
- Array params:
--nics.1.subnet_id=xxx --nics.1.vpc_id=yyy
- JSON input for complex bodies:
--cli-jsonInput=./params.json
Global Options
hcloud --dryrun ECS CreateServers ...
hcloud --skeleton ECS CreateServers
hcloud --debug ECS ListServersDetails --cli-region=la-north-2
hcloud ECS ListServersDetails --cli-region=ap-southeast-1
hcloud ECS ListServersDetails --cli-profile=prod
hcloud VPC ListVpcs --cli-output=json
hcloud VPC ListVpcs --cli-output=table
hcloud VPC ListVpcs --cli-output=tsv
hcloud VPC ListVpcs --cli-query='vpcs[].{name:name,id:id}'
hcloud ECS CreateServers --cli-waiter='{"expr":"server.status","to":"ACTIVE","timeout":300}'
hcloud VPC ListVpcs --cli-output=table --cli-output-num
hcloud ECS ListServersDetails --cli-endpoint=https://ecs.custom.example.com
hcloud ECS ListServersDetails --cli-connect-timeout=10 --cli-read-timeout=30 --cli-retry-count=3
hcloud ECS ListServersDetails --cli-skip-secure-verify=true
hcloud ECS CreateServers --cli-jsonInput=./create-ecs-params.json
Discovery (the "snapshot")
Always query before acting. See references/discovery.md for full patterns.
hcloud VPC ListVpcs --cli-region=X --cli-output=json --cli-query='vpcs[].{name:name,id:id,cidr:cidr}'
hcloud VPC ListSubnets --cli-region=X --vpc_id=VPC_ID --cli-output=json --cli-query='subnets[].{name:name,id:id,cidr:cidr}'
hcloud VPC ListSecurityGroups --cli-region=X --cli-output=json --cli-query='security_groups[].{name:name,id:id}'
hcloud EIP ListPublicips --cli-region=X --cli-output=json
hcloud ECS ListServersDetails --cli-region=X --cli-output=json --cli-query='servers[].{name:name,id:id,status:status,flavor:flavor.id}'
hcloud ECS ListFlavors --cli-region=X --cli-output=json --cli-query='flavors[].{id:id,vcpus:vcpus,ram:ram}'
hcloud IMS ListImages --cli-region=X --__imagetype=gold --__os_type=Linux --cli-output=json --cli-query='images[].{id:id,name:name}'
hcloud RDS ListDatastores --cli-region=X --database_name=MySQL --cli-output=json
hcloud RDS ListFlavors --cli-region=X --database_name=MySQL --cli-output=json
hcloud IAM KeystoneListUsers --cli-output=json --cli-query='users[].{name:name,id:id}'
hcloud IAM KeystoneListProjects --cli-output=json --cli-query='projects[].{name:name,id:id}'
Creation (with dryrun + waiter)
Always dryrun first. See references/resource-creation.md for full patterns.
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[].{name:name,id:id}'
hcloud --dryrun VPC CreateVpc --cli-region=la-north-2 --vpc.name=demo-vpc --vpc.cidr=10.0.0.0/16
hcloud VPC CreateVpc --cli-region=la-north-2 --vpc.name=demo-vpc --vpc.cidr=10.0.0.0/16
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-query='vpcs[?name==`demo-vpc`].{id:id,cidr:cidr}'
For async operations, add --cli-waiter:
hcloud ECS CreateServers --cli-region=la-north-2 \
--cli-waiter='{"expr":"server.status","to":"ACTIVE","timeout":300}' \
--server.name=demo-ecs \
--server.flavor_ref=c6.large.2 \
--server.image_ref=IMAGE_ID \
--server.availability_zone=la-north-2a \
--nics.1.subnet_id=SUBNET_ID \
--nics.1.vpc_id=VPC_ID \
--security_groups.1.id=SG_ID
Profile & Config
See references/profile-management.md for details.
hcloud configure init
hcloud configure set --cli-profile=default --access-key=XXX --secret-key=YYY --region=la-north-2
hcloud configure list
hcloud configure show
hcloud configure test
hcloud configure delete --cli-profile=old
hcloud configure sso
Output & Filtering
hcloud VPC ListVpcs --cli-region=X --cli-output=json
hcloud VPC ListVpcs --cli-region=X --cli-output=json --cli-query='vpcs[].{name:name,id:id,cidr:cidr}'
hcloud VPC ListVpcs --cli-region=X --cli-output=json --cli-query='vpcs[?name==`prod-vpc`].{id:id,cidr:cidr}'
hcloud VPC ListVpcs --cli-region=X --cli-output=table --cli-output-num
hcloud ECS ListServersDetails --cli-region=X --cli-output=json --cli-query='servers[].{name:name,status:status,flavor:flavor.id,ips:addresses.private[0].addr}'
Async Operations
See references/waiter-patterns.md for per-service patterns.
hcloud <Service> <AsyncOperation> --cli-waiter='{"expr":"<jmespath>","to":"<target>","timeout":<seconds>,"interval":<seconds>}'
hcloud ECS CreateServers ... --cli-waiter='{"expr":"server.status","to":"ACTIVE","timeout":300}'
hcloud RDS CreateInstance ... --cli-waiter='{"expr":"instances[0].status","to":"ACTIVE","timeout":600}'
hcloud CCE CreateCluster ... --cli-waiter='{"expr":"status.phase","to":"Available","timeout":600}'
OBS (Object Storage)
OBS is handled by obsutil โ a separate tool with its own commands, config, and syntax. See references/obs.md for full reference.
hcloud obs config -e=https://obs.la-north-2.myhuaweicloud.com -i=AK -k=SK
hcloud obs ls -s
hcloud obs ls obs://my-bucket/ -s
hcloud obs cp ./file.txt obs://my-bucket/file.txt
hcloud obs cp ./folder/ obs://my-bucket/prefix/ -r
hcloud obs cp obs://my-bucket/file.txt ./file.txt
hcloud obs sync ./folder/ obs://my-bucket/prefix/
hcloud obs mb obs://my-bucket -location=la-north-2
hcloud obs rm obs://my-bucket/old-prefix/ -r -f
hcloud obs sign obs://my-bucket/file.txt -e=3600
Debug & Meta
hcloud --debug ECS ListServersDetails --cli-region=la-north-2
hcloud meta download
hcloud meta clear
hcloud log set
hcloud log show
hcloud update
hcloud version
System Commands
hcloud configure init
hcloud configure set
hcloud configure list
hcloud configure show
hcloud configure delete
hcloud configure test
hcloud configure clear
hcloud configure sso
hcloud meta download
hcloud meta clear
hcloud log set
hcloud log show
hcloud update
hcloud version
hcloud auto-complete on
hcloud auto-complete off
Examples
Example: Discover and create ECS
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[].{name:name,id:id,cidr:cidr}'
hcloud VPC ListSubnets --cli-region=la-north-2 --vpc_id=e00f74ba-59ec-4609-9522-981d8273522f --cli-output=json --cli-query='subnets[].{name:name,id:id,cidr:cidr}'
hcloud VPC ListSecurityGroups --cli-region=la-north-2 --cli-output=json --cli-query='security_groups[].{name:name,id:id}'
hcloud ECS ListFlavors --cli-region=la-north-2 --availability_zone=la-north-2a --cli-output=json --cli-query='flavors[].{id:id,name:name,vcpus:vcpus,ram:ram}'
hcloud IMS ListImages --cli-region=la-north-2 --__imagetype=gold --__os_type=Linux --__platform=Ubuntu --cli-output=json --cli-query='images[].{id:id,name:name}'
hcloud --skeleton ECS CreateServers
hcloud --dryrun ECS CreateServers --cli-region=la-north-2 \
--server.name=demo-ecs \
--server.flavor_ref=c6.large.2 \
--server.image_ref=IMAGE_ID \
--server.availability_zone=la-north-2a \
--nics.1.subnet_id=SUBNET_ID \
--nics.1.vpc_id=VPC_ID \
--security_groups.1.id=SG_ID
hcloud ECS CreateServers --cli-region=la-north-2 \
--cli-waiter='{"expr":"server.status","to":"ACTIVE","timeout":300}' \
--server.name=demo-ecs \
--server.flavor_ref=c6.large.2 \
--server.image_ref=IMAGE_ID \
--server.availability_zone=la-north-2a \
--nics.1.subnet_id=SUBNET_ID \
--nics.1.vpc_id=VPC_ID \
--security_groups.1.id=SG_ID
hcloud ECS ListServersDetails --cli-region=la-north-2 --name=demo-ecs --cli-output=json --cli-query='servers[].{name:name,id:id,status:status}'
Example: Multi-region query
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[].{name:name,id:id}'
hcloud VPC ListVpcs --cli-region=ap-southeast-1 --cli-output=json --cli-query='vpcs[].{name:name,id:id}'
hcloud VPC ListVpcs --cli-region=eu-west-101 --cli-output=json --cli-query='vpcs[].{name:name,id:id}'
Example: Find and delete a resource
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[?name==`old-vpc`].id'
hcloud --dryrun VPC DeleteVpc --cli-region=la-north-2 --vpc_id=VPC_ID
hcloud VPC DeleteVpc --cli-region=la-north-2 --vpc_id=VPC_ID
hcloud VPC ListVpcs --cli-region=la-north-2 --cli-output=json --cli-query='vpcs[?name==`old-vpc`]'
Example: Upload files to OBS
hcloud obs config -e=https://obs.la-north-2.myhuaweicloud.com -i=AK -k=SK
hcloud obs ls -s
hcloud obs mb obs://my-bucket -location=la-north-2
hcloud obs cp ./data/ obs://my-bucket/data/ -r -dryRun
hcloud obs cp ./data/ obs://my-bucket/data/ -r
hcloud obs ls obs://my-bucket/data/ -s
Specific tasks