当前位置: 首页 > Skill >

Alibabacloud Ecs Vpc Publicnetwork Troubleshoot

Alibabacloud Ecs Vpc Publicnetwork Troubleshoot

Alibabacloud Ecs Vpc Publicnetwork Troubleshoot

诊断阿里云 ECS 公网访问问题及 VPC 云服务公网访问问题,涵盖 ECS 公网访问等功能。

0.0.1 2026.11.16 142
获取Skill文件查看使用说明
作 者:沈禾 许可证: 更新时间:2026.11.16
本文目录展开

ECS/VPC Public Network Connectivity Troubleshooting

Automated diagnosis of public network connectivity for Alibaba Cloud ECS instances and VPC cloud services. Two core capabilities only:

  1. ECS public network diagnosis — full-chain check for an ECS instance covering public IP reachability and security-group blocking; the NAT-gateway egress path for instances without a public IP is handled automatically as a sub-path (the script picks Branch A / Branch B by itself).
  2. VPC cloud service public network diagnosis — public egress check for a cloud service (DataWorks / SAE / ACK, etc.) behind a VSwitch (NAT gateway / SNAT / route / EIP).

Execution Principle (script-only, no fallback)

All diagnostic operations MUST be performed by invoking the bundled Python scripts under scripts/. There are exactly three:

Allowed invocation Purpose
python3 scripts/sts_create.py Obtain/validate credentials (runs first)
python3 scripts/ecs_public_troubleshoot.py ECS public network diagnosis
python3 scripts/vpc_service_public_troubleshoot.py VPC cloud service diagnosis

Forbidden — do NOT reproduce the diagnostic logic by any other means (each is a structural violation, even if the output looks correct):

  • running aliyun ecs ... / aliyun vpc ... / aliyun natgateway ... / aliyun antiddos-public ... / aliyun cloudfw ... / aliyun bssopenapi ... or any other aliyun CLI command for diagnosis;
  • running aliyun configure get or any command to fetch credentials manually;
  • writing numbered/ad-hoc helper scripts (01_describe_ecs.sh, ...) or inline SDK/curl/HTTP code.

If a script fails (non-zero exit, no JSON, credential/authorization error), stop and report the error — never fall back to any of the above.

Credentials (do not handle manually)

sts_create.py runs first and writes credentials to the local cache scripts/.sts_cache.json. The two main scripts (ecs_public_troubleshoot.py, vpc_service_public_troubleshoot.py) read that cache automatically. The agent MUST NOT:

  • export ALIBABA_CLOUD_* variables manually, pass --access-key-id / --access-key-secret / --sts-token (the scripts do not accept them), or run aliyun configure get;
  • echo plaintext AK/SK/token on the command line.

If sts_create.py fails, abort immediately and report the credential/authorization error.

User Confirmation (required before any API call)

This skill makes read-only Alibaba Cloud API calls only (Describe* / GetCallerIdentity queries); it never creates, modifies, deletes, restarts, or otherwise changes any resource. Before invoking any script:

  1. Restate the diagnostic scope to the user — the target resource (instance_id / vswitch_id), the region_id, and that only read-only diagnostic APIs will be called against that single resource.
  2. Obtain confirmation to proceed. An explicit diagnostic request that already names the target resource is sufficient authorization: restate the scope and proceed. If the target or scope is ambiguous, or the user has not clearly authorized the check, ask the user and wait for confirmation before making any API call.
  3. Never call any API before this confirmation, and never expand scope beyond the confirmed resource.

Trigger Conditions

  • ECS cannot access / be accessed from the public network; public IP reachability issues
  • ECS ping / connectivity timeout to the public network; NAT gateway / SNAT outbound issues
  • Security group blocking public access to an ECS instance
  • VPC cloud service (DataWorks / SAE / ACK) cannot access the public network

Input Parameters

Parameter Type Required Description Example
region_id string Yes Alibaba Cloud region ID cn-hangzhou
test_scenario string Yes ecs_public / vpc_service_public (inferred from identifiers) ecs_public
instance_id string ECS scenario ECS instance ID i-bp116m5pkhsle6xm5pl8
vswitch_id string VPC scenario VSwitch ID vsw-bp1xat3xsvck79y8zo8yo
uid string No Account UID (auto-obtained from credentials if omitted) 1552974654746705
service_type string No Cloud service type (VPC scenario): dataworks / sae / ack / others dataworks
output_format string No table / json / markdown table

Mandatory-parameter gate: region_id plus the scenario identifier (instance_id for ECS, vswitch_id for VPC) are required. Extract everything already present in the user's prompt first. If a mandatory field is still missing, ask the user once; if it is still not provided, abort with:

Missing required parameters: [<comma-separated list>]. Aborting diagnostic workflow.

Do NOT fabricate/guess mandatory values or read external metadata to infer them.

Module Index

Module Purpose File
Preparation Credential acquisition and CLI call templates references/module1_preparation.md
RAM Policies Minimum read-only privilege list references/ram-policies.md
Scenario 1: ECS Public Network ECS script invocation, JSON output, status logic references/module2_ecs_public.md
Scenario 2: VPC Service Public VPC script invocation, JSON output, status logic references/module3_vpc_service.md
Output & Judgment Info-table format and status column logic references/module4_output.md
Solutions Remediation advice for abnormal items references/module5_solution.md

Load on demand: read only the reference relevant to the current task.

Orchestration

Input Parsing (extract region_id + identifiers)
  └─▶ Credentials: python3 scripts/sts_create.py  (abort on credential/authorization error)
        └─▶ Scenario Detection: instance_id → ECS scenario; vswitch_id → VPC scenario
              └─▶ Main Script: ecs_public_troubleshoot.py / vpc_service_public_troubleshoot.py
                    │      (parallel sub-checks: ECS/SG, VPC/Route/NAT/SNAT/EIP, DDoS, CFW, account status)
                    └─▶ Result Rendering (module4_output.md): Branch A (direct public) or Branch B (NAT)
                          └─▶ Solution Output for abnormal items (module5_solution.md)

Principles: strict order (abort on any step failure, never skip or fall back); the main script decides Branch A vs Branch B by whether the ECS has a public IP/EIP.

Execution Flow

  1. Scope confirmation (before any API call): restate the target resource, region_id, and read-only scope to the user and confirm to proceed, per "User Confirmation" above. Do NOT invoke any script or API before this step.
  2. Credential pre-check: run python3 scripts/sts_create.py; on SDK.InvalidCredential / InvalidAccessKeyId / SignatureDoesNotMatch / Forbidden / any auth error / non-zero exit, abort and report.
  3. Scenario detection: instance_id → ECS scenario; vswitch_id → VPC scenario.
  4. Main script invocation (queries all sub-items in parallel).
  5. Script failure circuit breaker: on non-zero exit / no JSON / unhandled exception, print stderr and abort — do NOT retry with ad-hoc CLI or inline code.
  6. Result rendering: parse JSON, render info table per module4_output.md (Branch A or Branch B). For ECS, the security-group check is part of the full chain; when the security group is abnormal, state which direction/port is blocked in the report.
  7. Solution output: for any abnormal item, output remediation per module5_solution.md; skip if all normal.

Scenario 1 (ECS) Invocation

python3 scripts/ecs_public_troubleshoot.py 
  --region-id <region_id> 
  --instance-id <instance_id> 
  [--uid <UID>]

Scenario 2 (VPC cloud service) Invocation

python3 scripts/vpc_service_public_troubleshoot.py 
  --region-id <region_id> 
  --vswitch-id <vswitch_id> 
  [--uid <UID>]

Credentials are read from sts_create.py's local cache (scripts/.sts_cache.json); scripts do not accept credential parameters. Never export plaintext credentials on the command line.

Observability

All OpenAPI calls carry a unified User-Agent AlibabaCloud-Agent-Skills/alibabacloud-ecs-vpc-publicnetwork-troubleshoot/{session-id} for call-chain traceability; the session ID is generated once at skill start and shared across scripts via the SKILL_SESSION_ID environment variable.

Important Notes

  1. Credential security: never hardcode AK/SK; rely on the cache written by sts_create.py / SDK default chain.
  2. No fallback: if any scripted step fails, abort and report; do NOT fall back to raw aliyun CLI, ad-hoc/numbered shell scripts, inline SDK code, or evaluation-metadata guessing.
  3. Permissions: requires read-only access for ECS, VPC, Cloud Firewall, DDoS, BSS. See references/ram-policies.md.
  4. Network constraints: VPC has no public egress by default (needs NAT Gateway / IPv4 Gateway / EIP); inbound public access to ECS needs security-group ingress rules.
  5. ICMP default: if the security group does not explicitly allow ICMP, it is judged "ICMP blocked"; state this in the report.
  6. Branch decision: accurately determine whether the ECS has a public IP/EIP to select the correct info table.
  7. No scope creep: diagnose only the requested instance/vswitch; do not proactively probe other resources.
  8. Dependencies: aliyun-cli (DDoS/CFW/EIP supplementary queries invoked inside the scripts) and Python SDK (pip install -r scripts/requirements.txt).

Example Scenarios

Example 1: ECS with public IP (Branch A)

Input: "Check the public connectivity of instance i-bp116m5pkhsle6xm5pl8 in cn-hangzhou."

  1. Parse: region_id=cn-hangzhou, instance_id=i-bp116m5pkhsle6xm5pl8, scenario=ecs_public
  2. Run sts_create.py for credentials
  3. Run python3 scripts/ecs_public_troubleshoot.py --region-id cn-hangzhou --instance-id i-bp116m5pkhsle6xm5pl8
  4. Script outputs JSON with branch="A" → render Direct Public info table (instance / security group / DDoS / CFW)
  5. Output remediation for any abnormal item

Example 2: ECS security group blocking public access

Input: "Public access to TCP 80 of i-bp116m5pkhsle6xm5pl8 in cn-hangzhou is blocked — is the security group blocking it?"

  1. Parse: region_id=cn-hangzhou, instance_id=i-bp116m5pkhsle6xm5pl8, scenario=ecs_public
  2. Run sts_create.py
  3. Run the ECS script (same command); the full-chain check includes the security group
  4. Render the info table; if the security group is abnormal, state which ingress rule blocks the port
  5. Output remediation for the abnormal security-group item

Example 3: DataWorks in VPC cannot access public network

Input: "DataWorks cannot access the public network, VSwitch vsw-bp1xat3xsvck79y8zo8yo in cn-hangzhou."

  1. Parse: region_id=cn-hangzhou, vswitch_id=vsw-bp1xat3xsvck79y8zo8yo, service_type=dataworks, scenario=vpc_service_public
  2. Run sts_create.py
  3. Run python3 scripts/vpc_service_public_troubleshoot.py --region-id cn-hangzhou --vswitch-id vsw-bp1xat3xsvck79y8zo8yo
  4. Script outputs JSON (VSwitch / NAT / route / SNAT / EIP / DDoS / CFW checked) → render VPC cloud service info table
  5. Output remediation for any abnormal item

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,040
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,034
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,021
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,021
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,019
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,016
Skill 文件
  • SKILL.md
    • ECS/VPC Public Network Connectivity Troubleshooting
    • Execution Principle (script-only, no fallback)
    • Credentials (do not handle manually)
    • User Confirmation (required before any API call)
    • Trigger Conditions
    • Input Parameters
    • Module Index
    • Orchestration
    • Execution Flow
      • Scenario 1 (ECS) Invocation
      • Scenario 2 (VPC cloud service) Invocation
    • Observability
    • Important Notes
    • Example Scenarios
      • Example 1: ECS with public IP (Branch A)
      • Example 2: ECS security group blocking public access
      • Example 3: DataWorks in VPC cannot access public network
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期