huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.10

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.
Files changed (99) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +178 -138
  4. package/README.zh-CN.md +176 -138
  5. package/bin/setup.cjs +10 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +11 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +60 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
  13. package/plugins/huaweicloud-core/.mcp.json +13 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +76 -100
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +103 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +191 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +57 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +57 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +69 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +148 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +134 -127
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +31 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +229 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -134
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +77 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +56 -47
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +138 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +111 -96
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -20
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +54 -1
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
  80. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
  81. package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
  82. package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
  83. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
  84. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
  85. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
  86. package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
  87. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
  88. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
  89. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
  90. package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
  91. package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
  92. package/plugins/huaweicloud-core/src/tools.mjs +463 -111
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
  96. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
  97. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -158
  98. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  99. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -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
@@ -1,76 +1,77 @@
1
- # VPC Network Management Reference
2
-
3
- ## DNS Addresses by Region
4
-
5
- Subnets without DNS configuration will fail cloud-init. Use these DNS addresses:
6
-
7
- | Region | Primary DNS | Secondary DNS |
8
- |--------|------------|---------------|
9
- | cn-north-1 | 100.125.1.250 | 100.125.129.250 |
10
- | cn-north-4 | 100.125.1.250 | 100.125.129.250 |
11
- | cn-east-3 | 100.125.1.250 | 100.125.129.250 |
12
- | cn-south-1 | 100.125.1.250 | 100.125.129.250 |
13
- | ap-southeast-3 | 100.125.1.250 | 100.125.129.250 |
14
-
15
- **Subnet create with DNS**:
16
- ```bash
17
- hcloud VPC CreateSubnet \
18
- --subnet.name=<name> \
19
- --subnet.vpc_id=<id> \
20
- --subnet.cidr=10.50.1.0/24 \
21
- --subnet.gateway_ip=10.50.1.1 \
22
- --subnet.availability_zone=<az> \
23
- --subnet.dnsList.1=100.125.1.250 \
24
- --subnet.dnsList.2=100.125.129.250
25
- ```
26
-
27
- ## Nested Prefix Summary
28
-
29
- KooCLI 7.x VPC API requires nested prefixes:
30
-
31
- | Resource | Create Param Prefix | Example |
32
- |----------|---------------------|---------|
33
- | VPC | `--vpc.` | `--vpc.name=my-vpc --vpc.cidr=192.168.0.0/16` |
34
- | Subnet | `--subnet.` | `--subnet.name=web --subnet.vpc_id=<id> --subnet.cidr=192.168.1.0/24` |
35
- | Security Group | `--security_group.` | `--security_group.name=sg-web` |
36
- | SG Rule | `--security_group_rule.` | `--security_group_rule.direction=ingress` |
37
-
38
- ## EIP Management
39
-
40
- ```bash
41
- # Create EIP (pay-per-use)
42
- hcloud EIP CreatePublicip --publicip.type=<type> \
43
- --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
44
-
45
- # Bind to ECS (PORT type, not ECS)
46
- hcloud EIP AssociatePublicips --publicip_id=<id> \
47
- --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
48
-
49
- # Unbind
50
- hcloud EIP DisassociatePublicip --publicip_id=<id>
51
-
52
- # List
53
- hcloud EIP ListPublicips
54
-
55
- # Delete (unbind first)
56
- hcloud EIP DeletePublicip --publicip_id=<id>
57
- ```
58
-
59
- > EIP bills even when not bound. Release unused EIPs.
60
-
61
- ## Security Group Quick Reference
62
-
63
- ```bash
64
- # Create SG (no vpc_id needed)
65
- hcloud VPC CreateSecurityGroup --security_group.name=<name>
66
-
67
- # Add SSH rule
68
- hcloud VPC CreateSecurityGroupRule \
69
- --security_group_rule.security_group_id=<sg-id> \
70
- --security_group_rule.direction=<direction> \
71
- --security_group_rule.protocol=<protocol> \
72
- --security_group_rule.multiport=<port> \
73
- --security_group_rule.remote_ip_prefix=<cidr>
74
- ```
75
-
76
- > SG is stateful — return traffic auto-allowed. Network ACL is stateless — need both directions.
1
+ # VPC Network Management Reference
2
+
3
+ ## DNS Addresses by Region
4
+
5
+ Subnets without DNS configuration will fail cloud-init. Use these DNS addresses:
6
+
7
+ | Region | Primary DNS | Secondary DNS |
8
+ | -------------- | ------------- | --------------- |
9
+ | cn-north-1 | 100.125.1.250 | 100.125.129.250 |
10
+ | cn-north-4 | 100.125.1.250 | 100.125.129.250 |
11
+ | cn-east-3 | 100.125.1.250 | 100.125.129.250 |
12
+ | cn-south-1 | 100.125.1.250 | 100.125.129.250 |
13
+ | ap-southeast-3 | 100.125.1.250 | 100.125.129.250 |
14
+
15
+ **Subnet create with DNS**:
16
+
17
+ ```bash
18
+ hcloud VPC CreateSubnet \
19
+ --subnet.name=<name> \
20
+ --subnet.vpc_id=<id> \
21
+ --subnet.cidr=10.50.1.0/24 \
22
+ --subnet.gateway_ip=10.50.1.1 \
23
+ --subnet.availability_zone=<az> \
24
+ --subnet.dnsList.1=100.125.1.250 \
25
+ --subnet.dnsList.2=100.125.129.250
26
+ ```
27
+
28
+ ## Nested Prefix Summary
29
+
30
+ KooCLI 7.x VPC API requires nested prefixes:
31
+
32
+ | Resource | Create Param Prefix | Example |
33
+ | -------------- | ------------------------ | --------------------------------------------------------------------- |
34
+ | VPC | `--vpc.` | `--vpc.name=my-vpc --vpc.cidr=192.168.0.0/16` |
35
+ | Subnet | `--subnet.` | `--subnet.name=web --subnet.vpc_id=<id> --subnet.cidr=192.168.1.0/24` |
36
+ | Security Group | `--security_group.` | `--security_group.name=sg-web` |
37
+ | SG Rule | `--security_group_rule.` | `--security_group_rule.direction=ingress` |
38
+
39
+ ## EIP Management
40
+
41
+ ```bash
42
+ # Create EIP (pay-per-use)
43
+ hcloud EIP CreatePublicip --publicip.type=<type> \
44
+ --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
45
+
46
+ # Bind to ECS (PORT type, not ECS)
47
+ hcloud EIP AssociatePublicips --publicip_id=<id> \
48
+ --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
49
+
50
+ # Unbind
51
+ hcloud EIP DisassociatePublicip --publicip_id=<id>
52
+
53
+ # List
54
+ hcloud EIP ListPublicips
55
+
56
+ # Delete (unbind first)
57
+ hcloud EIP DeletePublicip --publicip_id=<id>
58
+ ```
59
+
60
+ > EIP bills even when not bound. Release unused EIPs.
61
+
62
+ ## Security Group Quick Reference
63
+
64
+ ```bash
65
+ # Create SG (no vpc_id needed)
66
+ hcloud VPC CreateSecurityGroup --security_group.name=<name>
67
+
68
+ # Add SSH rule
69
+ hcloud VPC CreateSecurityGroupRule \
70
+ --security_group_rule.security_group_id=<sg-id> \
71
+ --security_group_rule.direction=<direction> \
72
+ --security_group_rule.protocol=<protocol> \
73
+ --security_group_rule.multiport=<port> \
74
+ --security_group_rule.remote_ip_prefix=<cidr>
75
+ ```
76
+
77
+ > SG is stateful — return traffic auto-allowed. Network ACL is stateless — need both directions.
@@ -1,59 +1,60 @@
1
- # Security Group Rules
2
-
3
- ## Security Group is NOT bound to VPC
4
-
5
- VPC v3 API `CreateSecurityGroup` does NOT accept a `vpc_id` parameter. Security groups are region-level resources, not VPC-bound. They work across any VPC in the same region.
6
-
7
- ```bash
8
- # CORRECT — no vpc_id needed
9
- hcloud VPC CreateSecurityGroup --security_group.name=<name>
10
-
11
- # WRONG
12
- hcloud VPC CreateSecurityGroup --security_group.vpc_id=<vpc-id>
13
- ```
14
-
15
- ## KooCLI 7.x Nested Parameter Format
16
-
17
- Security group params use `--security_group.` prefix. Rules use `--security_group_rule.` prefix.
18
-
19
- ## Create Security Group Rule
20
-
21
- Complete example with nested prefix:
22
- ```bash
23
- hcloud VPC CreateSecurityGroupRule \
24
- --security_group_rule.security_group_id=<sg-id> \
25
- --security_group_rule.direction=<direction> \
26
- --security_group_rule.protocol=<protocol> \
27
- --security_group_rule.multiport=<port> \
28
- --security_group_rule.remote_ip_prefix=<cidr>
29
- ```
30
-
31
- > Always run `hcloud VPC CreateSecurityGroupRule --help` to verify param names.
32
-
33
- ## Stateful vs Stateless
34
-
35
- | Feature | Security Group | Network ACL |
36
- |---------|---------------|-------------|
37
- | Stateful? | Yes — return traffic auto-allowed | No — must allow both directions |
38
- | Applied to | ECS instance NIC | Subnet |
39
- | Rules | Allow only | Allow and Deny |
40
- | Default | Deny all inbound, allow all outbound | Allow all |
41
-
42
- ## Common Rules Reference
43
-
44
- | Direction | Protocol | Port | Source | Purpose |
45
- |-----------|----------|------|--------|---------|
46
- | Ingress | TCP | 22 | <office-ip>/32 | SSH |
47
- | Ingress | TCP | 80 | 0.0.0.0/0 | HTTP |
48
- | Ingress | TCP | 443 | 0.0.0.0/0 | HTTPS |
49
- | Ingress | TCP | 3306 | <sg-app-id> | MySQL from app |
50
- | Ingress | TCP | 6379 | <sg-app-id> | Redis from app |
51
- | Egress | ALL | ALL | 0.0.0.0/0 | Outbound default |
52
-
53
- ## Common Errors
54
-
55
- | Error | Root Cause -> Fix |
56
- |-------|-------------------|
57
- | Cannot SSH | Default SG denies all inbound. Add port 22 rule |
58
- | Rule not effective | SG assigned to wrong instance. Verify NIC attachment |
59
- | `[USE_ERROR]不正确的参数:vpc_id` | Security groups don't need vpc_id. Remove it |
1
+ # Security Group Rules
2
+
3
+ ## Security Group is NOT bound to VPC
4
+
5
+ VPC v3 API `CreateSecurityGroup` does NOT accept a `vpc_id` parameter. Security groups are region-level resources, not VPC-bound. They work across any VPC in the same region.
6
+
7
+ ```bash
8
+ # CORRECT — no vpc_id needed
9
+ hcloud VPC CreateSecurityGroup --security_group.name=<name>
10
+
11
+ # WRONG
12
+ hcloud VPC CreateSecurityGroup --security_group.vpc_id=<vpc-id>
13
+ ```
14
+
15
+ ## KooCLI 7.x Nested Parameter Format
16
+
17
+ Security group params use `--security_group.` prefix. Rules use `--security_group_rule.` prefix.
18
+
19
+ ## Create Security Group Rule
20
+
21
+ Complete example with nested prefix:
22
+
23
+ ```bash
24
+ hcloud VPC CreateSecurityGroupRule \
25
+ --security_group_rule.security_group_id=<sg-id> \
26
+ --security_group_rule.direction=<direction> \
27
+ --security_group_rule.protocol=<protocol> \
28
+ --security_group_rule.multiport=<port> \
29
+ --security_group_rule.remote_ip_prefix=<cidr>
30
+ ```
31
+
32
+ > Always run `hcloud VPC CreateSecurityGroupRule --help` to verify param names.
33
+
34
+ ## Stateful vs Stateless
35
+
36
+ | Feature | Security Group | Network ACL |
37
+ | ---------- | ------------------------------------ | ------------------------------- |
38
+ | Stateful? | Yes — return traffic auto-allowed | No must allow both directions |
39
+ | Applied to | ECS instance NIC | Subnet |
40
+ | Rules | Allow only | Allow and Deny |
41
+ | Default | Deny all inbound, allow all outbound | Allow all |
42
+
43
+ ## Common Rules Reference
44
+
45
+ | Direction | Protocol | Port | Source | Purpose |
46
+ | --------- | -------- | ---- | -------------- | ---------------- |
47
+ | Ingress | TCP | 22 | <office-ip>/32 | SSH |
48
+ | Ingress | TCP | 80 | 0.0.0.0/0 | HTTP |
49
+ | Ingress | TCP | 443 | 0.0.0.0/0 | HTTPS |
50
+ | Ingress | TCP | 3306 | <sg-app-id> | MySQL from app |
51
+ | Ingress | TCP | 6379 | <sg-app-id> | Redis from app |
52
+ | Egress | ALL | ALL | 0.0.0.0/0 | Outbound default |
53
+
54
+ ## Common Errors
55
+
56
+ | Error | Root Cause -> Fix |
57
+ | -------------------------------- | ---------------------------------------------------- |
58
+ | Cannot SSH | Default SG denies all inbound. Add port 22 rule |
59
+ | Rule not effective | SG assigned to wrong instance. Verify NIC attachment |
60
+ | `[USE_ERROR]不正确的参数:vpc_id` | Security groups don't need vpc_id. Remove it |
@@ -1,50 +1,50 @@
1
- # VPC Subnet Guide
2
-
3
- ## Prerequisite: VPC CIDR is Immutable
4
-
5
- VPC CIDR block cannot be changed after creation. Plan carefully.
6
-
7
- ## KooCLI 7.x Nested Parameter Format
8
-
9
- VPC API uses nested prefix: `--vpc.name`, `--subnet.vpc_id`, `--subnet.name`. NOT `--name` or `--vpc_id`.
10
-
11
- ```bash
12
- # CORRECT
13
- hcloud VPC CreateVpc --vpc.name=<name> --vpc.cidr=192.168.0.0/16
14
-
15
- hcloud VPC CreateSubnet \
16
- --subnet.name=<name> \
17
- --subnet.vpc_id=<vpc-id> \
18
- --subnet.cidr=192.168.1.0/24 \
19
- --subnet.gateway_ip=192.168.1.1 \
20
- --subnet.availability_zone=<az>
21
-
22
- # WRONG — will fail with [USE_ERROR]
23
- hcloud VPC CreateVpc --name=xxx
24
- hcloud VPC CreateSubnet --vpc_id=xxx
25
- ```
26
-
27
- ## Key Constraints
28
-
29
- | Constraint | Detail |
30
- |-----------|--------|
31
- | Subnet bound to single AZ | Cross-AZ needs multiple subnets. AZ code format: `cn-south-1a` |
32
- | CIDR must not overlap | Cannot overlap with other subnets in same VPC |
33
- | Gateway IP auto-assigned | Default is first IP in CIDR range (e.g., 192.168.1.1 for /24) |
34
- | 5 IPs reserved per subnet | First 4 + broadcast reserved by platform |
35
-
36
- ## Common Errors
37
-
38
- | Error | Root Cause -> Fix |
39
- |-------|-------------------|
40
- | `[USE_ERROR]不正确的参数:name` | Missing nested prefix. Use `--vpc.name=` or `--subnet.name=` |
41
- | CIDR overlap | Subnet CIDR must be within VPC CIDR and not overlap others |
42
- | AZ not found | Use `hcloud ECS NovaListAvailabilityZones --cli-region=<r>` to list valid AZ codes |
43
-
44
- ## CIDR Planning Reference
45
-
46
- | Environment | VPC CIDR | Subnet CIDR |
47
- |------------|----------|-------------|
48
- | Dev | 192.168.0.0/16 | 192.168.1.0/24 |
49
- | Staging | 10.0.0.0/16 | 10.0.1.0/24 |
50
- | Production | 172.16.0.0/16 | 172.16.1.0/24 (public) + 172.16.2.0/24 (private) |
1
+ # VPC Subnet Guide
2
+
3
+ ## Prerequisite: VPC CIDR is Immutable
4
+
5
+ VPC CIDR block cannot be changed after creation. Plan carefully.
6
+
7
+ ## KooCLI 7.x Nested Parameter Format
8
+
9
+ VPC API uses nested prefix: `--vpc.name`, `--subnet.vpc_id`, `--subnet.name`. NOT `--name` or `--vpc_id`.
10
+
11
+ ```bash
12
+ # CORRECT
13
+ hcloud VPC CreateVpc --vpc.name=<name> --vpc.cidr=192.168.0.0/16
14
+
15
+ hcloud VPC CreateSubnet \
16
+ --subnet.name=<name> \
17
+ --subnet.vpc_id=<vpc-id> \
18
+ --subnet.cidr=192.168.1.0/24 \
19
+ --subnet.gateway_ip=192.168.1.1 \
20
+ --subnet.availability_zone=<az>
21
+
22
+ # WRONG — will fail with [USE_ERROR]
23
+ hcloud VPC CreateVpc --name=xxx
24
+ hcloud VPC CreateSubnet --vpc_id=xxx
25
+ ```
26
+
27
+ ## Key Constraints
28
+
29
+ | Constraint | Detail |
30
+ | ------------------------- | -------------------------------------------------------------- |
31
+ | Subnet bound to single AZ | Cross-AZ needs multiple subnets. AZ code format: `cn-south-1a` |
32
+ | CIDR must not overlap | Cannot overlap with other subnets in same VPC |
33
+ | Gateway IP auto-assigned | Default is first IP in CIDR range (e.g., 192.168.1.1 for /24) |
34
+ | 5 IPs reserved per subnet | First 4 + broadcast reserved by platform |
35
+
36
+ ## Common Errors
37
+
38
+ | Error | Root Cause -> Fix |
39
+ | ------------------------------ | ---------------------------------------------------------------------------------- |
40
+ | `[USE_ERROR]不正确的参数:name` | Missing nested prefix. Use `--vpc.name=` or `--subnet.name=` |
41
+ | CIDR overlap | Subnet CIDR must be within VPC CIDR and not overlap others |
42
+ | AZ not found | Use `hcloud ECS NovaListAvailabilityZones --cli-region=<r>` to list valid AZ codes |
43
+
44
+ ## CIDR Planning Reference
45
+
46
+ | Environment | VPC CIDR | Subnet CIDR |
47
+ | ----------- | -------------- | ------------------------------------------------ |
48
+ | Dev | 192.168.0.0/16 | 192.168.1.0/24 |
49
+ | Staging | 10.0.0.0/16 | 10.0.1.0/24 |
50
+ | Production | 172.16.0.0/16 | 172.16.1.0/24 (public) + 172.16.2.0/24 (private) |