跪拜 Guibai
← All articles
Frontend · Backend

Two Manual Steps, Then an AI Runs Your Ops: DSH + RAM on Alibaba Cloud

By 函数小陈 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

This hands-on report shows a workable division of labor for AI-run cloud ops: the human sets the permission boundary and confirms destructive actions, the agent executes the rest. It also documents a concrete Node.js IPv6 failure mode that only appears on hosts without IPv6 egress, plus a verification routine for knowing exactly what an agent can and cannot do.

Summary

DeepSeek Harness (DSH) has taken over the ops duties of a 2 vCPU / 1.8 GiB Alibaba Cloud ECS instance after exactly two human interventions: installing the agent web UI and creating a RAM user restricted to a single DNS domain. The agent then created subdomains, deployed a project without Docker (switching to native systemd + nginx when the environment didn't match the docs), expanded the existing TLS certificate, and set up daily MySQL backups with a 7-day retention.

The most interesting work happened when a service call failed while curl succeeded. The agent compared curl and Node's connection behavior, isolated the cause to Node's automatic IPv6 address-family selection against a domain with AAAA records, and fixed it with `NODE_OPTIONS=--no-network-family-autoselection` plus a system-level IPv6 disable. The failure time dropped from a multi-second timeout to 22 ms.

The post also details the safety rails: a RAM policy scoped to one domain, a boundary check with `sts GetCallerIdentity` and forbidden calls, optimistic locking added to a naive overwrite endpoint, and an iptables rule to prevent bypassing the reverse proxy. The author is explicit that humans must still own authorization scope, destructive-operation consent, key rotation, and deciding what to build.

Takeaways
— The only two human steps are installing DeepSeek Harness (npx command) and creating a RAM user with a per-domain Alidns policy; everything else is delegated.
— DSH listens on 127.0.0.1 by default; a password gateway signs session cookies using DSH's persistent cookie key to avoid one-time tokens changing on restart.
— The RAM policy narrows the `Resource` field to a single domain (e.g., `domain/chenjiaxin.me`) rather than `*`; the agent never sees the AccessKey in plaintext—it reads it from `aliyun configure`.
— Verifying boundaries with `aliyun sts GetCallerIdentity` and confirm a Forbidden error on `DescribeDomains` and `DescribeVpcs` proves the identity is scoped correctly.
— The agent checks for duplicate DNS records before creating one, and understands that changing a record is delete-plus-create because Alibaba Cloud's `RecordId` doesn't follow the domain.
— When the project's `docker-compose.yml` doesn't match the machine (no Docker, ports 80/443 occupied), the agent switches to native systemd + nginx deployment without being told to.
— A service failing while curl succeeds can be caused by Node's automatic IPv6 selection against a host with AAAA records on a machine with no IPv6 egress; fixing it with `NODE_OPTIONS=--no-network-family-autoselection` dropped failure time from seconds to 22 ms.
— Backups use `mysqldump --single-transaction` to avoid locking, run daily via a systemd timer with `Persistent=true`, and keep 7 days.
— Optimistic locking was added to a full-overwrite save endpoint, returning 409 on a revision conflict instead of silently overwriting.
— An iptables rule drops traffic to backend port 3001 except on the loopback interface to prevent bypassing the nginx reverse proxy.
Conclusions

The author's rule "read operations are free, write operations must be explained before execution" is a practical, human-friendly way to delegate destructive actions to an AI agent without turning the human into a rubber-stamp.

The IPv6 timeout case is a textbook example of why AI agents need to compare multiple execution paths (curl vs Node) rather than assume a single explanation; the agent's method of isolating the difference is more valuable than the one-line fix.

Giving an AI identity via a scoped cloud role (like this RAM user) is a cleaner authorization model than stuffing API keys into prompts or code, and it makes the agent's actions auditable per identity.

Concepts & terms
DeepSeek Harness (DSH)
A locally running AI Agent web UI that accepts natural-language ops instructions and executes commands on the host. It listens on 127.0.0.1 by default and uses a one-time token for login unless configured otherwise.
RAM (Resource Access Management)
Alibaba Cloud's identity and access management service. Creating a RAM user with a narrowly scoped policy lets you grant an agent the minimum permissions needed, such as only modifying DNS records for a single domain.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗