Language / 语言: Respond in the same language the user uses. If the user speaks Chinese, use the Chinese (zh-CN) prompts below. If the user speaks English, use the English (en) prompts below.
Guides an agent through interactive network reachability analysis using Alibaba Cloud NIS. Covers forward/reverse path analysis, topology visualization (Mermaid), and monitoring diagnostics for resources along the path.
Architecture: NIS (CreateAndAnalyzeNetworkPath + GetNetworkReachableAnalysis) + CloudMonitor (DescribeMetricData)
⚠️ CRITICAL / 关键: READ-ONLY OPERATIONS ONLY
This skill performs read-only network diagnostics. DO NOT create, modify, or delete any cloud resources.
This skill only performsread-onlynetwork diagnostic operations.Strictly prohibitedto create, modify, or delete any cloud resources.
Allowed:
CreateAndAnalyzeNetworkPath,GetNetworkReachableAnalysis,DescribeMetricData,Describe*APIsAllowed: analysis task creation and query, monitoring data query, Describe* type query APIs
Forbidden:
Create*(exceptCreateAndAnalyzeNetworkPath),Modify*,Delete*,Start*,Stop*,Run*APIsProhibited: creation-type APIs (except
CreateAndAnalyzeNetworkPath), modification, deletion, start/stop, execution-type APIs
Installation
Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun versionto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation.
aliyun version
aliyun configure set --auto-plugin-install true
Authentication
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusaliyun configure list --user-agent AlibabaCloud-Agent-SkillsCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
RAM Permissions
See references/ram-policies.md for the full RAM policy.
Required actions: nis:CreateAndAnalyzeNetworkPath, nis:GetNetworkReachableAnalysis, cms:DescribeMetricData.
Parameter Confirmation
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance IDs, IP addresses, protocol, ports, resource types, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
Collect the following parameters interactively:
| Parameter | Required | Description (EN) | Description (ZH) | Default |
|---|---|---|---|---|
| RegionId | Yes | Region of the analysis task | Region of the analysis task | — |
| SourceType | Yes | ecs, vsw, internetIp, vpn, vbr |
Source type | — |
| SourceId | Yes | Source resource ID (or public IP if internetIp) |
Source resource ID (for public IP type, directly enter the IP) | — |
| SourceIpAddress | Conditional | On-Premise IP, required for vpn/vbr |
On-premise private IP,vpn/vbr whenrequired |
— |
| TargetType | Yes | ecs, vsw, internetIp, vpn, vbr, clb |
Target type | — |
| TargetId | Yes | Target resource ID (or public IP if internetIp) |
Target resource ID (for public IP type, directly enter the IP) | — |
| TargetIpAddress | Conditional | On-Premise IP, required for vpn/vbr |
On-premise private IP,vpn/vbr whenrequired |
— |
| Protocol | Yes | tcp, udp, or icmp |
Protocol type | — |
| TargetPort | Conditional | Required for tcp/udp |
tcp/udp required when |
— |
| SourcePort | Optional | Source port | Source port | — |
Interactive Collection Logic / 交互收集逻辑
Use the prompts matching the user's language:
Step 1 — Ask resource types / 询问资源类型
| EN | ZH |
|---|---|
| "What is the source resource type? (ecs / vsw / internetIp / vpn / vbr)" | "What is thesource resource type? (ecs / vsw / internetIp / vpn / vbr)" |
| "What is the target resource type? (ecs / vsw / internetIp / vpn / vbr / clb)" | "What is thetarget resource type? (ecs / vsw / internetIp / vpn / vbr / clb)" |
Step 2 — Type-specific prompts / 按类型提示
| Condition | EN Prompt | ZH Prompt |
|---|---|---|
internetIp |
"For public IP analysis, please provide the public IP address directly as the ID." | "When analyzing public network paths, please directly provide thepublic IP addressas the ID." |
vpn / vbr |
"For hybrid cloud analysis, besides the resource ID, please also provide the On-Premise IP (private IP on your side)." | "When connecting to an on-premise environment, in addition to the resource ID, please be sure to provide youron-premise private IP (On-Premise IP) to ensure accurate analysis." |
Step 3 — Protocol & ports / 协议和端口
| EN | ZH |
|---|---|
| "What protocol? (tcp / udp / icmp) And what is the target port?" | "What protocol is used? (tcp / udp / icmp) What is the target port?" |
Core Workflow
Step 1: Forward Path Analysis / 正向路径分析
aliyun nis create-and-analyze-network-path \
--source-id <SourceId> \
--source-type <SourceType> \
--target-id <TargetId> \
--target-type <TargetType> \
--protocol <Protocol> \
--target-port <TargetPort> \
--source-ip-address <SourceIpAddress> \
--target-ip-address <TargetIpAddress> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Omit
--source-ip-address/--target-ip-addressif SourceType/TargetType is notvpnorvbr. Omit--target-portif Protocol isicmp.
Record the returned NetworkReachableAnalysisId.
⚠️ MANDATORY / 强制: ALWAYS perform reverse path analysis after forward analysis completes.
MUST execute Step 3 (Reverse Path Analysis) immediately after Step 2 finishes. Do NOT skip or omit reverse path check.
Mustimmediately execute Step 3 (reverse path analysis) after the forward analysis is completed. It is strictly prohibited to skip or omit the reverse path check.
Step 2: Poll for Forward Result / 轮询正向结果
aliyun nis get-network-reachable-analysis \
--network-reachable-analysis-id <ForwardAnalysisId> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Repeat until NetworkReachableAnalysisStatus is finish. Extract Reachable, NetworkReachableAnalysisResult.
Step 3: Reverse Path Analysis / 反向路径分析
Swap source and target / 交换源和目的:
- Forward
SourceId/Type→ ReverseTargetId/Type - Forward
TargetId/Type→ ReverseSourceId/Type - Forward
SourceIpAddress→ ReverseTargetIpAddress - Forward
TargetIpAddress→ ReverseSourceIpAddress
Port handling / 端口处理:
- Reverse
--source-port= ForwardTargetPort(server listening port / 服务端监听端口) - Reverse
--target-port= Random ephemeral port in range 49152 ~ 65535 (client ephemeral port / 客户端随机端口)
Since the client initiates the connection with a dynamically assigned ephemeral port, the reverse path (server → client) should use a random port in the ephemeral range (49152-65535) as the target port to simulate real return traffic.
Since the client uses a dynamically allocated ephemeral port when initiating a connection, the target port of the reverse path (server→client) should use a random value within the ephemeral port range (49152-65535) to simulate real return traffic.
aliyun nis create-and-analyze-network-path \
--source-id <OriginalTargetId> \
--source-type <OriginalTargetType> \
--target-id <OriginalSourceId> \
--target-type <OriginalSourceType> \
--protocol <Protocol> \
--source-port <OriginalTargetPort> \
--target-port <RandomPort_49152_to_65535> \
--source-ip-address <OriginalTargetIpAddress> \
--target-ip-address <OriginalSourceIpAddress> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Omit
--source-ip-address/--target-ip-addressif SourceType/TargetType is notvpnorvbr. If the source/target type is notvpnorvbr, you may omit--source-ip-address/--target-ip-address。
Step 4: Poll for Reverse Result / 轮询反向结果
Same as Step 2, using the reverse NetworkReachableAnalysisId.
Step 5: Result Interpretation / 结果解读
CRITICAL / 关键: Always use
topologyData.positivefrom the actively initiated analysis task. IGNOREtopologyData.reversein any response — it is unreliable.Always useactively initiatedthe
topologyData.positive。 ignoreThetopologyData.reversein any response — it is unreliable.
For each direction (forward/reverse):
- Check
Reachablefield. Iftrue, the path is connected. Check theReachablefield,trueindicates reachability. - If
false, analyze fromNetworkReachableAnalysisResult: If it isfalse, analyze the following fields to locate the blocking point:errorCode— root cause codesecurityGroupData— security group rules blocking trafficrouteData— route table entries causing drops
Step 6: Topology Visualization (Mermaid)
Generate a Mermaid diagram from topologyData.positive:
graph LR
- Nodes: Extract
nodeTypeandbizInsIdfromnodeList - Links: Build directional edges from
linkList
Example:
graph LR
ECS_i-src["ECS: i-bp1xxx"] --> VRouter_vrt-1["VRouter: vrt-xxx"]
VRouter_vrt-1 --> VSW_vsw-1["VSW: vsw-xxx"]
VSW_vsw-1 --> ENI_eni-1["ENI: eni-xxx"]
ENI_eni-1 --> ECS_i-dst["ECS: i-bp2xxx"]
Step 7: Resource Monitoring Diagnostics
For resource IDs found in topologyData, if they match the prefixes below, query monitoring data for the last 1 hour:
For the topologyData resource IDs along the path, if they match the following prefixes, querythe last 1 hourof monitoring data:
| Prefix | Namespace | Metrics |
|---|---|---|
ecs- |
acs_ecs_dashboard |
CPUUtilization, ConnectionUtilization, DiskReadWriteIOPSUtilization, BurstCredit, DiskIOQueueSize |
eip- |
acs_vpc_eip |
out_ratelimit_drop_speed, net_out.rate_percentage, net_rxPkgs.rate |
nat- |
acs_nat_gateway |
ErrorPortAllocationCount, SessionLimitDropConnection, SessionActiveConnectionWaterLever, SessionNewConnectionWaterLever, BWRateOutToOutside, DropTotalPps |
clb- |
acs_slb_dashboard |
UnhealthyServerCount, UpstreamCode5xx, InstanceQpsUtilization, InstanceMaxConnectionUtilization, UpstreamRt, StatusCode4xx |
vbr- |
acs_physical_connection |
VbrHealthyCheckLossPercent, VbrHealthyCheckLatency, PkgsRateLimitDropOutFromVpcToVbr, RateOutFromVpcToIDC |
Query command (CMS uses PascalCase API-style, not plugin mode):
aliyun cms DescribeMetricData \
--Namespace <Namespace> \
--MetricName <MetricName> \
--Dimensions '[{"instanceId":"<ResourceId>"}]' \
--StartTime <1HourAgoTimestamp> \
--EndTime <NowTimestamp> \
--Period 60 \
--user-agent AlibabaCloud-Agent-Skills
Rate limit: 10 calls/second per account. Batch queries across multiple metrics should be paced accordingly.
Cleanup
NIS reachability analysis is read-only — no cloud resources are created or modified. No cleanup is required. NIS reachability analysis is aread-only operation— it does not create or modify any cloud resources, so no cleanup is required.
Constraints
- IPv4 only — Only IPv4 path analysis is supported.
- Unidirectional analysis — Each analysis is one-way; reverse path requires a separate task with swapped source/target.
- CMS quota —
DescribeMetricDatashares 1,000,000 free calls/month with other CMS query APIs. - CMS rate limit — 10 calls/second per account (including RAM users).
Best Practices
- Always perform both forward and reverse analysis to confirm bidirectional connectivity.
- When path is unreachable, check security group rules and route tables first.
- For
vpn/vbrscenarios, always provide On-Premise IP. /vpn/vbrscenario, be sure to provide the private IP address outside the cloud. - Use Mermaid topology diagrams to visualize traffic paths.
- Query monitoring data only for resources on the actual path.
- Present monitoring anomalies alongside reachability results.
References
| Reference | Contents (EN) | Content (ZH) |
|---|---|---|
| references/ram-policies.md | Required RAM permissions | Required RAM permission policy |
| references/verification-method.md | Step-by-step verification commands | Step-by-step verification commands |
| references/acceptance-criteria.md | Correct/incorrect CLI patterns | Correct/incorrect CLI pattern comparison |
| references/cli-installation-guide.md | Aliyun CLI installation guide | Alibaba Cloud CLI installation guide |