huaweicloud-devkit 0.1.26-dev.0 → 1.0.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -106
- package/README.zh-CN.md +115 -0
- package/package.json +3 -2
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +42 -42
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -0
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +22 -2
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +17 -0
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +50 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +23 -3
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +13 -3
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +48 -5
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +5 -2
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +5 -5
- package/plugins/huaweicloud-core/src/setup-cli.mjs +173 -28
- package/plugins/huaweicloud-core/src/tools.mjs +5 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "huaweicloud-core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "HuaweiCloud Mate",
|
|
7
|
+
"url": "https://github.com/huaweicloud"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
10
|
+
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"keywords": [
|
|
13
|
+
"huaweicloud",
|
|
14
|
+
"huawei-cloud",
|
|
15
|
+
"koocli",
|
|
16
|
+
"hcloud",
|
|
17
|
+
"agent",
|
|
18
|
+
"mcp",
|
|
19
|
+
"api",
|
|
20
|
+
"sdk",
|
|
21
|
+
"skills"
|
|
22
|
+
],
|
|
23
|
+
"skills": "./skills/",
|
|
24
|
+
"mcpServers": "./.mcp.json",
|
|
25
|
+
"hooks": "./hooks/",
|
|
26
|
+
"interface": {
|
|
27
|
+
"displayName": "HuaweiCloud Devkit",
|
|
28
|
+
"shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
29
|
+
"longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
|
|
30
|
+
"developerName": "HuaweiCloud Mate",
|
|
31
|
+
"category": "Cloud",
|
|
32
|
+
"capabilities": [
|
|
33
|
+
"Read",
|
|
34
|
+
"Interactive"
|
|
35
|
+
],
|
|
36
|
+
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
37
|
+
"brandColor": "#C7000B",
|
|
38
|
+
"defaultPrompt": [
|
|
39
|
+
"Help me choose the right Huawei Cloud capability.",
|
|
40
|
+
"Check my Huawei Cloud CLI setup safely.",
|
|
41
|
+
"Plan this Huawei Cloud API or SDK task."
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -54,14 +54,34 @@ Key gotchas when creating:
|
|
|
54
54
|
|
|
55
55
|
### Add Public Access (ELB Provider Only)
|
|
56
56
|
|
|
57
|
+
`BASIC` instances have no public IP. Use `PROFESSIONAL` + `elb` provider for public access (`lvs` is internal-only).
|
|
58
|
+
|
|
57
59
|
```bash
|
|
58
60
|
hcloud APIG AddIngressEipV2 \
|
|
59
61
|
--instance_id=<id> \
|
|
60
62
|
--bandwidth_charging_mode=bandwidth \
|
|
61
|
-
--bandwidth_size
|
|
63
|
+
--bandwidth_size=<size>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
To use an existing EIP instead of creating a new one:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
hcloud APIG AddIngressEipV2 \
|
|
70
|
+
--instance_id=<id> \
|
|
71
|
+
--eip_id=<existing-eip-id>
|
|
62
72
|
```
|
|
63
73
|
|
|
64
|
-
> `AddIngressEipV2` only works with `elb` provider. `AddEipV2` requires `lvs` provider. Bandwidth minimum is 5 Mbps.
|
|
74
|
+
> `AddIngressEipV2` only works with `elb` provider. `AddEipV2` (without "Ingress") requires `lvs` provider. Bandwidth minimum is 5 Mbps.
|
|
75
|
+
|
|
76
|
+
**Verification** — After binding, poll the instance to confirm EIP is active:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
hcloud APIG ListInstancesV2 --cli-region=<region> --instance_id=<id> --cli-output=json | jq '.instances[0].eip_address'
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Wait for `eip_address` to show a valid IP (may take up to 2 minutes). If `eip_address` is still `null` after 2 minutes, the EIP may not have been assigned.
|
|
83
|
+
|
|
84
|
+
> **Trap**: `sl_domain` from `CreateApiGroupV2` is an **internal-only** domain (e.g., `*.apic.cn-north-4.huaweicloudapis.com`). It may resolve to internal IP only (NXDOMAIN from public internet). **For public access, always use the `eip_address` from the instance**, not the `sl_domain` or trigger `invoke_url`.
|
|
65
85
|
|
|
66
86
|
## API Group
|
|
67
87
|
|
|
@@ -53,6 +53,23 @@ hcloud CES CreateAlarm --help
|
|
|
53
53
|
# --condition.comparison_operator, --condition.count
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
### `--condition.comparison_operator` Legal Values
|
|
57
|
+
|
|
58
|
+
For metric alarms use **symbols** (NOT words like `gt`/`lt`):
|
|
59
|
+
|
|
60
|
+
| Value | Meaning |
|
|
61
|
+
|-------|---------|
|
|
62
|
+
| `>` | Greater than |
|
|
63
|
+
| `>=` | Greater than or equal |
|
|
64
|
+
| `<` | Less than |
|
|
65
|
+
| `<=` | Less than or equal |
|
|
66
|
+
| `=` | Equal |
|
|
67
|
+
| `!=` | Not equal |
|
|
68
|
+
|
|
69
|
+
For event alarms: `cycle_decrease`, `cycle_increase`, `cycle_wave`.
|
|
70
|
+
|
|
71
|
+
> **Trap**: Shell may interpret `>` and `<` as redirect operators. Always quote: `--condition.comparison_operator=">="` or use `--cli-jsonInput=<file>`.
|
|
72
|
+
|
|
56
73
|
## Troubleshooting
|
|
57
74
|
|
|
58
75
|
| Error | Fix |
|
|
@@ -12,7 +12,7 @@ description: |
|
|
|
12
12
|
|
|
13
13
|
# Huawei Cloud Agent Skills Search and Discovery
|
|
14
14
|
|
|
15
|
-
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
15
|
+
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
16
16
|
|
|
17
17
|
## Scenario Description
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ Always run `hcloud DDS <Operation> --help` or `hcloud DCS <Operation> --help` be
|
|
|
12
12
|
|
|
13
13
|
## DDS (Document Database Service — MongoDB Compatible)
|
|
14
14
|
|
|
15
|
-
## Critical Warnings
|
|
15
|
+
## DDS Critical Warnings
|
|
16
16
|
|
|
17
17
|
| Trap | Why |
|
|
18
18
|
|------|-----|
|
|
@@ -35,7 +35,7 @@ Discover exact parameters with `--help` before executing any command.
|
|
|
35
35
|
|
|
36
36
|
## DCS (Distributed Cache Service — Redis/Memcached)
|
|
37
37
|
|
|
38
|
-
## Critical Warnings
|
|
38
|
+
## DCS Critical Warnings
|
|
39
39
|
|
|
40
40
|
| Trap | Why |
|
|
41
41
|
|------|-----|
|
|
@@ -57,6 +57,7 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
|
|
|
57
57
|
| Security group rule | hcloud VPC CreateSecurityGroupRule --security_group_id=<id> --direction=<direction> --protocol=<protocol> | references/sg.md |
|
|
58
58
|
| Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
|
|
59
59
|
| Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
|
|
60
|
+
| Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
|
|
60
61
|
|
|
61
62
|
## How to Search for Instances
|
|
62
63
|
|
|
@@ -66,8 +67,57 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
|
|
|
66
67
|
2. Filter client-side by name substring, tag, or status
|
|
67
68
|
3. Use `--server_tags` filter if instances are tagged: `hcloud ECS ListServersDetails --server_tags.1.key=Project`
|
|
68
69
|
|
|
70
|
+
> **Return structure**: `ListServersDetails` returns `{"servers": [...]}` (array), NOT `{"server": ...}`. Parse as `.servers[0].status`, NOT `.server.status`.
|
|
71
|
+
|
|
69
72
|
Abort if the result set is larger than `--limit` and ask the user to narrow the search.
|
|
70
73
|
|
|
74
|
+
## Instance Status Polling
|
|
75
|
+
|
|
76
|
+
ECS creation is asynchronous. Status transitions: `BUILD` → `ACTIVE` (or `ERROR`). Wait times vary widely (20s–3min), never use fixed sleep.
|
|
77
|
+
|
|
78
|
+
Poll strategy:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
for i in $(seq 1 30); do
|
|
82
|
+
status=$(hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id> --cli-output=json | jq -r '.servers[0].status')
|
|
83
|
+
if [ "$status" = "ACTIVE" ]; then break; fi
|
|
84
|
+
if [ "$status" = "ERROR" ]; then echo "Creation failed"; exit 1; fi
|
|
85
|
+
sleep 10
|
|
86
|
+
done
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
- Poll interval: 10 seconds
|
|
90
|
+
- Maximum wait: 5 minutes (30 iterations)
|
|
91
|
+
- Check for `ERROR` status to detect creation failures early
|
|
92
|
+
|
|
93
|
+
## SSH Connection Verification
|
|
94
|
+
|
|
95
|
+
After ECS is ACTIVE and EIP is bound, verify SSH connectivity:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id>
|
|
99
|
+
# → addresses.<vpc-id>[].OS-EXT-IPS:addr
|
|
100
|
+
|
|
101
|
+
ssh -o StrictHostKeyChecking=accept-new -i <path-to-private-key> root@<eip-address>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
> **SSH verification checklist**: EIP bound → security group has port 22 ingress → keypair private key saved locally → known_hosts handled with `StrictHostKeyChecking=accept-new` (or delete stale entries with `ssh-keygen -R <ip>`).
|
|
105
|
+
|
|
106
|
+
### Running Commands Inside the Instance
|
|
107
|
+
|
|
108
|
+
Use SSH for any in-instance operations (install software, check logs, start services):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'command'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Example — re-run failed cloud-init setup manually:
|
|
115
|
+
```bash
|
|
116
|
+
ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'dnf install -y nginx && systemctl enable --now nginx'
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> If SCP blocks SSH, use cloud-init `--server.user_data` for full deployment instead. See `references/create-instance.md` §Bootstrap.
|
|
120
|
+
|
|
71
121
|
## Deleting Instances
|
|
72
122
|
|
|
73
123
|
- Show the user the exact command and get explicit approval before running
|
|
@@ -59,8 +59,13 @@ hcloud ECS CreateServers ... --server.user_data=$user_data
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
> **Security**: Never embed secrets (passwords, AK/SK, tokens) in user_data. It is stored unencrypted and readable from within the instance via IMDS. Fetch secrets at boot from DEW/CSMS instead.
|
|
62
|
-
|
|
62
|
+
>
|
|
63
63
|
> **Debugging**: If the script didn't run, check `/var/log/cloud-init-output.log` on the instance.
|
|
64
|
+
>
|
|
65
|
+
> **Recovery after failure**: user_data only executes on **first boot**. Restarting the instance will NOT re-run user_data scripts. If cloud-init fails (e.g., DNS missing → `yum`/`apt` cannot resolve repos):
|
|
66
|
+
> 1. Fix the root cause (e.g., update subnet DNS via `VPC UpdateSubnet`)
|
|
67
|
+
> 2. Either: SSH into the instance and run the setup commands manually (see `huawei-ecs` → SSH Connection Verification → Running Commands Inside the Instance)
|
|
68
|
+
> 3. Or: Delete the instance and recreate with corrected user_data (fresh boot)
|
|
64
69
|
|
|
65
70
|
## 7. EIP (two methods)
|
|
66
71
|
|
|
@@ -81,16 +86,31 @@ hcloud ECS CreateServers \
|
|
|
81
86
|
### Method B: Create and bind separately
|
|
82
87
|
hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
|
|
83
88
|
|
|
89
|
+
```bash
|
|
84
90
|
# Get the ECS network port ID
|
|
85
91
|
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
86
92
|
# → addresses.<vpc-id>[].OS-EXT-IPS:port_id
|
|
87
93
|
|
|
88
94
|
# Bind EIP via port
|
|
89
95
|
hcloud EIP AssociatePublicips --publicip_id=<eip-id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
96
|
+
```
|
|
90
97
|
|
|
91
98
|
## 8. Verify
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
|
|
100
|
+
ECS creation is asynchronous. Wait times vary widely (20s to 3min). Status transitions: `BUILD` → `ACTIVE` (or `ERROR`). Never use fixed sleep — poll actively:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
for i in $(seq 1 30); do
|
|
104
|
+
status=$(hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id> --cli-output=json | jq -r '.servers[0].status')
|
|
105
|
+
if [ "$status" = "ACTIVE" ]; then break; fi
|
|
106
|
+
if [ "$status" = "ERROR" ]; then echo "Creation failed"; exit 1; fi
|
|
107
|
+
sleep 10
|
|
108
|
+
done
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
- Poll interval: 10 seconds
|
|
112
|
+
- Maximum wait: 5 minutes (30 iterations)
|
|
113
|
+
- After ACTIVE, confirm once more: `hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>`
|
|
94
114
|
|
|
95
115
|
### Verify HTTP accessibility (if EIP bound)
|
|
96
116
|
|
|
@@ -138,5 +138,5 @@ hcloud FunctionGraph DeleteFunctionTrigger --function_urn=<urn> --trigger_type_c
|
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
> Deleting a trigger does NOT cascade-delete the associated APIG API. After `DeleteFunctionTrigger`, also run `hcloud APIG ListApisV2 --instance_id=<id>` and delete orphaned APIs to avoid resource residue.
|
|
141
|
-
|
|
141
|
+
>
|
|
142
142
|
> **APIG event format**: When using DEDICATEDGATEWAY, the event body is Base64 encoded and uses a non-standard structure. See `apig-event-format.md` for handler templates.
|
|
@@ -31,7 +31,7 @@ Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/ob
|
|
|
31
31
|
|
|
32
32
|
| Trap | Why |
|
|
33
33
|
|------|-----|
|
|
34
|
-
| Bucket name is global | All users share bucket namespace |
|
|
34
|
+
| Bucket name is global | All users share bucket namespace. Always use a unique name: `{prefix}-{timestamp}` (e.g. `mybucket-20260810155048`) |
|
|
35
35
|
| Three-layer permissions | IAM > Bucket Policy > ACL. Most restrictive wins |
|
|
36
36
|
| Versioning is irreversible | Once enabled, cannot be disabled, only suspended |
|
|
37
37
|
| OBS uses AK/SK directly | NOT IAM tokens. Auth errors mean check AK/SK validity |
|
|
@@ -42,7 +42,17 @@ Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/ob
|
|
|
42
42
|
|
|
43
43
|
## OBS Credential Setup (Required Before First Use)
|
|
44
44
|
|
|
45
|
-
KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`.
|
|
45
|
+
KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`. All OBS commands fail with credential errors until this is configured.
|
|
46
|
+
|
|
47
|
+
**In-session bootstrap (recommended)**: Call `huaweicloud_setup_obs_config` — it syncs AK/SK from the active hcloud profile automatically. No manual key entry needed. Run this once per session before any OBS command.
|
|
48
|
+
|
|
49
|
+
**CLI fallback** (if MCP tools unavailable):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
hcloud OBS config -e=<endpoint> -i=<AK> -k=<SK> -t=token
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> `huaweicloud_setup_obs_config` should be called at the start of every OBS task — never assume credentials are pre-configured from a previous session.
|
|
46
56
|
|
|
47
57
|
## Common Workflows
|
|
48
58
|
|
|
@@ -82,7 +92,7 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
|
|
|
82
92
|
| Error | Root Cause -> Fix |
|
|
83
93
|
|-------|------------------|
|
|
84
94
|
| AccessDenied on bucket | IAM/bucket policy/ACL conflict -> Check all three layers |
|
|
85
|
-
| BucketAlreadyExists | Name taken globally ->
|
|
95
|
+
| BucketAlreadyExists | Name taken globally -> Generate unique name with timestamp suffix: `{prefix}-{yyyymmddHHMMSS}` |
|
|
86
96
|
| NoSuchKey | Object doesn't exist or wrong region -> Verify key and region |
|
|
87
97
|
| InvalidAccessKeyId | OBS uses AK/SK directly -> Verify AK/SK validity, OBS endpoint, OBS permissions |
|
|
88
98
|
| EntityTooLarge | Single PUT limit 5GB -> Use multipart upload |
|
|
@@ -29,7 +29,7 @@ hcloud RDS <Operation> --cli-region=<region> [--key=value ...]
|
|
|
29
29
|
| Operation | PascalCase: `ListInstances`, `CreateManualBackup` |
|
|
30
30
|
| Params | `--key=value` format. JSON params: `--key='{"k":"v"}'` |
|
|
31
31
|
| Array params | 1-based: `--instance_ids.1=xxx` |
|
|
32
|
-
| Password param | Conflicts with KooCLI system param;
|
|
32
|
+
| Password param | Conflicts with KooCLI system param; use `--cli-jsonInput` (see Critical Warnings) |
|
|
33
33
|
|
|
34
34
|
## Critical Warnings
|
|
35
35
|
|
|
@@ -38,9 +38,12 @@ hcloud RDS <Operation> --cli-region=<region> [--key=value ...]
|
|
|
38
38
|
| Engine version immutable | Cannot change MySQL to PostgreSQL in-place |
|
|
39
39
|
| Automated backups use OBS | Backup storage incurs separate charges. Set retention period explicitly |
|
|
40
40
|
| Storage auto-scaling off by default | Enable before storage runs out or instance goes read-only |
|
|
41
|
-
| `--password` conflicts with KooCLI |
|
|
41
|
+
| `--password` conflicts with KooCLI | Use `--cli-jsonInput=<file>` with JSON file (see `--cli-jsonInput` section below). The `printf "b\n"` workaround is broken in KooCLI 7.2.12+ |
|
|
42
42
|
| Volume type must match flavor | General→CLOUDSSD; Dedicated→CLOUDSSD\|ESSD; ARM→ULTRAHIGH |
|
|
43
43
|
| Flavor not in region | Always `ListFlavors` first. Spec codes vary by region |
|
|
44
|
+
| `database_name` is case-sensitive | Use `MySQL` / `PostgreSQL` / `SQLServer` / `MariaDB` — NOT lower-case `mysql` |
|
|
45
|
+
| Instance creation takes 3–8 min | Status: BUILD→MODIFYING→ACTIVE. Poll every 15s: `hcloud RDS ListInstances --cli-region=<r> --instance_id=<id> \| jq '.instances[0].status'` |
|
|
46
|
+
| Body `--region` is required | CreateInstance body requires `--region=<r>` (same as `--cli-region`) or `DBS.280243` |
|
|
44
47
|
| Restore creates new instance | No in-place restore. Verify target flavor before restoring |
|
|
45
48
|
|
|
46
49
|
## Instance Management
|
|
@@ -56,6 +59,7 @@ hcloud RDS ListEngineFlavors --instance_id=<id> --cli-region=<r>
|
|
|
56
59
|
### Create Instance
|
|
57
60
|
```bash
|
|
58
61
|
hcloud RDS CreateInstance --cli-region=<r> \
|
|
62
|
+
--region=<r> \
|
|
59
63
|
--name=<name> \
|
|
60
64
|
--datastore.type=<engine> \
|
|
61
65
|
--datastore.version=<version> \
|
|
@@ -66,11 +70,36 @@ hcloud RDS CreateInstance --cli-region=<r> \
|
|
|
66
70
|
--subnet_id=<subnet-id> \
|
|
67
71
|
--security_group_id=<sg-id> \
|
|
68
72
|
--availability_zone=<az> \
|
|
69
|
-
--charge_info.charge_mode=<mode>
|
|
70
|
-
--password=<pw>
|
|
73
|
+
--charge_info.charge_mode=<mode>
|
|
71
74
|
```
|
|
72
75
|
|
|
73
|
-
> `--password` conflicts with a KooCLI system param.
|
|
76
|
+
> `--password` conflicts with a KooCLI system param. Use `--cli-jsonInput` (see below). The `printf "b\n"` pipe workaround is broken in KooCLI 7.2.12+.
|
|
77
|
+
|
|
78
|
+
### `--cli-jsonInput` for CreateInstance
|
|
79
|
+
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"path": {
|
|
83
|
+
"project_id": "<project-id>"
|
|
84
|
+
},
|
|
85
|
+
"body": {
|
|
86
|
+
"name": "<name>",
|
|
87
|
+
"region": "<region>",
|
|
88
|
+
"datastore": { "type": "<engine>", "version": "<version>" },
|
|
89
|
+
"ha": { "mode": "single", "replication_mode": "semisync" },
|
|
90
|
+
"flavor_ref": "<flavor-id>",
|
|
91
|
+
"volume": { "type": "<vol-type>", "size": <gb> },
|
|
92
|
+
"vpc_id": "<vpc-id>",
|
|
93
|
+
"subnet_id": "<subnet-id>",
|
|
94
|
+
"security_group_id": "<sg-id>",
|
|
95
|
+
"availability_zone": "<az>",
|
|
96
|
+
"password": "<pw>",
|
|
97
|
+
"charge_info": { "charge_mode": "postPaid" }
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
> Save as `rds-create.json` then: `hcloud RDS CreateInstance --cli-jsonInput=rds-create.json`. For `project_id`, run `hcloud IAM KeystoneListProjects`.
|
|
74
103
|
|
|
75
104
|
| Param | Required | Note |
|
|
76
105
|
|-------|----------|------|
|
|
@@ -139,6 +168,20 @@ psql -h <private_ip> -p 5432 -U root -d postgres
|
|
|
139
168
|
> hcloud does NOT support SQL execution. Use a database client.
|
|
140
169
|
> For public access, bind an EIP (see `huawei-vpc`).
|
|
141
170
|
|
|
171
|
+
### Database Client Acquisition
|
|
172
|
+
|
|
173
|
+
If a database client is not installed on the agent's machine, install one:
|
|
174
|
+
|
|
175
|
+
| Platform | MySQL | PostgreSQL |
|
|
176
|
+
|----------|-------|------------|
|
|
177
|
+
| **Linux** | `apt install mysql-client` / `yum install mysql` | `apt install postgresql-client` |
|
|
178
|
+
| **macOS** | `brew install mysql-client` | `brew install libpq` |
|
|
179
|
+
| **Windows** | Download MySQL Workbench or `winget install Oracle.MySQL` | Download pgAdmin or `winget install PostgreSQL.PostgreSQL` |
|
|
180
|
+
| **Python (any)** | `pip install pymysql` then `python -c "import pymysql; ..."` | `pip install psycopg2` then `python -c "import psycopg2; ..."` |
|
|
181
|
+
| **Docker (any)** | `docker run -it --rm mysql:8 mysql -h <ip> -u root -p` | `docker run -it --rm postgres:16 psql -h <ip> -U root` |
|
|
182
|
+
|
|
183
|
+
> If no client can be installed, use the Huawei Cloud **Data Studio** console: https://console.huaweicloud.com/dms/
|
|
184
|
+
|
|
142
185
|
## Mutating Operations (Require Approval)
|
|
143
186
|
|
|
144
187
|
| Operation | Effect |
|
|
@@ -28,15 +28,17 @@ Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet
|
|
|
28
28
|
| EIP PER type needs `--bandwidth.name` | PER bandwidth requires explicit name; `--help` marks it optional but it's required |
|
|
29
29
|
| **VPC params need nested prefix** | KooCLI 7.x VPC API uses `--vpc.<param>`, `--subnet.<param>`, `--security_group.<param>`. Example: `--vpc.name=xxx` NOT `--name=xxx` |
|
|
30
30
|
| **Security group needs no vpc_id** | VPC v3 API `CreateSecurityGroup` does NOT accept `vpc_id`. Security groups are region-level, not VPC-bound |
|
|
31
|
-
| Subnet DNS empty → ECS no DNS | DNS params (`--subnet.primary_dns`, `--subnet.secondary_dns`) marked optional but empty default breaks cloud-init domain resolution — `yum`/`apt` installs fail silently. Always set both.
|
|
31
|
+
| Subnet DNS empty → ECS no DNS | DNS params (`--subnet.primary_dns`, `--subnet.secondary_dns`) marked optional but empty default breaks cloud-init domain resolution — `yum`/`apt` installs fail silently. Always set both. Common DNS IPs: cn-north-4 (100.125.1.250 / 100.125.1.251), cn-north-1 (100.125.1.250 / 100.125.129.250), cn-east-3 (100.125.1.250 / 100.125.129.250), ap-southeast-3 (100.125.1.250 / 100.125.128.250) |
|
|
32
32
|
| SCP blocks 0.0.0.0/0 SG rules | If `CreateSecurityGroupRule` with `--remote_ip_prefix=0.0.0.0/0` fails with `SYS.0403`, an org-level SCP policy is denying wide-open rules. Narrow to a specific CIDR range (e.g., your office IP) instead |
|
|
33
|
+
| **VPC tags use `*` separator** | VPC tag format: `--vpc.tags.1=env*test` (asterisk between key and value). NOT `--vpc.tags.1.key=env` (ECS-style). This is different from ECS `--server.metadata.key=value` |
|
|
33
34
|
|
|
34
35
|
## Common Workflows
|
|
35
36
|
|
|
36
37
|
| Task | Command | Steps |
|
|
37
38
|
|------|---------|-------|
|
|
38
39
|
| Create VPC | hcloud VPC CreateVpc --vpc.name=<name> --vpc.cidr=<cidr> | CIDR must not conflict with existing VPCs. Run `hcloud VPC ListVpcs` first |
|
|
39
|
-
| Create subnet | hcloud VPC CreateSubnet --subnet.name=<name> --subnet.vpc_id=<id> --subnet.cidr=<cidr> --subnet.gateway_ip=<gw> --subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2> --subnet.availability_zone=<az> | Subnet CIDR must be a subset of the VPC CIDR. DNS addresses vary by region — see
|
|
40
|
+
| Create subnet | hcloud VPC CreateSubnet --subnet.name=<name> --subnet.vpc_id=<id> --subnet.cidr=<cidr> --subnet.gateway_ip=<gw> --subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2> --subnet.availability_zone=<az> | Subnet CIDR must be a subset of the VPC CIDR. DNS addresses vary by region — see Critical Warnings for common values |
|
|
41
|
+
| Update subnet | hcloud VPC UpdateSubnet --subnet_id=<id> --subnet.dnsList.1=<dns1> --subnet.dnsList.2=<dns2> | Fix DNS after creation. Restart ECS after updating DNS for cloud-init to pick up changes |
|
|
40
42
|
| Security group | hcloud VPC CreateSecurityGroup --security_group.name=<name> | references/security-group.md |
|
|
41
43
|
| SG rule | hcloud VPC CreateSecurityGroupRule --security_group_rule.security_group_id=<id> --security_group_rule.direction=<direction> --security_group_rule.protocol=<protocol> --security_group_rule.multiport=<port> --security_group_rule.remote_ip_prefix=<cidr> | references/security-group.md |
|
|
42
44
|
| Create EIP | hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name> | Run `hcloud EIP CreatePublicip --help` to confirm valid type values per region |
|
|
@@ -58,6 +60,7 @@ Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet
|
|
|
58
60
|
| VPC.0301: Bandwidth name invalid | PER type requires `--bandwidth.name`, even though `--help` marks it optional |
|
|
59
61
|
| EIP has no public IP after binding | May need AddIngressEipV2 for ELB-type resources (see huawei-apig) |
|
|
60
62
|
| ECS cloud-init fails silently (port 80/443 closed) | Subnet likely has no DNS. Check `hcloud VPC ShowSubnet --subnet_id=<id>` → `dnsList` empty? Rebuild subnet with `--subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2>`. DNS addresses per region: `hcloud VPC CreateSubnet --help` |
|
|
63
|
+
| VPC.0209: Subnet still used | Subnet has dependent resources (ECS/RDS) — delete instances first, then subnet |
|
|
61
64
|
| SYS.0403 / SCP deny | Service Control Policy explicitly denies this operation — contact org admin to adjust SCP, or use an account/region without the restriction. If SSH is blocked, bootstrap via cloud-init user_data instead: see `huawei-ecs` — no SSH needed |
|
|
62
65
|
|
|
63
66
|
## Security Considerations
|
|
@@ -72,14 +72,14 @@ Agent processes find executables through `PATH`. If OpenCode/Codex cannot find `
|
|
|
72
72
|
2. **KooCLI first-run privacy agreement**: On a fresh KooCLI install, `hcloud` blocks with `同意并继续使用(y)/不同意并退出(N)` and fails with `[USE_ERROR]您输入的是无效字符` in non-interactive mode. Detection: check command output for these strings. Ask the user: "KooCLI needs to accept its privacy agreement. May I accept it on your behalf?" If the user agrees, run `huaweicloud_run_readonly_command` with `args=["version"]` and `stdin="y\n"`. This accepts the agreement once, after which hcloud works normally.
|
|
73
73
|
3. Ask the user to configure credentials outside the agent conversation when setup is needed.
|
|
74
74
|
4. Inspect profile and region only through redacted tooling.
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
5. Discover exact operation names with `hcloud <Service> --help` before guessing. Example: ECS instance listing is commonly `ECS ListServersDetails`; ECS creation is commonly `ECS CreateServers`; image lookup may be under `IMS GlanceShowImage`.
|
|
76
|
+
6. Use `--cli-output=json` for machine-readable responses when supported.
|
|
77
|
+
7. For resource operations, include `--cli-region`, `--cli-profile`, and service-specific project information when required.
|
|
78
|
+
8. Classify every command before running it:
|
|
79
79
|
- Read-only: `List*`, `Show*`, `Get*`, `Describe*`.
|
|
80
80
|
- Write: `Create*`, `Delete*`, `Update*`, `Resize*`, `Start*`, `Stop*`, `Authorize*`, and similar.
|
|
81
81
|
- Secret: any operation returning secret string, binary secret, token, or password.
|
|
82
|
-
|
|
82
|
+
9. For write operations, show the exact command and ask for explicit approval.
|
|
83
83
|
|
|
84
84
|
## KooCLI Syntax Notes
|
|
85
85
|
|