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,133 +1,133 @@
|
|
|
1
|
-
# Create ECS Instance SOP
|
|
2
|
-
|
|
3
|
-
**Before executing any command: If MCP tools are not available** (new session after install), restart your session or use hcloud CLI directly with caution. Commands using adminPass/password WILL appear in shell history — prefer key_name.
|
|
4
|
-
|
|
5
|
-
## 1. Discover flavors
|
|
6
|
-
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json
|
|
7
|
-
Filter for `os_extra_specs.cond:operation:status == normal` — most results are abandoned. See references/flavors.md.
|
|
8
|
-
|
|
9
|
-
## 2. Find availability zones
|
|
10
|
-
hcloud ECS NovaListAvailabilityZones --cli-region=<region>
|
|
11
|
-
|
|
12
|
-
## 3. Find image
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
# Broad search — specific names may return empty in some regions
|
|
16
|
-
hcloud IMS ListImages --cli-region=<region> --__imagetype=gold --__isregistered=true --limit=20
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
If searching by name (e.g. --name="Ubuntu") returns empty: use broad search without name filter, pick from results. Some regions only offer Huawei Cloud EulerOS (HCE).
|
|
20
|
-
|
|
21
|
-
Common images (verify live per region):
|
|
22
|
-
| Image | Region | ID |
|
|
23
|
-
|-------|--------|----|
|
|
24
|
-
| HCE 2.0 Standard | cn-north-4 | 7d940784-ac0a-425f-b3fa-8478f1a1df70 |
|
|
25
|
-
| Ubuntu 22.04 | Query live | Query live |
|
|
26
|
-
| CentOS 8.2 | Query live | Query live |
|
|
27
|
-
|
|
28
|
-
## 4. Verify or create VPC/subnet
|
|
29
|
-
hcloud VPC ListVpcs --cli-region=<region>
|
|
30
|
-
hcloud VPC ListSubnets --vpc_id=<vpc-id> --cli-region=<region>
|
|
31
|
-
If no VPC/subnet exists: load `huawei-vpc` skill → create VPC → create subnet (with DNS) → create security group → return here.
|
|
32
|
-
|
|
33
|
-
## 5. Create keypair (recommended over adminPass)
|
|
34
|
-
hcloud ECS NovaCreateKeypair --keypair.name=<name>
|
|
35
|
-
Save the returned private key to a local file. The public key is auto-injected.
|
|
36
|
-
|
|
37
|
-
Password alternative:
|
|
38
|
-
- adminPass: 8-26 chars, must have uppercase + lowercase + digit + special char
|
|
39
|
-
- Passwords appear ONCE in creation output and are not retrievable
|
|
40
|
-
- Passwords are logged in shell history — this is a security risk
|
|
41
|
-
|
|
42
|
-
## 6. Create instance
|
|
43
|
-
hcloud ECS CreateServers --cli-region=<region> --server.name=<name> --server.flavorRef=<flavor-id> --server.imageRef=<image-id> --server.nics.1.subnet_id=<subnet-id> --server.root_volume.volumetype=<type> --server.root_volume.size=<minsize> --server.vpcid=<vpc-id> --server.availability_zone=<az> --server.key_name=<keypair-name> --server.count=1
|
|
44
|
-
|
|
45
|
-
### Bootstrap with user_data (cloud-init)
|
|
46
|
-
|
|
47
|
-
Use `--server.user_data` to run a cloud-init script at first boot. The value must be **base64-encoded**. This is also the recommended bootstrap path when SCP policies block SSH access — user_data serves as the full deployment path, no SSH needed.
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
# Encode the script
|
|
51
|
-
user_data=$(cat << 'SCRIPT' | base64
|
|
52
|
-
#!/bin/bash
|
|
53
|
-
# Your bootstrap commands here.
|
|
54
|
-
# Output logs: /var/log/cloud-init-output.log
|
|
55
|
-
SCRIPT
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
hcloud ECS CreateServers ... --server.user_data=$user_data
|
|
59
|
-
```
|
|
60
|
-
|
|
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
|
-
>
|
|
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)
|
|
69
|
-
|
|
70
|
-
## 7. EIP (two methods)
|
|
71
|
-
|
|
72
|
-
### Method A: Inline with CreateServers (Recommended)
|
|
73
|
-
Add EIP parameters to the `CreateServers` command in step 6:
|
|
74
|
-
|
|
75
|
-
```bash
|
|
76
|
-
hcloud ECS CreateServers \
|
|
77
|
-
--server.publicip.eip.iptype=<type> \
|
|
78
|
-
--server.publicip.eip.bandwidth.sharetype=<share-type> \
|
|
79
|
-
--server.publicip.eip.bandwidth.size=<size> \
|
|
80
|
-
--server.publicip.eip.bandwidth.chargemode=traffic \
|
|
81
|
-
...
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
> **Trap**: Parameter names differ from `EIP CreatePublicip`. Use `iptype` (not `type`), `sharetype` (not `share_type`), and `chargemode` (not `charging_mode`). Always verify with `hcloud ECS CreateServers --help`.
|
|
85
|
-
|
|
86
|
-
### Method B: Create and bind separately
|
|
87
|
-
hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# Get the ECS network port ID
|
|
91
|
-
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
92
|
-
# → addresses.<vpc-id>[].OS-EXT-IPS:port_id
|
|
93
|
-
|
|
94
|
-
# Bind EIP via port
|
|
95
|
-
hcloud EIP AssociatePublicips --publicip_id=<eip-id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## 8. Verify
|
|
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>`
|
|
114
|
-
|
|
115
|
-
### Verify HTTP accessibility (if EIP bound)
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
# Get the EIP address from instance details
|
|
119
|
-
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
120
|
-
# → addresses.<vpc-id>[].OS-EXT-IPS:addr
|
|
121
|
-
|
|
122
|
-
curl http://<eip-address>
|
|
123
|
-
# Expected: HTTP 200 (if port 80 open and web server installed)
|
|
124
|
-
|
|
125
|
-
## 9. Delete instance (with cleanup)
|
|
126
|
-
hcloud ECS DeleteServers --servers.1.id=<instance-id> --delete_publicip=true --delete_volume=true
|
|
127
|
-
Warning: --delete_publicip and --delete_volume default to false. Set to true to avoid orphaned charges.
|
|
128
|
-
|
|
129
|
-
## Constraints
|
|
130
|
-
- Name: 1-64 chars, letters/digits/hyphens
|
|
131
|
-
- Flavor: must be available in target region — always ListFlavors first
|
|
132
|
-
- Root volume: SSD 40GB min
|
|
133
|
-
- Keypair is safer than adminPass (passwords leak into shell history)
|
|
1
|
+
# Create ECS Instance SOP
|
|
2
|
+
|
|
3
|
+
**Before executing any command: If MCP tools are not available** (new session after install), restart your session or use hcloud CLI directly with caution. Commands using adminPass/password WILL appear in shell history — prefer key_name.
|
|
4
|
+
|
|
5
|
+
## 1. Discover flavors
|
|
6
|
+
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json
|
|
7
|
+
Filter for `os_extra_specs.cond:operation:status == normal` — most results are abandoned. See references/flavors.md.
|
|
8
|
+
|
|
9
|
+
## 2. Find availability zones
|
|
10
|
+
hcloud ECS NovaListAvailabilityZones --cli-region=<region>
|
|
11
|
+
|
|
12
|
+
## 3. Find image
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Broad search — specific names may return empty in some regions
|
|
16
|
+
hcloud IMS ListImages --cli-region=<region> --__imagetype=gold --__isregistered=true --limit=20
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If searching by name (e.g. --name="Ubuntu") returns empty: use broad search without name filter, pick from results. Some regions only offer Huawei Cloud EulerOS (HCE).
|
|
20
|
+
|
|
21
|
+
Common images (verify live per region):
|
|
22
|
+
| Image | Region | ID |
|
|
23
|
+
|-------|--------|----|
|
|
24
|
+
| HCE 2.0 Standard | cn-north-4 | 7d940784-ac0a-425f-b3fa-8478f1a1df70 |
|
|
25
|
+
| Ubuntu 22.04 | Query live | Query live |
|
|
26
|
+
| CentOS 8.2 | Query live | Query live |
|
|
27
|
+
|
|
28
|
+
## 4. Verify or create VPC/subnet
|
|
29
|
+
hcloud VPC ListVpcs --cli-region=<region>
|
|
30
|
+
hcloud VPC ListSubnets --vpc_id=<vpc-id> --cli-region=<region>
|
|
31
|
+
If no VPC/subnet exists: load `huawei-vpc` skill → create VPC → create subnet (with DNS) → create security group → return here.
|
|
32
|
+
|
|
33
|
+
## 5. Create keypair (recommended over adminPass)
|
|
34
|
+
hcloud ECS NovaCreateKeypair --keypair.name=<name>
|
|
35
|
+
Save the returned private key to a local file. The public key is auto-injected.
|
|
36
|
+
|
|
37
|
+
Password alternative:
|
|
38
|
+
- adminPass: 8-26 chars, must have uppercase + lowercase + digit + special char
|
|
39
|
+
- Passwords appear ONCE in creation output and are not retrievable
|
|
40
|
+
- Passwords are logged in shell history — this is a security risk
|
|
41
|
+
|
|
42
|
+
## 6. Create instance
|
|
43
|
+
hcloud ECS CreateServers --cli-region=<region> --server.name=<name> --server.flavorRef=<flavor-id> --server.imageRef=<image-id> --server.nics.1.subnet_id=<subnet-id> --server.root_volume.volumetype=<type> --server.root_volume.size=<minsize> --server.vpcid=<vpc-id> --server.availability_zone=<az> --server.key_name=<keypair-name> --server.count=1
|
|
44
|
+
|
|
45
|
+
### Bootstrap with user_data (cloud-init)
|
|
46
|
+
|
|
47
|
+
Use `--server.user_data` to run a cloud-init script at first boot. The value must be **base64-encoded**. This is also the recommended bootstrap path when SCP policies block SSH access — user_data serves as the full deployment path, no SSH needed.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Encode the script
|
|
51
|
+
user_data=$(cat << 'SCRIPT' | base64
|
|
52
|
+
#!/bin/bash
|
|
53
|
+
# Your bootstrap commands here.
|
|
54
|
+
# Output logs: /var/log/cloud-init-output.log
|
|
55
|
+
SCRIPT
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
hcloud ECS CreateServers ... --server.user_data=$user_data
|
|
59
|
+
```
|
|
60
|
+
|
|
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
|
+
>
|
|
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)
|
|
69
|
+
|
|
70
|
+
## 7. EIP (two methods)
|
|
71
|
+
|
|
72
|
+
### Method A: Inline with CreateServers (Recommended)
|
|
73
|
+
Add EIP parameters to the `CreateServers` command in step 6:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
hcloud ECS CreateServers \
|
|
77
|
+
--server.publicip.eip.iptype=<type> \
|
|
78
|
+
--server.publicip.eip.bandwidth.sharetype=<share-type> \
|
|
79
|
+
--server.publicip.eip.bandwidth.size=<size> \
|
|
80
|
+
--server.publicip.eip.bandwidth.chargemode=traffic \
|
|
81
|
+
...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
> **Trap**: Parameter names differ from `EIP CreatePublicip`. Use `iptype` (not `type`), `sharetype` (not `share_type`), and `chargemode` (not `charging_mode`). Always verify with `hcloud ECS CreateServers --help`.
|
|
85
|
+
|
|
86
|
+
### Method B: Create and bind separately
|
|
87
|
+
hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Get the ECS network port ID
|
|
91
|
+
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
92
|
+
# → addresses.<vpc-id>[].OS-EXT-IPS:port_id
|
|
93
|
+
|
|
94
|
+
# Bind EIP via port
|
|
95
|
+
hcloud EIP AssociatePublicips --publicip_id=<eip-id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 8. Verify
|
|
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>`
|
|
114
|
+
|
|
115
|
+
### Verify HTTP accessibility (if EIP bound)
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# Get the EIP address from instance details
|
|
119
|
+
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
120
|
+
# → addresses.<vpc-id>[].OS-EXT-IPS:addr
|
|
121
|
+
|
|
122
|
+
curl http://<eip-address>
|
|
123
|
+
# Expected: HTTP 200 (if port 80 open and web server installed)
|
|
124
|
+
|
|
125
|
+
## 9. Delete instance (with cleanup)
|
|
126
|
+
hcloud ECS DeleteServers --servers.1.id=<instance-id> --delete_publicip=true --delete_volume=true
|
|
127
|
+
Warning: --delete_publicip and --delete_volume default to false. Set to true to avoid orphaned charges.
|
|
128
|
+
|
|
129
|
+
## Constraints
|
|
130
|
+
- Name: 1-64 chars, letters/digits/hyphens
|
|
131
|
+
- Flavor: must be available in target region — always ListFlavors first
|
|
132
|
+
- Root volume: SSD 40GB min
|
|
133
|
+
- Keypair is safer than adminPass (passwords leak into shell history)
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
# EVS Cloud Disk
|
|
2
|
-
|
|
3
|
-
## Create Volume
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
hcloud EVS CreateVolume --help
|
|
7
|
-
# Required: --volume.availability_zone, --volume.size, --volume.volume_type
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
hcloud EVS CreateVolume \
|
|
12
|
-
--volume.availability_zone=<az> \
|
|
13
|
-
--volume.size=<size> \
|
|
14
|
-
--volume.volume_type=<type> \
|
|
15
|
-
--volume.name=<name>
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Attach to ECS
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
hcloud EVS AttachVolume --volume_id=<vol-id> --server_id=<ecs-id>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## List / Delete
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
hcloud EVS ListVolumes
|
|
28
|
-
hcloud EVS DeleteVolume --volume_id=<id>
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
> Deleting an ECS instance does NOT automatically delete attached EVS volumes unless `--delete_volume=true` is set during instance deletion.
|
|
1
|
+
# EVS Cloud Disk
|
|
2
|
+
|
|
3
|
+
## Create Volume
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
hcloud EVS CreateVolume --help
|
|
7
|
+
# Required: --volume.availability_zone, --volume.size, --volume.volume_type
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
hcloud EVS CreateVolume \
|
|
12
|
+
--volume.availability_zone=<az> \
|
|
13
|
+
--volume.size=<size> \
|
|
14
|
+
--volume.volume_type=<type> \
|
|
15
|
+
--volume.name=<name>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Attach to ECS
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
hcloud EVS AttachVolume --volume_id=<vol-id> --server_id=<ecs-id>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## List / Delete
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
hcloud EVS ListVolumes
|
|
28
|
+
hcloud EVS DeleteVolume --volume_id=<id>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
> Deleting an ECS instance does NOT automatically delete attached EVS volumes unless `--delete_volume=true` is set during instance deletion.
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
# ECS Flavor Selection
|
|
2
|
-
|
|
3
|
-
**Always discover flavors dynamically before recommending a specific flavor name.** Flavor availability varies by region and changes over time.
|
|
4
|
-
|
|
5
|
-
## Step 1: List available flavors
|
|
6
|
-
|
|
7
|
-
Use JMESPath to filter in-line — raw output returns hundreds of records and floods context:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Filter by family prefix (e.g. ac7), return name + specs only
|
|
11
|
-
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json \
|
|
12
|
-
--cli-query="flavors[?contains(name, 'ac7')].{name:name, vcpus:vcpus, ram:ram}"
|
|
13
|
-
|
|
14
|
-
# Filter by vCPU range
|
|
15
|
-
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json \
|
|
16
|
-
--cli-query="flavors[?vcpus >= '2' && vcpus <= '4'].{name:name, vcpus:vcpus, ram:ram}"
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
> Always use `--cli-query` with JMESPath to narrow results. Never run bare `ListFlavors` without filtering.
|
|
20
|
-
|
|
21
|
-
## Step 2: Filter by scenario
|
|
22
|
-
|
|
23
|
-
| Scenario | Look for | Preference |
|
|
24
|
-
|----------|----------|------------|
|
|
25
|
-
| Web app / microservices | General-purpose families (ac, s, sn) | 2-4 vCPU, 4-8 GB RAM |
|
|
26
|
-
| Database / big data | Memory-optimized families (m, r) | 4-8 vCPU, 16-64 GB RAM |
|
|
27
|
-
| AI inference / training | GPU families (g, p) | 8+ vCPU, 64+ GB RAM |
|
|
28
|
-
| HPC / high throughput | High-IO families (h, ir, i) | 8+ vCPU, local SSD |
|
|
29
|
-
|
|
30
|
-
## Step 3: Match spec from ListFlavors output
|
|
31
|
-
|
|
32
|
-
Common naming pattern: `<family><gen>.<type>x<ratio>`
|
|
33
|
-
- `ac6.2xlarge.2` = ac6 family, 2xlarge (8 vCPU), ratio 2 (vCPU:RAM = 1:2 → 16 GB)
|
|
34
|
-
|
|
35
|
-
## Do Not Hardcode
|
|
36
|
-
|
|
37
|
-
Flavor family names are region-dependent. Example discrepancies seen in testing:
|
|
38
|
-
- cn-south-1: ac6/ac7/kc/r-c7e (s6/m6/g6 NOT available)
|
|
39
|
-
- Other regions may have s6/m6/g6 families
|
|
40
|
-
|
|
41
|
-
Always run ListFlavors and pick from actual results.
|
|
42
|
-
|
|
43
|
-
## Step 3: Filter out abandoned / sold-out specs
|
|
44
|
-
|
|
45
|
-
`ListFlavors` returns ALL specs including abandoned ones. Before selecting a spec, check the `os_extra_specs` field in the JSON response:
|
|
46
|
-
|
|
47
|
-
| Field | Values | Meaning |
|
|
48
|
-
|-------|--------|---------|
|
|
49
|
-
| `os_extra_specs.cond:operation:status` | `normal`, `abandon`, `sellout` | Only `normal` specs can be created. `abandon` = deprecated, `sellout` = out of stock |
|
|
50
|
-
| `os_extra_specs.cond:operation:az` | e.g. `cn-north-4g(normal)` | Spec is available in this AZ. Multiple entries = multiple AZ support |
|
|
51
|
-
|
|
52
|
-
A flavor can be `normal` globally but `abandon` in specific AZs. Selecting an `abandon` or `sellout` spec will fail with **`Ecs.0019`** at creation time — there is no pre-flight validation in `ListFlavors`. If creation fails:
|
|
53
|
-
|
|
54
|
-
1. Switch to a different AZ: `hcloud ECS NovaListAvailabilityZones --cli-region=<region>`
|
|
55
|
-
2. Or switch to a different flavor family (e.g., `at7` → `ac7`)
|
|
1
|
+
# ECS Flavor Selection
|
|
2
|
+
|
|
3
|
+
**Always discover flavors dynamically before recommending a specific flavor name.** Flavor availability varies by region and changes over time.
|
|
4
|
+
|
|
5
|
+
## Step 1: List available flavors
|
|
6
|
+
|
|
7
|
+
Use JMESPath to filter in-line — raw output returns hundreds of records and floods context:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Filter by family prefix (e.g. ac7), return name + specs only
|
|
11
|
+
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json \
|
|
12
|
+
--cli-query="flavors[?contains(name, 'ac7')].{name:name, vcpus:vcpus, ram:ram}"
|
|
13
|
+
|
|
14
|
+
# Filter by vCPU range
|
|
15
|
+
hcloud ECS ListFlavors --cli-region=<region> --cli-output=json \
|
|
16
|
+
--cli-query="flavors[?vcpus >= '2' && vcpus <= '4'].{name:name, vcpus:vcpus, ram:ram}"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
> Always use `--cli-query` with JMESPath to narrow results. Never run bare `ListFlavors` without filtering.
|
|
20
|
+
|
|
21
|
+
## Step 2: Filter by scenario
|
|
22
|
+
|
|
23
|
+
| Scenario | Look for | Preference |
|
|
24
|
+
|----------|----------|------------|
|
|
25
|
+
| Web app / microservices | General-purpose families (ac, s, sn) | 2-4 vCPU, 4-8 GB RAM |
|
|
26
|
+
| Database / big data | Memory-optimized families (m, r) | 4-8 vCPU, 16-64 GB RAM |
|
|
27
|
+
| AI inference / training | GPU families (g, p) | 8+ vCPU, 64+ GB RAM |
|
|
28
|
+
| HPC / high throughput | High-IO families (h, ir, i) | 8+ vCPU, local SSD |
|
|
29
|
+
|
|
30
|
+
## Step 3: Match spec from ListFlavors output
|
|
31
|
+
|
|
32
|
+
Common naming pattern: `<family><gen>.<type>x<ratio>`
|
|
33
|
+
- `ac6.2xlarge.2` = ac6 family, 2xlarge (8 vCPU), ratio 2 (vCPU:RAM = 1:2 → 16 GB)
|
|
34
|
+
|
|
35
|
+
## Do Not Hardcode
|
|
36
|
+
|
|
37
|
+
Flavor family names are region-dependent. Example discrepancies seen in testing:
|
|
38
|
+
- cn-south-1: ac6/ac7/kc/r-c7e (s6/m6/g6 NOT available)
|
|
39
|
+
- Other regions may have s6/m6/g6 families
|
|
40
|
+
|
|
41
|
+
Always run ListFlavors and pick from actual results.
|
|
42
|
+
|
|
43
|
+
## Step 3: Filter out abandoned / sold-out specs
|
|
44
|
+
|
|
45
|
+
`ListFlavors` returns ALL specs including abandoned ones. Before selecting a spec, check the `os_extra_specs` field in the JSON response:
|
|
46
|
+
|
|
47
|
+
| Field | Values | Meaning |
|
|
48
|
+
|-------|--------|---------|
|
|
49
|
+
| `os_extra_specs.cond:operation:status` | `normal`, `abandon`, `sellout` | Only `normal` specs can be created. `abandon` = deprecated, `sellout` = out of stock |
|
|
50
|
+
| `os_extra_specs.cond:operation:az` | e.g. `cn-north-4g(normal)` | Spec is available in this AZ. Multiple entries = multiple AZ support |
|
|
51
|
+
|
|
52
|
+
A flavor can be `normal` globally but `abandon` in specific AZs. Selecting an `abandon` or `sellout` spec will fail with **`Ecs.0019`** at creation time — there is no pre-flight validation in `ListFlavors`. If creation fails:
|
|
53
|
+
|
|
54
|
+
1. Switch to a different AZ: `hcloud ECS NovaListAvailabilityZones --cli-region=<region>`
|
|
55
|
+
2. Or switch to a different flavor family (e.g., `at7` → `ac7`)
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
# ECS Troubleshooting
|
|
2
|
-
|
|
3
|
-
基于真实测试暴露的常见错误和诊断步骤。
|
|
4
|
-
|
|
5
|
-
## 错误码映射
|
|
6
|
-
|
|
7
|
-
| 错误 | 根因 | 修复 |
|
|
8
|
-
|------|------|------|
|
|
9
|
-
| `Ecs.0005` flavor-image 不匹配 | 镜像虚拟化类型与规格不兼容 | 检查 image `__support_amd`/`__support_xen` 与 flavor `os_extra_specs`。BareMetal 镜像不兼容标准 ECS 规格 |
|
|
10
|
-
| `[USE_ERROR]不正确的参数:imagetype` | 参数名错误 | KooCLI 使用双下划线前缀:`--__imagetype=gold`(不是 `--imagetype`) |
|
|
11
|
-
| `[USE_ERROR]不正确的参数:chargingMode` | 参数路径错误 | 计费模式参数路径:`--server.extendparam.chargingMode=postPaid`。不传默认按需付费 |
|
|
12
|
-
| `[USE_ERROR]不正确的参数:__support_amd` | 参数无效 | `IMS ListImages` 某些版本不支持此过滤。去掉该参数,使用 client-side 过滤 |
|
|
13
|
-
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP BindPublicIp` |
|
|
14
|
-
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名 |
|
|
15
|
-
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放 |
|
|
16
|
-
| AuthFailure | AK/SK 过期或无效 | `
|
|
17
|
-
|
|
18
|
-
## 创建失败诊断流程
|
|
19
|
-
|
|
20
|
-
1. 运行 `hcloud ECS ListFlavors` — 确认规格在目标区域可用
|
|
21
|
-
2. 运行 `hcloud IMS ListImages --__imagetype=gold --limit=20` — 确认可用的公共镜像
|
|
22
|
-
3. 交叉检查:flavor `os_extra_specs` 中的虚拟化类型 vs image 的 `__support_*` 属性
|
|
23
|
-
4. 运行 `hcloud VPC ListVpcs` / `ListSubnets` — 确认 VPC 和子网存在
|
|
24
|
-
5. 运行 `hcloud ECS NovaListAvailabilityZones` — 确认 AZ 可用
|
|
25
|
-
6. 创建后:`hcloud ECS ListServersDetails --server_id=<id>` 检查状态
|
|
26
|
-
7. 状态 `BUILD` → 等待。`ERROR` → 查看 job_id 详情
|
|
27
|
-
|
|
28
|
-
## 镜像查询正确姿势
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
# 正确:双下划线前缀
|
|
32
|
-
hcloud IMS ListImages --cli-region=<r> --__imagetype=gold --__isregistered=true --limit=20
|
|
33
|
-
|
|
34
|
-
# 按需过滤(如果参数支持)
|
|
35
|
-
# --virtual_env_type=FusionCompute 排除 BareMetal
|
|
36
|
-
# 不支持的参数不要传,用 client-side 过滤
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## 密钥对 vs 密码
|
|
40
|
-
|
|
41
|
-
| 方式 | 安全 | 建议 |
|
|
42
|
-
|------|------|------|
|
|
43
|
-
| `--server.key_name=<name>` | ✅ 高 | **推荐**。先 `hcloud DEW CreateKeypair` 创建密钥对 |
|
|
44
|
-
| `--server.adminPass=<pw>` | ❌ 低 | 密码明文进入 shell 历史。仅测试用 |
|
|
45
|
-
|
|
46
|
-
密码要求:8-26 字符,含大写 + 小写 + 数字 + 特殊字符。
|
|
47
|
-
|
|
48
|
-
## 删除注意事项
|
|
49
|
-
|
|
50
|
-
- `--delete_publicip` 默认 false — EIP 不随实例删除,继续计费
|
|
51
|
-
- `--delete_volume` 默认 false — 系统盘不随实例删除
|
|
52
|
-
- 数据盘默认随实例删除(与系统盘行为相反)
|
|
1
|
+
# ECS Troubleshooting
|
|
2
|
+
|
|
3
|
+
基于真实测试暴露的常见错误和诊断步骤。
|
|
4
|
+
|
|
5
|
+
## 错误码映射
|
|
6
|
+
|
|
7
|
+
| 错误 | 根因 | 修复 |
|
|
8
|
+
|------|------|------|
|
|
9
|
+
| `Ecs.0005` flavor-image 不匹配 | 镜像虚拟化类型与规格不兼容 | 检查 image `__support_amd`/`__support_xen` 与 flavor `os_extra_specs`。BareMetal 镜像不兼容标准 ECS 规格 |
|
|
10
|
+
| `[USE_ERROR]不正确的参数:imagetype` | 参数名错误 | KooCLI 使用双下划线前缀:`--__imagetype=gold`(不是 `--imagetype`) |
|
|
11
|
+
| `[USE_ERROR]不正确的参数:chargingMode` | 参数路径错误 | 计费模式参数路径:`--server.extendparam.chargingMode=postPaid`。不传默认按需付费 |
|
|
12
|
+
| `[USE_ERROR]不正确的参数:__support_amd` | 参数无效 | `IMS ListImages` 某些版本不支持此过滤。去掉该参数,使用 client-side 过滤 |
|
|
13
|
+
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP BindPublicIp` |
|
|
14
|
+
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名 |
|
|
15
|
+
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放 |
|
|
16
|
+
| AuthFailure | AK/SK 过期或无效 | `npx huaweicloud-devkit auth init` 重新配置统一凭据 |
|
|
17
|
+
|
|
18
|
+
## 创建失败诊断流程
|
|
19
|
+
|
|
20
|
+
1. 运行 `hcloud ECS ListFlavors` — 确认规格在目标区域可用
|
|
21
|
+
2. 运行 `hcloud IMS ListImages --__imagetype=gold --limit=20` — 确认可用的公共镜像
|
|
22
|
+
3. 交叉检查:flavor `os_extra_specs` 中的虚拟化类型 vs image 的 `__support_*` 属性
|
|
23
|
+
4. 运行 `hcloud VPC ListVpcs` / `ListSubnets` — 确认 VPC 和子网存在
|
|
24
|
+
5. 运行 `hcloud ECS NovaListAvailabilityZones` — 确认 AZ 可用
|
|
25
|
+
6. 创建后:`hcloud ECS ListServersDetails --server_id=<id>` 检查状态
|
|
26
|
+
7. 状态 `BUILD` → 等待。`ERROR` → 查看 job_id 详情
|
|
27
|
+
|
|
28
|
+
## 镜像查询正确姿势
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 正确:双下划线前缀
|
|
32
|
+
hcloud IMS ListImages --cli-region=<r> --__imagetype=gold --__isregistered=true --limit=20
|
|
33
|
+
|
|
34
|
+
# 按需过滤(如果参数支持)
|
|
35
|
+
# --virtual_env_type=FusionCompute 排除 BareMetal
|
|
36
|
+
# 不支持的参数不要传,用 client-side 过滤
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## 密钥对 vs 密码
|
|
40
|
+
|
|
41
|
+
| 方式 | 安全 | 建议 |
|
|
42
|
+
|------|------|------|
|
|
43
|
+
| `--server.key_name=<name>` | ✅ 高 | **推荐**。先 `hcloud DEW CreateKeypair` 创建密钥对 |
|
|
44
|
+
| `--server.adminPass=<pw>` | ❌ 低 | 密码明文进入 shell 历史。仅测试用 |
|
|
45
|
+
|
|
46
|
+
密码要求:8-26 字符,含大写 + 小写 + 数字 + 特殊字符。
|
|
47
|
+
|
|
48
|
+
## 删除注意事项
|
|
49
|
+
|
|
50
|
+
- `--delete_publicip` 默认 false — EIP 不随实例删除,继续计费
|
|
51
|
+
- `--delete_volume` 默认 false — 系统盘不随实例删除
|
|
52
|
+
- 数据盘默认随实例删除(与系统盘行为相反)
|