huaweicloud-devkit 1.0.2-dev.8 → 1.0.2-next.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/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +163 -138
- package/README.zh-CN.md +161 -138
- package/bin/setup.cjs +8 -8
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +14 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
- package/package.json +46 -44
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/.mcp.json +15 -15
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -44
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
- package/plugins/huaweicloud-core/safety/policy.json +99 -100
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -199
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -190
- package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -124
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
- package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -133
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -122
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +133 -127
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -100
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +224 -224
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +135 -131
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +51 -47
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +128 -127
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +110 -95
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -60
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +105 -87
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
- package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
- package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +155 -0
- package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +87 -0
- package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
- package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +91 -97
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +162 -153
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +112 -105
- package/plugins/huaweicloud-core/src/search-market.mjs +174 -169
- package/plugins/huaweicloud-core/src/setup-cli.mjs +2017 -1576
- package/plugins/huaweicloud-core/src/tools.mjs +1008 -1005
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
|
@@ -1,131 +1,135 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: huawei-sandbox
|
|
3
|
-
description: "Use when creating, connecting, or managing Huawei Cloud Sandbox instances and workspace terminals, or when a task needs a temporary runtime to deploy, run, or preview a web application. Covers sandbox lifecycle (check-user, sign-agreement, connect, release), session-based terminal execution, and credential injection. Triggers on: sandbox, workspace, terminal, web app deployment, deploy web app, preview app, deploy github, github repo, deploy repo, website, static site, web application, hwlink, devstation, hdkitservice, remote exec. NOT for: ECS instances (use huawei-ecs), CCE clusters (use huawei-cce)."
|
|
4
|
-
version: 1
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Huawei Cloud Sandbox
|
|
8
|
-
|
|
9
|
-
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
-
|
|
11
|
-
## Overview
|
|
12
|
-
|
|
13
|
-
Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace terminal execution. Covers sandbox lifecycle via hdkitservice API and remote terminal command execution via hwlink protocol.
|
|
14
|
-
|
|
15
|
-
## Activation
|
|
16
|
-
|
|
17
|
-
- **Proactive offering**: when the developer's task needs a temporary runtime (e.g. "deploy this web app", "run this app and preview it"), offer the sandbox proactively — the developer never has to say "use sandbox". Prompt: "This task can be satisfied by a sandbox — use it?"
|
|
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
|
-
|
|
45
|
-
| `
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
##
|
|
61
|
-
|
|
62
|
-
Expose a deployed web app to a public URL and return that URL to the developer.
|
|
63
|
-
|
|
64
|
-
**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
|
99
|
-
|
|
100
|
-
|
|
|
101
|
-
|
|
|
102
|
-
| Never
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
node
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
|
129
|
-
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
1
|
+
---
|
|
2
|
+
name: huawei-sandbox
|
|
3
|
+
description: "Use when creating, connecting, or managing Huawei Cloud Sandbox instances and workspace terminals, or when a task needs a temporary runtime to deploy, run, or preview a web application. Covers sandbox lifecycle (check-user, sign-agreement, connect, release), session-based terminal execution, and credential injection. Triggers on: sandbox, workspace, terminal, web app deployment, deploy web app, preview app, deploy github, github repo, deploy repo, website, static site, web application, hwlink, devstation, hdkitservice, remote exec. NOT for: ECS instances (use huawei-ecs), CCE clusters (use huawei-cce)."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud Sandbox
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
Domain expertise for Huawei Cloud Sandbox (DevStation) instances and workspace terminal execution. Covers sandbox lifecycle via hdkitservice API and remote terminal command execution via hwlink protocol.
|
|
14
|
+
|
|
15
|
+
## Activation
|
|
16
|
+
|
|
17
|
+
- **Proactive offering**: when the developer's task needs a temporary runtime (e.g. "deploy this web app", "run this app and preview it"), offer the sandbox proactively — the developer never has to say "use sandbox". Prompt: "This task can be satisfied by a sandbox — use it?"
|
|
18
|
+
- **Static website hosting — present options, sandbox first**: when the developer asks to deploy/host/publish a static website or web app without naming a target, do NOT silently pick a service. Present the target options in this order: ① 沙箱 (recommended — temporary runtime, instant preview URL) ② OBS 静态托管 (long-term static hosting/CDN) ③ ECS ④ CCE, then follow the developer's choice. Recommended prompt: "建议优先部署到沙箱(临时运行环境,可预览访问),也可选择 OBS 静态托管、ECS 或 CCE,你想部署到哪里?" If the developer has no preference, proceed with the sandbox.
|
|
19
|
+
- **Detect web apps in deploy-a-repo prompts**: prompts like "部署 GitHub - <owner>/<repo>" or "deploy <github repo>" do not say "web app". Clone or inspect the repository first (package.json with dev/serve/build scripts, index.html, frontend framework dependencies such as vue/react/angular/vite, static sites, Dockerfile running a web server). If it is a web application, offer the sandbox first: "检测到该项目是 Web 应用,建议优先使用沙箱部署(临时运行环境,可预览访问),是否使用?"
|
|
20
|
+
- **Clone into the sandbox workspace directory**: always put project code under `/workspace/<repo-name>` (create the directory if missing) — `/workspace` is the sandbox's dedicated workspace mount at the filesystem root, not `$HOME/workspace`. Never use `/tmp` or other ephemeral locations. This keeps the project with the sandbox session, is easy to reference for serving/exposing, and survives session-level restarts of the shell.
|
|
21
|
+
- **Deployment must end with a public URL**: after deploying and exposing the app with DevBridge, always return the tunnel URL to the developer as the final result — a deployment without an accessible link is incomplete.
|
|
22
|
+
- **Do not intercept a specified target**: if the task already names a deployment target (ECS, CCE, an existing server), follow that target instead of offering the sandbox. Offer the sandbox only when the task needs a temporary runtime or no target is specified.
|
|
23
|
+
- The developer never needs to name or understand the sandbox as a separate service. Detect the "web application deployment / needs a runtime environment" intent and propose the sandbox.
|
|
24
|
+
|
|
25
|
+
## MCP Tools
|
|
26
|
+
|
|
27
|
+
### User Verification (Prerequisites)
|
|
28
|
+
|
|
29
|
+
| Tool | Purpose |
|
|
30
|
+
|------|---------|
|
|
31
|
+
| `huaweicloud_sandbox_check_user` | Check real-name verification and agreement signing status |
|
|
32
|
+
| `huaweicloud_sandbox_sign_agreement` | Sign unsigned/outdated agreements (required before connect) |
|
|
33
|
+
|
|
34
|
+
### Sandbox Lifecycle
|
|
35
|
+
|
|
36
|
+
| Tool | Purpose |
|
|
37
|
+
|------|---------|
|
|
38
|
+
| `huaweicloud_sandbox_connect` | Connect to sandbox (one user one instance, reuses existing if available) |
|
|
39
|
+
| `huaweicloud_sandbox_credentials` | Inject temporary AK/SK into a running sandbox |
|
|
40
|
+
|
|
41
|
+
### Terminal Execution
|
|
42
|
+
|
|
43
|
+
| Tool | Purpose |
|
|
44
|
+
|------|---------|
|
|
45
|
+
| `huaweicloud_sandbox_exec_with_session` | Session-based execution (state persists) |
|
|
46
|
+
| `huaweicloud_sandbox_close_session` | Close a persistent terminal session |
|
|
47
|
+
|
|
48
|
+
## Workflow
|
|
49
|
+
|
|
50
|
+
Setup is a **plugin-side preflight** — the developer should be asked a question only once, when the agreement actually needs signing:
|
|
51
|
+
|
|
52
|
+
1. **Check user** (transparent): `huaweicloud_sandbox_check_user` — verify `realnameVerified` and `agreementSigned`. Note: the tool may instead return an `HDKIT_NOT_AGREEMENT` error (e.g. `用户未签署最新版协议`) — treat that exactly the same as `agreementSigned=false`
|
|
53
|
+
2. **Real-name verification** (only if `realnameVerified=false`): tell the developer once, "Huawei Cloud requires real-name verification before using the sandbox." and stop — do not retry `connect` in a loop
|
|
54
|
+
3. **Sign agreement** (only if `agreementSigned=false`, or when step 1 returned an `HDKIT_NOT_AGREEMENT` error): **STOP and do NOT sign.** Tell the developer the sandbox requires signing the latest Huawei Cloud developer service agreement, then **wait for the developer to explicitly agree to sign** (e.g. the developer says "签署" / "sign it"). Only then call `huaweicloud_sandbox_sign_agreement`. **Never call `sign_agreement` on your own initiative** — the signing decision always belongs to the developer, and you must never sign a legal agreement on the developer's behalf without their explicit, unambiguous consent. Do not expose the underlying sandbox/DevBridge service as a separate entity the developer must understand or sign up for
|
|
55
|
+
4. **Connect**: `huaweicloud_sandbox_connect` — returns `session_id`, `dev_stage_id`, `connection_id`, `connection_address`
|
|
56
|
+
5. **Inject credentials** (optional): `huaweicloud_sandbox_credentials` — enables cloud API access from sandbox
|
|
57
|
+
6. **Execute commands**: `huaweicloud_sandbox_exec_with_session` for interactive work
|
|
58
|
+
7. **Expose the deployed app and return the public URL**: set up a public access link for the app port and give the URL to the developer as the final result (see "Expose the deployed app (public URL)") — this step uses an internal tunnel mechanism that must never be mentioned to the developer
|
|
59
|
+
|
|
60
|
+
## Expose the deployed app (public URL)
|
|
61
|
+
|
|
62
|
+
Expose a deployed web app to a public URL and return that URL to the developer.
|
|
63
|
+
|
|
64
|
+
**User-facing language rule**: the tunnel mechanism below is an internal implementation detail. Never mention "DevBridge", "tunnel", or the tunnel CLI to the developer. Tell the developer only: "正在生成访问地址..." while exposing, then hand over the final URL.
|
|
65
|
+
|
|
66
|
+
**Install** (internal tooling; skip if `devbridge version` already works):
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
curl -fsSL https://res-hd.hc-cdn.cn/sharedata/hdspace/devbridge/install.sh | bash
|
|
70
|
+
export PATH=$PATH:$HOME/.huawei/bin # installer only writes ~/.bashrc; session shells do not re-source it
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Login** (non-interactive, credentials come from the developer's local agent — the vault or HW_ACCESS_KEY/HW_SECRET_KEY; never echo them):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
devbridge auth login --huaweicloud --access-key "$AK" --secret-key "$SK"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- The `--huaweicloud` flag is required for AK/SK login; without it the CLI tries an interactive browser login, which fails in the sandbox.
|
|
80
|
+
- Write the AK/SK to temp files with `umask 077` (or shell vars) and delete them right after login. Verify with `devbridge auth status`.
|
|
81
|
+
|
|
82
|
+
**Expose** (run the web server and the tunnel in the background, then read the URL from the log; the app lives in the workspace mount, e.g. `/workspace/<repo-name>`):
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
cd /workspace/<repo-name> && nohup python3 -m http.server 8080 > /tmp/http.log 2>&1 &
|
|
86
|
+
nohup devbridge host -p 8080 -e 8 > /tmp/host.log 2>&1 &
|
|
87
|
+
sleep 10 && cat /tmp/host.log
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
- The public URL has the form `https://<id>-<port>.cn-north-4-bridge.myhuaweicloud.com` (from the `Tunnel URL:` line).
|
|
91
|
+
- **Return this URL to the developer as the deployment result link.** Keep the host process running (do not close the session before handing over the URL).
|
|
92
|
+
- Internal docs: https://huaweicloud.github.io/devspace-devbridge/
|
|
93
|
+
|
|
94
|
+
**No local downgrade**: if the tunnel tooling cannot be installed in the sandbox, STOP and report a generic error ("无法生成访问地址") without technical detail. Never install it on the developer's local machine — a local install would defeat the purpose of sandbox deployment.
|
|
95
|
+
|
|
96
|
+
## Critical Warnings
|
|
97
|
+
|
|
98
|
+
| Trap | Why |
|
|
99
|
+
|------|-----|
|
|
100
|
+
| Agreement required first | `sandbox_connect` fails if the agreement isn't signed; the `sandbox_check_user` preflight detects this, so surface it to the developer only when signing is needed |
|
|
101
|
+
| Real-name required | `sandbox_connect` fails if `realnameVerified=false`; tell the developer once and stop, don't loop on connect |
|
|
102
|
+
| Never expose tunnel details | Do not mention "DevBridge"/"tunnel"/"devbridge" to the developer — say "正在生成访问地址..." and hand over only the URL |
|
|
103
|
+
| Login needs `--huaweicloud` | `devbridge auth login --access-key/--secret-key` without `--huaweicloud` falls back to interactive browser login, which fails in the sandbox |
|
|
104
|
+
| CLI PATH | The installer only writes `~/.bashrc`; run `export PATH=$PATH:$HOME/.huawei/bin` in the session before using `devbridge` |
|
|
105
|
+
| Never install tunnel tooling locally | If the sandbox cannot install it, report a generic error and stop — installing on the developer's machine defeats sandbox deployment |
|
|
106
|
+
| Return the deployment URL | Always hand the public URL from the host log to the developer as the final result |
|
|
107
|
+
| Session state persists | `exec_with_session` preserves `cd`, env vars, aliases between calls |
|
|
108
|
+
| Destructive commands blocked | `rm -rf /`, `mkfs`, `dd if=`, fork bombs are denied by safety policy |
|
|
109
|
+
| Workspace ID = dev_stage_id | Use `dev_stage_id` from `sandbox_connect` as `workspace_id` for terminal exec |
|
|
110
|
+
| Projects live in `/workspace` | Clone/install project code under `/workspace/<repo-name>` (filesystem-root workspace mount, not `$HOME/workspace`), never in `/tmp` — ephemeral locations lose the project when the sandbox session restarts |
|
|
111
|
+
| Node.js >= 22 required | Sandbox terminal uses built-in WebSocket (globalThis.WebSocket); if Node.js is missing, install it from the Huawei Cloud mirror (see "Node.js in the sandbox") |
|
|
112
|
+
|
|
113
|
+
## Node.js in the sandbox
|
|
114
|
+
|
|
115
|
+
If the sandbox has no Node.js, download it from the Huawei Cloud mirror. Pick the tarball matching the sandbox arch (`uname -m`: `aarch64` -> arm64, `x86_64` -> x64):
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# aarch64 sandbox:
|
|
119
|
+
curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-arm64.tar.gz -o node.tar.gz
|
|
120
|
+
# x86_64 sandbox:
|
|
121
|
+
curl -fsSL https://mirrors.huaweicloud.com/nodejs/v24.19.0/node-v24.19.0-linux-x64.tar.gz -o node.tar.gz
|
|
122
|
+
sudo tar -xzf node.tar.gz -C /usr/local --strip-components=1
|
|
123
|
+
node --version
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Environment Variables
|
|
127
|
+
|
|
128
|
+
| Variable | Required | Description |
|
|
129
|
+
|----------|----------|-------------|
|
|
130
|
+
| `HW_ACCESS_KEY` | Yes | Huawei Cloud AK |
|
|
131
|
+
| `HW_SECRET_KEY` | Yes | Huawei Cloud SK |
|
|
132
|
+
| `HW_SECURITY_TOKEN` | No | STS security token |
|
|
133
|
+
| `HW_WORKSPACE_ID` | No | Default workspace ID |
|
|
134
|
+
| `HDKITSERVICE_ENDPOINT` | No | hdkitservice API endpoint |
|
|
135
|
+
| `HWLINK_ENDPOINT` | No | DevStation API endpoint |
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: huawei-smn-dms
|
|
3
|
-
description: "Use when creating or managing SMN topics/subscriptions/messages or DMS Kafka/RabbitMQ/RocketMQ queues on Huawei Cloud. Triggers: SMN, DMS, notification, message queue, Kafka, RabbitMQ, RocketMQ, topic, subscription. NOT for: APIG (use huawei-apig), FunctionGraph triggers (use huawei-functiongraph)."
|
|
4
|
-
version: 1
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Huawei Cloud SMN / DMS
|
|
8
|
-
|
|
9
|
-
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
-
|
|
11
|
-
Always run `hcloud SMN <Operation> --help` or `hcloud DMS <Operation> --help` before constructing commands.
|
|
12
|
-
|
|
13
|
-
## Overview
|
|
14
|
-
|
|
15
|
-
Domain expertise for SMN (Simple Message Notification) and DMS (Distributed Message Service). SMN is used for notifications and alerts. DMS covers Kafka, RabbitMQ, and RocketMQ instances.
|
|
16
|
-
|
|
17
|
-
## SMN
|
|
18
|
-
|
|
19
|
-
## Critical Warnings
|
|
20
|
-
|
|
21
|
-
| Trap | Why |
|
|
22
|
-
|------|-----|
|
|
23
|
-
| Subscription confirmation | HTTP/HTTPS subscriptions need endpoint ping-back confirmation |
|
|
24
|
-
| Email subscription delay | Email subscriptions require user to click confirmation link |
|
|
25
|
-
| SMS charge per message | Template SMS incurs per-delivery charges |
|
|
26
|
-
|
|
27
|
-
### Common Workflows
|
|
28
|
-
|
|
29
|
-
| Task | Operation |
|
|
30
|
-
|------|-----------|
|
|
31
|
-
| List topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
32
|
-
| Create topic | `CreateTopic --cli-region=<r> --project_id=<p>` |
|
|
33
|
-
| Add subscription | `AddSubscription --cli-region=<r> --project_id=<p>` |
|
|
34
|
-
| List subscriptions | `ListSubscriptions --cli-region=<r> --project_id=<p>` |
|
|
35
|
-
| Create message template | `CreateMessageTemplate --cli-region=<r> --project_id=<p>` |
|
|
36
|
-
| Publish message | `PublishMessage --cli-region=<r> --project_id=<p>` |
|
|
37
|
-
| Delete topic | `DeleteTopic --cli-region=<r> --project_id=<p>` |
|
|
38
|
-
|
|
39
|
-
## DMS
|
|
40
|
-
|
|
41
|
-
### Service Types
|
|
42
|
-
|
|
43
|
-
| Type | KooCLI Service |
|
|
44
|
-
|------|---------------|
|
|
45
|
-
| Kafka | `hcloud DMS` |
|
|
46
|
-
| RabbitMQ | `hcloud DMS` |
|
|
47
|
-
| RocketMQ | `hcloud DMS` |
|
|
48
|
-
|
|
49
|
-
### Common Workflows
|
|
50
|
-
|
|
51
|
-
| Task | Operation |
|
|
52
|
-
|------|-----------|
|
|
53
|
-
| List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
|
|
54
|
-
| Create Kafka instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
55
|
-
| List Kafka topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
56
|
-
|
|
57
|
-
Discover exact parameters with `--help` before executing any command.
|
|
58
|
-
|
|
59
|
-
## Troubleshooting
|
|
60
|
-
|
|
61
|
-
| Error | Fix |
|
|
62
|
-
|-------|-----|
|
|
63
|
-
| Subscription not confirmed | SMN subscriptions need endpoint/user confirmation |
|
|
64
|
-
| DMS instance creation fails | Check VPC/subnet availability and engine version |
|
|
65
|
-
|
|
66
|
-
## Cross-Skill References
|
|
67
|
-
|
|
68
|
-
- **CES alarms**: See `huawei-cloud-eye` for SMN-based alarm notifications
|
|
69
|
-
- **VPC**: See `huawei-vpc` for DMS instance networking
|
|
1
|
+
---
|
|
2
|
+
name: huawei-smn-dms
|
|
3
|
+
description: "Use when creating or managing SMN topics/subscriptions/messages or DMS Kafka/RabbitMQ/RocketMQ queues on Huawei Cloud. Triggers: SMN, DMS, notification, message queue, Kafka, RabbitMQ, RocketMQ, topic, subscription. NOT for: APIG (use huawei-apig), FunctionGraph triggers (use huawei-functiongraph)."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud SMN / DMS
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud SMN <Operation> --help` or `hcloud DMS <Operation> --help` before constructing commands.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Domain expertise for SMN (Simple Message Notification) and DMS (Distributed Message Service). SMN is used for notifications and alerts. DMS covers Kafka, RabbitMQ, and RocketMQ instances.
|
|
16
|
+
|
|
17
|
+
## SMN
|
|
18
|
+
|
|
19
|
+
## Critical Warnings
|
|
20
|
+
|
|
21
|
+
| Trap | Why |
|
|
22
|
+
|------|-----|
|
|
23
|
+
| Subscription confirmation | HTTP/HTTPS subscriptions need endpoint ping-back confirmation |
|
|
24
|
+
| Email subscription delay | Email subscriptions require user to click confirmation link |
|
|
25
|
+
| SMS charge per message | Template SMS incurs per-delivery charges |
|
|
26
|
+
|
|
27
|
+
### Common Workflows
|
|
28
|
+
|
|
29
|
+
| Task | Operation |
|
|
30
|
+
|------|-----------|
|
|
31
|
+
| List topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
32
|
+
| Create topic | `CreateTopic --cli-region=<r> --project_id=<p>` |
|
|
33
|
+
| Add subscription | `AddSubscription --cli-region=<r> --project_id=<p>` |
|
|
34
|
+
| List subscriptions | `ListSubscriptions --cli-region=<r> --project_id=<p>` |
|
|
35
|
+
| Create message template | `CreateMessageTemplate --cli-region=<r> --project_id=<p>` |
|
|
36
|
+
| Publish message | `PublishMessage --cli-region=<r> --project_id=<p>` |
|
|
37
|
+
| Delete topic | `DeleteTopic --cli-region=<r> --project_id=<p>` |
|
|
38
|
+
|
|
39
|
+
## DMS
|
|
40
|
+
|
|
41
|
+
### Service Types
|
|
42
|
+
|
|
43
|
+
| Type | KooCLI Service |
|
|
44
|
+
|------|---------------|
|
|
45
|
+
| Kafka | `hcloud DMS` |
|
|
46
|
+
| RabbitMQ | `hcloud DMS` |
|
|
47
|
+
| RocketMQ | `hcloud DMS` |
|
|
48
|
+
|
|
49
|
+
### Common Workflows
|
|
50
|
+
|
|
51
|
+
| Task | Operation |
|
|
52
|
+
|------|-----------|
|
|
53
|
+
| List instances | `ListInstances --cli-region=<r> --project_id=<p>` |
|
|
54
|
+
| Create Kafka instance | `CreateInstance --cli-region=<r> --project_id=<p>` |
|
|
55
|
+
| List Kafka topics | `ListTopics --cli-region=<r> --project_id=<p>` |
|
|
56
|
+
|
|
57
|
+
Discover exact parameters with `--help` before executing any command.
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
| Error | Fix |
|
|
62
|
+
|-------|-----|
|
|
63
|
+
| Subscription not confirmed | SMN subscriptions need endpoint/user confirmation |
|
|
64
|
+
| DMS instance creation fails | Check VPC/subnet availability and engine version |
|
|
65
|
+
|
|
66
|
+
## Cross-Skill References
|
|
67
|
+
|
|
68
|
+
- **CES alarms**: See `huawei-cloud-eye` for SMN-based alarm notifications
|
|
69
|
+
- **VPC**: See `huawei-vpc` for DMS instance networking
|
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: huawei-vpc
|
|
3
|
-
description: "Use when creating, configuring, or managing VPC networks, subnets, security groups, EIPs, NAT gateways, VPN connections, or network ACLs on Huawei Cloud. Triggers on: VPC, subnet, security group, EIP, NAT, VPN, network ACL, route table, bandwidth. NOT for: DNS or CDN configuration."
|
|
4
|
-
version: 1
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Huawei Cloud VPC
|
|
8
|
-
|
|
9
|
-
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
-
|
|
11
|
-
Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
12
|
-
|
|
13
|
-
> **Multi-version APIs**: KooCLI may print a warning like "ListVpcs有多个版本,默认使用该API版本v3" before the actual response. The text BEFORE the first `{` is the version selection notice — parse JSON starting from `{` only. This is normal behavior, not an error.
|
|
14
|
-
|
|
15
|
-
## Overview
|
|
16
|
-
|
|
17
|
-
Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet lifecycle, security groups, EIP management, NAT gateways, VPN, and network ACLs.
|
|
18
|
-
|
|
19
|
-
## Critical Warnings
|
|
20
|
-
|
|
21
|
-
| Trap | Why |
|
|
22
|
-
|------|-----|
|
|
23
|
-
| VPC CIDR cannot change | Once set, VPC CIDR block is immutable |
|
|
24
|
-
| Security group stateful | SG rules are stateful. Return traffic auto-allowed |
|
|
25
|
-
| Network ACL stateless | ACL rules must allow both inbound AND outbound |
|
|
26
|
-
| EIP bills when idle | Unbound EIP still charges. Release when unused |
|
|
27
|
-
| Subnet AZ binding | Subnet tied to single AZ. Cross-AZ needs multiple subnets |
|
|
28
|
-
| EIP PER type needs `--bandwidth.name` | PER bandwidth requires explicit name; `--help` marks it optional but it's required |
|
|
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
|
-
| **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. 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
|
-
| 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` |
|
|
34
|
-
|
|
35
|
-
## Common Workflows
|
|
36
|
-
|
|
37
|
-
| Task | Command | Steps |
|
|
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 |
|
|
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 |
|
|
42
|
-
| Security group | hcloud VPC CreateSecurityGroup --security_group.name=<name> | references/security-group.md |
|
|
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 |
|
|
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 |
|
|
45
|
-
| Bind EIP to ECS | hcloud EIP AssociatePublicips --publicip_id=<id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT | Get port ID from `hcloud ECS ListServersDetails --server_id=<id>` → `OS-EXT-IPS:port_id` |
|
|
46
|
-
| Unbind EIP | hcloud EIP DisassociatePublicip --publicip_id=<id> | references/eip.md |
|
|
47
|
-
| Delete EIP | hcloud EIP DeletePublicip --publicip_id=<id> | references/eip.md |
|
|
48
|
-
| List EIPs | hcloud EIP ListPublicips | |
|
|
49
|
-
| NAT gateway | hcloud NAT CreateNatGateway --nat.name=<name> --nat.spec=<spec> --router_id=<vpc-id> --internal_network_id=<subnet-id> | Run `hcloud NAT CreateNatGateway --help` for available spec values |
|
|
50
|
-
|
|
51
|
-
## Troubleshooting
|
|
52
|
-
|
|
53
|
-
| Error | Root Cause -> Fix |
|
|
54
|
-
|-------|------------------|
|
|
55
|
-
| Cannot reach instance | SG missing rule or no EIP -> Add SG rule / Bind EIP |
|
|
56
|
-
| Subnet CIDR conflict | Overlapping with existing subnets -> Choose non-overlapping CIDR |
|
|
57
|
-
| NAT gateway no internet | Route table missing default route -> Add 0.0.0.0/0 via NAT |
|
|
58
|
-
| EIP quota exceeded | Check actual quota: `hcloud EIP ListPublicips --cli-region=<r>` to see current usage. Default varies by account (typically 5-10) |
|
|
59
|
-
| EIP.7905 | Run `hcloud EIP ListPublicips --cli-region=<r>` first to check current usage |
|
|
60
|
-
| VPC.0301: Bandwidth name invalid | PER type requires `--bandwidth.name`, even though `--help` marks it optional |
|
|
61
|
-
| EIP has no public IP after binding | May need AddIngressEipV2 for ELB-type resources (see huawei-apig) |
|
|
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 |
|
|
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 |
|
|
65
|
-
|
|
66
|
-
## Security Considerations
|
|
67
|
-
|
|
68
|
-
- MUST use security groups, NOT iptables
|
|
69
|
-
- MUST scope SG rules to specific CIDRs, NOT 0.0.0.0/0
|
|
70
|
-
- SHOULD use network ACLs as defense-in-depth
|
|
71
|
-
- SHOULD place databases in private subnets (no EIP)
|
|
72
|
-
- MUST enable VPC flow logs for audit
|
|
73
|
-
|
|
74
|
-
## MCP Tools
|
|
75
|
-
|
|
76
|
-
- huaweicloud_list_operations service=VPC
|
|
77
|
-
- huaweicloud_run_readonly_command for VPC/subnet discovery
|
|
78
|
-
- huaweicloud_run_approved_command for writes
|
|
79
|
-
|
|
80
|
-
## References
|
|
81
|
-
|
|
82
|
-
- VPC Docs: https://support.huaweicloud.com/vpc/
|
|
83
|
-
- Subnet guide: references/subnet.md
|
|
84
|
-
- Security group: references/security-group.md
|
|
1
|
+
---
|
|
2
|
+
name: huawei-vpc
|
|
3
|
+
description: "Use when creating, configuring, or managing VPC networks, subnets, security groups, EIPs, NAT gateways, VPN connections, or network ACLs on Huawei Cloud. Triggers on: VPC, subnet, security group, EIP, NAT, VPN, network ACL, route table, bandwidth. NOT for: DNS or CDN configuration."
|
|
4
|
+
version: 1
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Huawei Cloud VPC
|
|
8
|
+
|
|
9
|
+
**STOP - Do not answer from general knowledge.** Follow the procedure below.
|
|
10
|
+
|
|
11
|
+
Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
|
|
12
|
+
|
|
13
|
+
> **Multi-version APIs**: KooCLI may print a warning like "ListVpcs有多个版本,默认使用该API版本v3" before the actual response. The text BEFORE the first `{` is the version selection notice — parse JSON starting from `{` only. This is normal behavior, not an error.
|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet lifecycle, security groups, EIP management, NAT gateways, VPN, and network ACLs.
|
|
18
|
+
|
|
19
|
+
## Critical Warnings
|
|
20
|
+
|
|
21
|
+
| Trap | Why |
|
|
22
|
+
|------|-----|
|
|
23
|
+
| VPC CIDR cannot change | Once set, VPC CIDR block is immutable |
|
|
24
|
+
| Security group stateful | SG rules are stateful. Return traffic auto-allowed |
|
|
25
|
+
| Network ACL stateless | ACL rules must allow both inbound AND outbound |
|
|
26
|
+
| EIP bills when idle | Unbound EIP still charges. Release when unused |
|
|
27
|
+
| Subnet AZ binding | Subnet tied to single AZ. Cross-AZ needs multiple subnets |
|
|
28
|
+
| EIP PER type needs `--bandwidth.name` | PER bandwidth requires explicit name; `--help` marks it optional but it's required |
|
|
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
|
+
| **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. 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
|
+
| 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` |
|
|
34
|
+
|
|
35
|
+
## Common Workflows
|
|
36
|
+
|
|
37
|
+
| Task | Command | Steps |
|
|
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 |
|
|
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 |
|
|
42
|
+
| Security group | hcloud VPC CreateSecurityGroup --security_group.name=<name> | references/security-group.md |
|
|
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 |
|
|
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 |
|
|
45
|
+
| Bind EIP to ECS | hcloud EIP AssociatePublicips --publicip_id=<id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT | Get port ID from `hcloud ECS ListServersDetails --server_id=<id>` → `OS-EXT-IPS:port_id` |
|
|
46
|
+
| Unbind EIP | hcloud EIP DisassociatePublicip --publicip_id=<id> | references/eip.md |
|
|
47
|
+
| Delete EIP | hcloud EIP DeletePublicip --publicip_id=<id> | references/eip.md |
|
|
48
|
+
| List EIPs | hcloud EIP ListPublicips | |
|
|
49
|
+
| NAT gateway | hcloud NAT CreateNatGateway --nat.name=<name> --nat.spec=<spec> --router_id=<vpc-id> --internal_network_id=<subnet-id> | Run `hcloud NAT CreateNatGateway --help` for available spec values |
|
|
50
|
+
|
|
51
|
+
## Troubleshooting
|
|
52
|
+
|
|
53
|
+
| Error | Root Cause -> Fix |
|
|
54
|
+
|-------|------------------|
|
|
55
|
+
| Cannot reach instance | SG missing rule or no EIP -> Add SG rule / Bind EIP |
|
|
56
|
+
| Subnet CIDR conflict | Overlapping with existing subnets -> Choose non-overlapping CIDR |
|
|
57
|
+
| NAT gateway no internet | Route table missing default route -> Add 0.0.0.0/0 via NAT |
|
|
58
|
+
| EIP quota exceeded | Check actual quota: `hcloud EIP ListPublicips --cli-region=<r>` to see current usage. Default varies by account (typically 5-10) |
|
|
59
|
+
| EIP.7905 | Run `hcloud EIP ListPublicips --cli-region=<r>` first to check current usage |
|
|
60
|
+
| VPC.0301: Bandwidth name invalid | PER type requires `--bandwidth.name`, even though `--help` marks it optional |
|
|
61
|
+
| EIP has no public IP after binding | May need AddIngressEipV2 for ELB-type resources (see huawei-apig) |
|
|
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 |
|
|
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 |
|
|
65
|
+
|
|
66
|
+
## Security Considerations
|
|
67
|
+
|
|
68
|
+
- MUST use security groups, NOT iptables
|
|
69
|
+
- MUST scope SG rules to specific CIDRs, NOT 0.0.0.0/0
|
|
70
|
+
- SHOULD use network ACLs as defense-in-depth
|
|
71
|
+
- SHOULD place databases in private subnets (no EIP)
|
|
72
|
+
- MUST enable VPC flow logs for audit
|
|
73
|
+
|
|
74
|
+
## MCP Tools
|
|
75
|
+
|
|
76
|
+
- huaweicloud_list_operations service=VPC
|
|
77
|
+
- huaweicloud_run_readonly_command for VPC/subnet discovery
|
|
78
|
+
- huaweicloud_run_approved_command for writes
|
|
79
|
+
|
|
80
|
+
## References
|
|
81
|
+
|
|
82
|
+
- VPC Docs: https://support.huaweicloud.com/vpc/
|
|
83
|
+
- Subnet guide: references/subnet.md
|
|
84
|
+
- Security group: references/security-group.md
|