Detailed description of the scenario's application and purpose.
Diagnose network connectivity, upload/download bandwidth, download time, and local symlink anomalies between the local workstation and OSS using ossutil 2.0 integrated with the Alibaba Cloud CLI.
Architecture: Local Workstation + Alibaba Cloud CLI 3.3.3+ + aliyun ossutil + OSS Bucket + Optional target object or presigned URL + Optional probe domain
| Scenario | Recommended Command | Output |
|---|
| Upload connectivity probe | INLINECODE2 | Upload duration, object name, log file |
| Download connectivity probe |
aliyun ... ossutil probe --download | Download duration, local file path, log file |
| Upload bandwidth suggestion |
aliyun ... ossutil probe --probe-item upload-speed | Suggested concurrency value |
| Download bandwidth suggestion |
aliyun ... ossutil probe --probe-item download-speed | Suggested concurrency value |
| Download time measurement |
aliyun ... ossutil probe --probe-item download-time | Concurrency/part-size/duration statistics |
| Symlink anomaly check |
aliyun ... ossutil probe --probe-item cycle-symlink | Whether abnormal symlinks exist |
Important implementation boundary
- -
probe is a composite client-side diagnostic command provided by aliyun ossutil; there is no equivalent aliyun oss api probe. - INLINECODE11 can only detect abnormal symlinks — it cannot safely auto-fix target paths.
- Probe output can locate symptoms and suggest concurrency, but cannot guarantee an automatic precise root cause for all network anomalies.
- INLINECODE12 requires a real existing object, and the official recommendation is objects larger than 5 MiB. If no suitable object exists, the user must first confirm an existing object path, or confirm a local file to upload via
aliyun ossutil cp before probing.
Installation
Pre-check: Aliyun CLI >= 3.3.3 required
Run aliyun version to verify >= 3.3.3. If not installed or version too low,
see references/cli-installation-guide.md for installation instructions.
Then run the credential gate aliyun configure list.
Only after configure list shows a valid profile, run aliyun configure set --auto-plugin-install true and aliyun ossutil version.
Run the version and credential gate first:
CODEBLOCK0
Only after configure list confirms a valid profile, proceed:
CODEBLOCK1
AI safety mode: configure ai-mode enable activates the CLI's built-in safety guard, which blocks dangerous operations (e.g. deleting critical resources) at the CLI level. This must be enabled before executing any ossutil commands.
Environment Variables
| Environment Variable | Required/Optional | Description | Default Value |
|---|
| INLINECODE22 | Optional | Specify which CLI profile to use | Current default profile |
| INLINECODE23 |
Optional | HTTP proxy address in proxied environments | None |
|
HTTPS_PROXY | Optional | HTTPS proxy address in proxied environments | None |
|
NO_PROXY | Optional | Proxy bypass list | None |
Parameter Confirmation
IMPORTANT: Parameter Confirmation — Before executing any command or API call,
ALL user-customizable parameters (e.g., RegionId, instance names, CIDR blocks,
passwords, domain names, resource specifications, etc.) MUST be confirmed with the
user. Do NOT assume or use default values without explicit user approval.
| Parameter Name | Required/Optional | Description | Default Value |
|---|
| INLINECODE26 | Optional | CLI profile to use | Current default profile |
| INLINECODE27 |
Optional | Region where the bucket is located; use when auto-detection is unreliable or explicit specification is needed | None |
|
bucket_name | Required for bucket-based probes | Target bucket name | None |
|
object_name | Required for
download-speed and
download-time; optional for other bucket-based probes | Full object path, e.g.
dir/example.txt; for
download-speed, objects larger than 5 MiB are recommended for stable results | None |
|
local_path | Optional | Local upload file path, symlink scan directory, or download save path | None |
|
download_url | Required for URL-based download probe | Public-read URL or signed private URL | None |
|
endpoint | Optional | Use only when the user explicitly provides it or the error message clearly points to a specific endpoint | None |
|
addr | Optional | Domain for
--addr network connectivity check |
www.aliyun.com only if user explicitly accepts |
|
upmode | Optional | Upload probe mode |
normal |
|
runtime | Optional | Max runtime in seconds for
upload-speed /
download-speed | CLI default |
|
parallel | Optional | Single-file concurrency for
download-time |
1 |
|
part_size | Optional | Part size in bytes for
download-time | CLI auto/default |
Authentication
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- - NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_ID is FORBIDDEN) - NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure set with literal credential values - NEVER read credential files such as
~/.aliyun/config.json, or dump environment variables to inspect credentials - NEVER write a full presigned URL with query-string signature parameters into logs or final output; if you must mention it, redact everything after INLINECODE53
- ONLY use
aliyun configure list to check credential status
> aliyun configure list
>
Check the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- 1. Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configure in terminal or environment variables in shell profile) - Return and re-run after
aliyun configure list shows a valid profile
If multiple profiles exist, explicitly add --profile <profile> in subsequent commands, placed after aliyun and before ossutil, e.g. aliyun --profile <profile> ossutil version.
RAM Policy
The minimum OSS permissions required by this skill depend on the probe mode. Refer to references/ram-polices.md for per-scenario permission tables and policy examples.
- - Upload probes, upload bandwidth probes, temporary object probes: require at least
oss:GetObject, oss:PutObject, INLINECODE64 - Download probes, download bandwidth probes, download time probes: require at least INLINECODE65
- If using
aliyun ossutil cp to pre-upload a test object: requires INLINECODE67 - If using
aliyun ossutil rm to clean up an explicitly specified test object: requires INLINECODE69
Core Workflow
1. Validate the CLI environment
Execute in the following order — do not skip steps:
- 1. Check CLI version first:
aliyun version
- 2. Then check credentials/profile:
aliyun configure list
- 3. If
configure list does not show a valid profile, or reports a missing config file, STOP immediately.
- Do NOT proceed with
configure set --auto-plugin-install true
- Do NOT proceed with
ossutil version
- Do NOT fabricate bucket, object, profile, region, or probe success results
- 4. Only after the profile is valid, proceed to prepare the plugin, enable AI safety mode, and verify
ossutil:
CODEBLOCK5
1.1 Log file naming and command substitution
- - When saving execution logs, use static strings for filenames (e.g.
probe_download_time.log). Do not use $(date ...), $(...), or backtick shell command substitutions in filenames, because different execution environments have inconsistent shell interpolation support, which can easily cause syntax errors. - Some execution environments block
$() command substitution entirely. When you need to capture command output into a variable (e.g. for presigned URLs), use the file+script pattern: redirect output to a temporary file, then create a shell script that reads the file and uses the value. See §B for a concrete example.
2. Choose the probe mode
A. Upload connectivity probe
- - If the user only wants network/upload connectivity diagnostics without keeping the object, omit
local_path and object_name and let probe use a temporary file that is auto-cleaned after completion. - If the user wants to verify a specific real file's upload path, confirm
local_path. - If the upload probe returns
AccessDenied, quote the error as-is and explain that at least oss:GetObject, oss:PutObject, oss:DeleteObject are required; do not enumerate buckets, regions, or fall back to legacy command forms.
CODEBLOCK6
When LOCAL_PATH_IF_ANY is not provided, remove that positional parameter entirely — do not pass an empty string.
B. Download probe via URL
- - Public-read objects: have the user confirm a directly accessible URL.
- Private objects: generate a presigned URL first, then run
probe --download --url.
Generate a presigned URL, save it to a temporary file, then run the probe via a shell script. This two-step approach avoids exposing the full URL in command history and works in environments where $() command substitution is blocked.
Step 1 — Generate the presigned URL and redirect output to a temporary file:
CODEBLOCK7
Step 2 — Create a probe script that reads the URL from the file and runs the download probe:
CODEBLOCK8
Important — you MUST use probe --download --url with the presigned URL:
- - Never copy-paste the full presigned URL directly into the
--url parameter — use the file+script pattern above so the URL is never exposed in command history or execution logs. - If
/tmp/ is not writable, use the current workspace directory for the temporary file and script instead.
INLINECODE92 only accepts HTTP/HTTPS URLs — it cannot take oss://bucket/object.
- - A successful
ossutil presign only means the signed URL was generated; it does not guarantee the bucket or object exists, nor that the subsequent download will succeed. - If you need to log the execution, do not persist the full presigned URL; at most keep the object address without the query string, or redact all signature parameters after
?. - If
probe --download --url returns 404/403, quote the raw HTTP error first; if the bucket/object was already confirmed input, you may do one ossutil stat validation with the same bucket + object + region. Do not try to "guess" the root cause by listing buckets, trying random regions, or reading local credential files.
C. Download probe via Bucket/Object
- - If the user confirmed
object_name, the command will download that object directly. - If the user does not provide
object_name, probe will create a temporary object, download it, and delete the temporary object after completion.
CODEBLOCK9
- - If the command reports
NoSuchBucket, NoSuchKey, or other object-level errors, prefer running ossutil stat "oss://<BUCKET_NAME>/<OBJECT_NAME>" --region "<REGION_ID_IF_NEEDED>" for same-target validation. - Do not list all buckets, try unconfirmed regions, or switch to
aliyun oss api / GetBucketLocation or other commands outside this skill's scope to confirm whether the object exists.
D. Local symlink anomaly probe
This mode only checks local directory/file paths — it does not access OSS.
CODEBLOCK10
- - If the command returns
stat <path>: no such file or directory, explicitly state that the local path does not exist in the current execution environment; this is still a local-only flow with no OSS access. - When the local path does not exist, you must NEVER:
- Interpret it as "this is a containerized/sandbox environment limitation"
- Automatically rewrite it as "the user should run on another machine/production environment"
- Generate a script file saying "run this command in the correct environment"
- Check the parent directory with
ls and then give up
Correct approach: Quote the raw error stat <path>: no such file or directory, explicitly tell the user the path does not exist in the current environment, and ask whether they provided the correct path. Unless the user proactively states the current session is not on the target machine, do not make that judgment for them.
When reporting results of this probe, include at minimum:
- - This is a local-only flow — no OSS access occurred
- Which symlinks are abnormal and which link chains were directly verified; if only partial chains can be verified, clearly distinguish "confirmed chain segments" from "anomaly points proven by probe errors", e.g.
loop-b -> loop-a, and resolving loop-a reports INLINECODE112 - If the probe output contains raw errors, quote at least one key error, e.g. INLINECODE113
- Minimum fix prerequisites, e.g. break one of the cyclic links or re-point the abnormal link to a real target before retrying
If you need to clarify the abnormal link chain, you may perform read-only local forensics on the same path (e.g. readlink, stat -f "%N -> %Y"). Only write precise chains when these supplementary results are actually readable; if the supplementary forensics itself fails, report only verified segments — do not fabricate a complete cycle.
If the output lists abnormal symlinks, the user or a local script must fix them according to business semantics; this skill does not auto-rewrite symlink targets.
E. Upload bandwidth probe with suggested concurrency
Basic command:
CODEBLOCK11
To limit runtime, add:
CODEBLOCK12
Successful output will contain suggest parallel is <N>.
F. Download bandwidth probe with suggested concurrency
- -
object_name is required. - Official recommendation: target object should be larger than 5 MiB.
- If the user has no suitable object, first confirm a local file path, then upload a cleanable test object via
aliyun ossutil cp.
Optional preparation step:
CODEBLOCK13
Run download bandwidth probe:
CODEBLOCK14
G. Download time probe
Basic command:
CODEBLOCK15
To explicitly control concurrency and part size, add:
CODEBLOCK16
INLINECODE119 and --part-size are only meaningful in the download-time scenario; do not misuse them with upload-speed.
3. Interpret the output
- - When upload/download probes succeed, the output will contain
upload file:success or INLINECODE124 - When bandwidth probes succeed, the output will contain multiple
parallel:<N> statistics and INLINECODE126 - When download time probes succeed, the output will contain
total bytes, cost, INLINECODE129 - All probe modes typically generate a
logOssProbe*.log local log file; after probe execution, you must check whether logOssProbe*.log was generated in the current directory and report the log path in the final answer - If a real command returns an error or has no success marker, the final conclusion must explicitly state failure/blocked and quote the raw error message — do not write "task completed successfully" or describe a failure as successful verification
- When a command fails, the final answer must explicitly state the termination reason (e.g. "stopped due to AccessDenied", "stopped due to path not found") — do not end silently
- For errors like
The bucket you are attempting to access must be addressed using the specified endpoint, this only means the current access endpoint does not match the bucket's requirements; stop immediately, ask the user to confirm the correct region/endpoint — do not infer or try other region/endpoints on your own
See references/verification-method.md for more detailed verification steps.
Success Verification Method
Follow the steps in references/verification-method.md to confirm each item:
- 1. CLI version and profile are valid
- Probe output contains success markers or suggested concurrency
- You must run
ls logOssProbe*.log to check whether log files were generated locally, and report the log path in the final answer; if no log files were generated, it means the probe may not have reached the actual probing stage - If an explicit test object was used, confirm whether it should be retained or enter the cleanup step
- If any of the above steps fail, the final answer must explicitly state failure and quote the raw error with termination reason
Cleanup
- - Upload/download connectivity probes without an explicit
--object will auto-clean temporary objects - If you explicitly uploaded a test object in the
download-speed preparation step, decide whether to delete it based on user confirmation after probing
Delete an OSS test object:
CODEBLOCK17
If a temporary test file was downloaded locally, it should also be deleted or retained based on user confirmation.
After all probe and cleanup steps are finished, disable AI safety mode:
CODEBLOCK18
API and Command Tables
For all commands, underlying OSS capability mappings, and which steps are local client-side logic only, see references/related-apis.md.
Best Practices
- 1. Always use
aliyun ossutil probe — do not fabricate non-existent commands like INLINECODE140 - Confirm all user-variable parameters before execution, especially
bucket_name, object_name, download_url, INLINECODE144 - Only retain probe objects when the user explicitly confirms; otherwise prefer temporary objects or explicit cleanup
- For
download-speed, choose a real object larger than 5 MiB for more stable results - In proxy, dedicated line, or custom domain scenarios, explicitly confirm
--addr, --region, INLINECODE148 - Use
suggest parallel is <N> as an empirical baseline, then do small-scale validation combined with actual business concurrency - For
cycle-symlink, only diagnose — do not auto-fix - After command failure, prefer same-target validation (e.g.
ossutil stat) — do not expand into listing buckets, guessing regions, trying unsupported flags, or reading local credential files - Do not expose AK/SK, STS tokens, or full presigned URL query strings in logs or final results
- A successful presign, resolvable DNS, or reachable ping/traceroute does not guarantee the object exists or that the probe will succeed; conclusions must be based on actual probe/validation results
Reference Links
| Reference | Purpose |
|---|
| INLINECODE152 | Installing and upgrading Aliyun CLI |
| INLINECODE153 |
Checking success by probe mode |
|
references/related-apis.md | Command to underlying OSS capability/permission mapping |
|
references/ram-polices.md | RAM permission checklist and policy examples |
|
references/acceptance-criteria.md | Skill acceptance criteria and counter-examples |
|
references/implementation-boundaries.md | Boundaries that cannot be fully automated via CLI or code |
场景应用与目的的详细描述
使用集成阿里云CLI的ossutil 2.0诊断本地工作站与OSS之间的网络连通性、上传/下载带宽、下载时间以及本地符号链接异常。
架构:本地工作站 + 阿里云CLI 3.3.3+ + aliyun ossutil + OSS存储桶 + 可选目标对象或预签名URL + 可选探测域名
| 场景 | 推荐命令 | 输出 |
|---|
| 上传连通性探测 | aliyun ... ossutil probe --upload | 上传耗时、对象名称、日志文件 |
| 下载连通性探测 |
aliyun ... ossutil probe --download | 下载耗时、本地文件路径、日志文件 |
| 上传带宽建议 | aliyun ... ossutil probe --probe-item upload-speed | 建议并发值 |
| 下载带宽建议 | aliyun ... ossutil probe --probe-item download-speed | 建议并发值 |
| 下载时间测量 | aliyun ... ossutil probe --probe-item download-time | 并发/分片大小/耗时统计 |
| 符号链接异常检查 | aliyun ... ossutil probe --probe-item cycle-symlink | 是否存在异常符号链接 |
重要实现边界
- - probe是aliyun ossutil提供的复合客户端诊断命令;没有等效的aliyun oss api probe。
- cycle-symlink只能检测异常符号链接——无法安全地自动修复目标路径。
- 探测输出可以定位症状并建议并发值,但不能保证自动精确定位所有网络异常的根本原因。
- download-speed需要一个真实存在的对象,官方建议使用大于5 MiB的对象。如果没有合适的对象,用户必须先确认一个已存在的对象路径,或通过aliyun ossutil cp上传本地文件后再进行探测。
安装
前置检查:需要阿里云CLI >= 3.3.3
运行aliyun version验证版本是否>= 3.3.3。如果未安装或版本过低,
请参阅references/cli-installation-guide.md获取安装说明。
然后运行凭证验证命令aliyun configure list。
仅在configure list显示有效配置后,运行aliyun configure set --auto-plugin-install true和aliyun ossutil version。
首先运行版本和凭证验证:
bash
aliyun version
aliyun configure list
仅在configure list确认有效配置后,继续执行:
bash
aliyun configure set --auto-plugin-install true
aliyun configure ai-mode enable
aliyun ossutil version
AI安全模式:configure ai-mode enable激活CLI内置的安全防护,在CLI层面阻止危险操作(例如删除关键资源)。在执行任何ossutil命令之前必须启用此功能。
环境变量
| 环境变量 | 必需/可选 | 描述 | 默认值 |
|---|
| ALIBABACLOUDPROFILE | 可选 | 指定要使用的CLI配置 | 当前默认配置 |
| HTTP_PROXY |
可选 | 代理环境中的HTTP代理地址 | 无 |
| HTTPS_PROXY | 可选 | 代理环境中的HTTPS代理地址 | 无 |
| NO_PROXY | 可选 | 代理绕过列表 | 无 |
参数确认
重要:参数确认 — 在执行任何命令或API调用之前,
所有用户可自定义的参数(例如RegionId、实例名称、CIDR块、
密码、域名、资源规格等)必须与用户确认。未经用户明确批准,不得假设或使用默认值。
| 参数名称 | 必需/可选 | 描述 | 默认值 |
|---|
| profile | 可选 | 要使用的CLI配置 | 当前默认配置 |
| region_id |
可选 | 存储桶所在区域;当自动检测不可靠或需要明确指定时使用 | 无 |
| bucket_name | 基于存储桶的探测必需 | 目标存储桶名称 | 无 |
| object_name | download-speed和download-time必需;其他基于存储桶的探测可选 | 完整对象路径,例如dir/example.txt;对于download-speed,建议使用大于5 MiB的对象以获得稳定结果 | 无 |
| local_path | 可选 | 本地上传文件路径、符号链接扫描目录或下载保存路径 | 无 |
| download_url | 基于URL的下载探测必需 | 公共读取URL或签名私有URL | 无 |
| endpoint | 可选 | 仅在用户明确提供或错误信息明确指向特定端点时使用 | 无 |
| addr | 可选 | --addr网络连通性检查的域名 | 仅当用户明确接受时为www.aliyun.com |
| upmode | 可选 | 上传探测模式 | normal |
| runtime | 可选 | upload-speed/download-speed的最大运行时间(秒) | CLI默认值 |
| parallel | 可选 | download-time的单文件并发数 | 1 |
| part_size | 可选 | download-time的分片大小(字节) | CLI自动/默认 |
身份认证
前置检查:需要阿里云凭证
安全规则:
- - 绝不读取、回显或打印AK/SK值(例如,echo $ALIBABACLOUDACCESSKEYID是被禁止的)
- 绝不要求用户在对话或命令行中直接输入AK/SK
- 绝不使用字面凭证值执行aliyun configure set
- 绝不读取凭证文件如~/.aliyun/config.json,或转储环境变量以检查凭证
- 绝不将包含查询字符串签名参数的完整预签名URL写入日志或最终输出;如果必须提及,请将?之后的所有内容进行脱敏处理
- 仅使用aliyun configure list检查凭证状态
bash
aliyun configure list
检查输出中是否存在有效配置(AK、STS或OAuth身份)。
如果没有有效配置,请在此处停止。
- 1. 从阿里云控制台获取凭证
- 在此会话之外配置凭证(通过终端中的aliyun configure或shell配置文件中的环境变量)
- 在aliyun configure list显示有效配置后返回并重新运行
如果存在多个配置,在后续命令中显式添加--profile ,放在aliyun之后、ossutil之前,例如aliyun --profile ossutil version。
RAM策略
此技能所需的最低OSS权限取决于探测模式。请参阅references/ram-polices.md获取各场景的权限表和策略示例。
- - 上传探测、上传带宽探测、临时对象探测:至少需要oss:GetObject、oss:PutObject、oss:DeleteObject
- 下载探测、下载带宽探测、下载时间探测:至少需要oss:GetObject
- 如果使用aliyun ossutil cp预先上传测试对象:需要oss:PutObject
- 如果使用aliyun ossutil rm清理明确指定的测试对象:需要oss:DeleteObject
核心工作流程
1. 验证CLI环境
按以下顺序执行——不要跳过步骤:
- 1. 首先检查CLI版本:
bash
aliyun version
- 2. 然后检查凭证/配置:
bash
aliyun configure list
- 3. 如果configure list未显示有效配置,或报告缺少配置文件,请立即停止。
- 不要继续执行configure set --auto-plugin-install true
- 不要继续执行ossutil version
- 不要虚构存储桶、对象、配置、区域或探测成功结果
- 4. 仅在配置有效后,继续准备插件、启用AI安全模式并验证ossutil:
bash
aliyun configure set --auto-plugin-install true
aliyun configure ai-mode enable
aliyun ossutil version
1.1 日志文件命名和命令替换
- - 保存执行日志时,使用静态字符串作为文件名(例如probedownloadtime.log)。不要在文件名中使用$(date ...)、$(...)或反引号shell命令替换,因为不同执行环境的shell插值支持不一致,容易导致语法错误。
- 某些执行环境完全阻止$()命令替换。当需要将命令输出捕获到变量中时(例如预签名URL),使用文件+脚本模式:将输出重定向到临时文件,然后创建一个读取该文件并使用该值的shell脚本。参见§B的具体示例。
2. 选择探测模式
A. 上传连通性探测