huaweicloud-devkit 0.1.26-dev.0 → 1.0.1
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 +70 -104
- package/README.zh-CN.md +138 -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/.mcp.json +3 -1
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -0
- package/plugins/huaweicloud-core/safety/policy.json +15 -1
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +21 -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 +51 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +23 -3
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +21 -3
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -0
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +48 -5
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +134 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +5 -2
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +7 -6
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +3 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +1 -1
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +87 -0
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -0
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +11 -0
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +87 -0
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +153 -0
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +105 -0
- package/plugins/huaweicloud-core/src/setup-cli.mjs +733 -74
- package/plugins/huaweicloud-core/src/tools.mjs +164 -3
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -0
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -0
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -0
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
2
|
+
"interface": {
|
|
3
|
+
"displayName": "HuaweiCloud Devkit",
|
|
4
|
+
"shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
|
|
5
|
+
"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.",
|
|
6
|
+
"developerName": "HuaweiCloud Mate",
|
|
7
|
+
"category": "Cloud",
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"Read",
|
|
10
|
+
"Interactive"
|
|
11
|
+
],
|
|
12
|
+
"websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
13
|
+
"brandColor": "#C7000B",
|
|
14
|
+
"defaultPrompt": [
|
|
15
|
+
"Help me choose the right Huawei Cloud capability.",
|
|
16
|
+
"Check my Huawei Cloud CLI setup safely.",
|
|
17
|
+
"Plan this Huawei Cloud API or SDK task."
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"mcpServers": "./.mcp.json",
|
|
21
|
+
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
|
+
"skills": "./skills/",
|
|
23
|
+
"version": "1.0.1",
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "HuaweiCloud Mate",
|
|
26
|
+
"url": "https://github.com/huaweicloud"
|
|
27
|
+
},
|
|
28
|
+
"hooks": "./hooks/",
|
|
29
|
+
"name": "huaweicloud-core",
|
|
30
|
+
"homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
31
|
+
"repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"huaweicloud",
|
|
35
|
+
"huawei-cloud",
|
|
36
|
+
"koocli",
|
|
37
|
+
"hcloud",
|
|
38
|
+
"agent",
|
|
39
|
+
"mcp",
|
|
40
|
+
"api",
|
|
41
|
+
"sdk",
|
|
42
|
+
"skills"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -82,5 +82,19 @@
|
|
|
82
82
|
"ls",
|
|
83
83
|
"dir",
|
|
84
84
|
"Get-ChildItem"
|
|
85
|
-
]
|
|
85
|
+
],
|
|
86
|
+
"blockedSandboxCommands": [
|
|
87
|
+
"rm\\s+-rf\\s+/",
|
|
88
|
+
"mkfs",
|
|
89
|
+
"dd\\s+if=",
|
|
90
|
+
":\\(\\)\\{:\\|:&\\};:",
|
|
91
|
+
"shutdown",
|
|
92
|
+
"reboot",
|
|
93
|
+
"init\\s+[06]",
|
|
94
|
+
"fdisk"
|
|
95
|
+
],
|
|
96
|
+
"sandboxWriteTools": [
|
|
97
|
+
"huaweicloud_sandbox_connect",
|
|
98
|
+
"huaweicloud_sandbox_credentials"
|
|
99
|
+
]
|
|
86
100
|
}
|
|
@@ -173,6 +173,27 @@
|
|
|
173
173
|
},
|
|
174
174
|
"message": "The generated plan may create high-cost or unbounded capacity.",
|
|
175
175
|
"remediation": "Use small preview defaults, explicit quotas, budget labels, and user approval before creating high-cost resources."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"id": "hwc-sandbox-destructive-command",
|
|
179
|
+
"title": "Destructive command in sandbox terminal",
|
|
180
|
+
"category": "destructive",
|
|
181
|
+
"severity": "deny",
|
|
182
|
+
"stages": ["command"],
|
|
183
|
+
"match": {
|
|
184
|
+
"any": [
|
|
185
|
+
{ "field": "text", "regex": "rm\\s+-rf\\s+/" },
|
|
186
|
+
{ "field": "text", "regex": "mkfs" },
|
|
187
|
+
{ "field": "text", "regex": "dd\\s+if=" },
|
|
188
|
+
{ "field": "text", "regex": ":\\\\(\\\\)\\\\{[^}]*\\\\|[^}]*&[^}]*\\\\}[^;]*;:" },
|
|
189
|
+
{ "field": "text", "regex": "\\bshutdown\\b" },
|
|
190
|
+
{ "field": "text", "regex": "\\breboot\\b" },
|
|
191
|
+
{ "field": "text", "regex": "\\binit\\s+[06]\\b" },
|
|
192
|
+
{ "field": "text", "regex": "\\bfdisk\\b" }
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
"message": "The sandbox terminal command is destructively dangerous and could destroy the workspace.",
|
|
196
|
+
"remediation": "Use targeted deletions instead of recursive root removal. Avoid disk format, fork bombs, and system shutdown commands in sandbox terminals."
|
|
176
197
|
}
|
|
177
198
|
]
|
|
178
199
|
}
|
|
@@ -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
|
|
@@ -82,7 +132,7 @@ Abort if the result set is larger than `--limit` and ask the user to narrow the
|
|
|
82
132
|
| Cannot SSH | SG missing port 22 or no EIP -> Add ingress rule / Bind EIP |
|
|
83
133
|
| Flavor unavailable | Region limitation -> ListFlavors in target region |
|
|
84
134
|
| Insufficient resources | Stock depleted -> Change flavor or AZ |
|
|
85
|
-
| AuthFailure | Expired AK/SK ->
|
|
135
|
+
| AuthFailure | Expired AK/SK -> re-run `npx huaweicloud-devkit auth init` |
|
|
86
136
|
| APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
|
|
87
137
|
| Cannot SSH (port 22 open) | SCP policy may be blocking SSH. Check `SYS.0403` errors in command output -> Use cloud-init/user_data for initial setup instead. See `references/create-instance.md` §Bootstrap |
|
|
88
138
|
|
|
@@ -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
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP BindPublicIp` |
|
|
14
14
|
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名 |
|
|
15
15
|
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放 |
|
|
16
|
-
| AuthFailure | AK/SK 过期或无效 | `
|
|
16
|
+
| AuthFailure | AK/SK 过期或无效 | `npx huaweicloud-devkit auth init` 重新配置统一凭据 |
|
|
17
17
|
|
|
18
18
|
## 创建失败诊断流程
|
|
19
19
|
|
|
@@ -95,7 +95,7 @@ See `references/deploy-workflow.md` for a step-by-step example with code templat
|
|
|
95
95
|
| DeleteFunction with `:latest` | Strip `:latest` version suffix from URN |
|
|
96
96
|
| Code too large | Inline limit 10KB — use `zip`/`obs` code type |
|
|
97
97
|
| Cold start slow | Set reserved instances for critical functions |
|
|
98
|
-
| Auth failure | Run `
|
|
98
|
+
| Auth failure | Run `npx huaweicloud-devkit auth init` |
|
|
99
99
|
|
|
100
100
|
## Security Considerations
|
|
101
101
|
|
|
@@ -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.
|
|
@@ -19,11 +19,11 @@ version: 1
|
|
|
19
19
|
## First-Time Setup
|
|
20
20
|
1. **Install KooCLI** using command above
|
|
21
21
|
2. **Accept privacy policy** (first run only): KooCLI requires one-time privacy agreement. Run `hcloud version` to read the agreement, then respond `y` to accept. Do not pipe `echo "y" |` — you must review the terms first.
|
|
22
|
-
3. **Configure credentials**: `hcloud configure init
|
|
22
|
+
3. **Configure credentials (unified)**: `npx huaweicloud-devkit auth init` — prefer this over `hcloud configure init`, which only covers KooCLI.
|
|
23
23
|
4. **Verify**: `hcloud configure list` to confirm profile, then `hcloud ECS ListServersDetails --cli-region=cn-north-4`
|
|
24
24
|
5. For detailed auth guidance, see `huaweicloud-cli-and-auth` skill
|
|
25
25
|
|
|
26
|
-
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `
|
|
26
|
+
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `npx huaweicloud-devkit auth init` (unified, interactive, recommended) or `hcloud configure init` (KooCLI only) to avoid secrets in shell history.
|
|
27
27
|
|
|
28
28
|
### Non-Interactive Setup (Agent/CI Environments)
|
|
29
29
|
|
|
@@ -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
|
|
|
@@ -69,6 +79,13 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
|
|
|
69
79
|
|
|
70
80
|
> KooCLI OBS does NOT support `SetBucketWebsite`. Configure static website hosting via REST API (`PUT /?website`) or the Huawei Cloud console.
|
|
71
81
|
|
|
82
|
+
## Single-File Quick Share
|
|
83
|
+
|
|
84
|
+
See `references/single-file-share.md` for the full workflow to host one file and get a shareable link in seconds:
|
|
85
|
+
|
|
86
|
+
- **Private, time-limited**: `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>` (max 7 days)
|
|
87
|
+
- **Public, permanent**: `hcloud OBS cp <file> obs://<bucket>/<key> -f` + `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read`, then share `https://<bucket>.obs.<region>.myhuaweicloud.com/<key>`
|
|
88
|
+
|
|
72
89
|
## Storage Classes
|
|
73
90
|
|
|
74
91
|
| Class | Use Case | Min Storage | Retrieval Fee |
|
|
@@ -82,7 +99,7 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
|
|
|
82
99
|
| Error | Root Cause -> Fix |
|
|
83
100
|
|-------|------------------|
|
|
84
101
|
| AccessDenied on bucket | IAM/bucket policy/ACL conflict -> Check all three layers |
|
|
85
|
-
| BucketAlreadyExists | Name taken globally ->
|
|
102
|
+
| BucketAlreadyExists | Name taken globally -> Generate unique name with timestamp suffix: `{prefix}-{yyyymmddHHMMSS}` |
|
|
86
103
|
| NoSuchKey | Object doesn't exist or wrong region -> Verify key and region |
|
|
87
104
|
| InvalidAccessKeyId | OBS uses AK/SK directly -> Verify AK/SK validity, OBS endpoint, OBS permissions |
|
|
88
105
|
| EntityTooLarge | Single PUT limit 5GB -> Use multipart upload |
|
|
@@ -105,5 +122,6 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
|
|
|
105
122
|
|
|
106
123
|
- OBS Docs: https://support.huaweicloud.com/obs/
|
|
107
124
|
- Static website: references/static-website.md
|
|
125
|
+
- Single-file share: references/single-file-share.md
|
|
108
126
|
- Lifecycle: references/bucket-lifecycle.md
|
|
109
127
|
- Replication: references/replication.md
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# OBS Single-File Quick Share
|
|
2
|
+
|
|
3
|
+
Host one file and get a shareable link in seconds. Two options:
|
|
4
|
+
|
|
5
|
+
| Option | Link type | Bucket/object visibility | Expiry |
|
|
6
|
+
|--------|-----------|--------------------------|--------|
|
|
7
|
+
| Presigned URL | Time-limited private link | Keep private | `-e=<seconds>`, max 7 days |
|
|
8
|
+
| Public URL | Permanent public link | Set object `-acl=public-read` | None |
|
|
9
|
+
|
|
10
|
+
## Option 1: Presigned URL (private, time-limited)
|
|
11
|
+
|
|
12
|
+
No ACL change needed. The object stays private; the link grants temporary access.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
hcloud OBS cp <file> obs://<bucket>/<key> -f
|
|
16
|
+
hcloud OBS sign obs://<bucket>/<key> -e=3600 # valid 1 hour, max 604800 (7 days)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The `sign` command prints the full presigned URL directly — share it as-is.
|
|
20
|
+
|
|
21
|
+
## Option 2: Public URL (permanent, public-read)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
hcloud OBS cp <file> obs://<bucket>/<key> -f
|
|
25
|
+
hcloud OBS chattri obs://<bucket>/<key> -acl=public-read
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The shareable public URL follows the OBS endpoint format (NOT the `obs-website` static-site endpoint):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
https://<bucket>.obs.<region>.myhuaweicloud.com/<key>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Key Gotchas
|
|
35
|
+
|
|
36
|
+
- **Bucket ACL does NOT cascade**: `chattri obs://<bucket> -acl=public-read` alone does not make objects public. Set the object-level ACL explicitly.
|
|
37
|
+
- **`-f` is mandatory**: `cp` without `-f` prompts "Please input (y/n)" on overwrite → agent hangs (TIMEOUT).
|
|
38
|
+
- **Public-read means anyone with the link can access**: use presigned URLs when the file is sensitive.
|
|
39
|
+
- **Presigned URL max expiry is 7 days** (`-e=604800`). For longer-lived public access, use the public-read option.
|
|
40
|
+
- **Credential setup**: OBS uses a separate config (`~/.obsutilconfig`). Call `huaweicloud_setup_obs_config` before first use.
|