aliyun/alibabacloud-aiops-skills/alibabacloud-waf-config-backup
Claude Code and agent skill by aliyun/alibabacloud-aiops-skills
- community
Checking that the SKILL.md file is still in the repository.
Full-configuration backup of Alibaba Cloud WAF 3.0 to a single multi-sheet Excel workbook. Covers all onboarding types (CNAME / cloud-product / hybrid-cloud), defense policies (11 rule types), and template-to-resource binding relationships. Auto-detects account topology (single UID vs. delegated administrator under WAF 3.0 multi-account unified management); under the delegated-administrator scenario each row is tagged with the resolved member-account OwnerUid and a dedicated member-account sheet is appended. Use when the user needs "WAF config backup", "WAF full export", "WAF disaster-recovery snapshot", "WAF config audit", "export WAF domains and rules", "WAF migration inventory", or "WAF multi-account / delegated-administrator backup".
Install
npx vskill@latest install aliyun/alibabacloud-aiops-skills/alibabacloud-waf-config-backupSKILL.md
The same SKILL.md was published earlier as aliyun/alibabacloud-aiops-skills/alibabacloud-waf-config-backup.
Alibaba Cloud WAF 3.0 Full Configuration Backup
One-command, full-configuration backup of all WAF 3.0 instances under an account into a single structured Excel workbook. Produces a complete snapshot covering three onboarding types, defense policies, and the binding relationships that link them — suitable for disaster-recovery snapshots, configuration audits, delivery documentation, and migration inventories.
Supports Chinese mainland site (aliyun.com) and International site (alibabacloud.com), merging both Chinese mainland and non-Chinese mainland instances under the same account.
Supports two account topologies under WAF 3.0 multi-account unified management:
- Single UID — the executing account directly owns the WAF instances and resources.
- Delegated administrator — the executing account is the WAF delegated administrator under a Resource Directory; each protected resource may belong to a different member account, and the workbook resolves and labels every row with its real owning UID.
The scenario is auto-detected at runtime and shown both in the filename (UID prefix) and in the Summary sheet.
Scope: backup / export only. This skill never performs write operations (no create / modify / delete). It is safe to run against production.
DR-grade backup principle
Every object is exported in two complementary forms so the snapshot is sufficient to reconstruct the configuration, not just inventory it:
- Human-readable parsed columns — friendly views (ports, conditions, actions, timeouts, etc.) for audit and quick reading.
- Full untruncated raw JSON column — each CNAME domain, defense rule, template, and binding row carries a complete
Raw JSONcolumn holding the exact API payload. Because ruleConfigstructures differ per DefenseScene and may change across API versions, the raw column guarantees no field is ever silently dropped — it is the authoritative source for rebuild.
Reconstruction caveats (cannot be captured by any read-only API): TLS certificate private keys are not exportable — theCert ID/Cert Nameare references; the certificate must already exist (or be re-uploaded) in the target account before rebuild. Likewise, cloud-product onboarding (ALB/CLB/ECS) depends on those product instances existing first.
What Gets Exported
Member-scoped sheets (CNAME / Cloud Resource / Hybrid Cloud / Protected Objects / Bindings) carry an OwnerUid first column. Under the single-UID scenario this column is hidden by default (value-redundant — every row equals the caller UID); under the delegated-administrator scenario it is shown and resolved from the per-region ResourceName → OwnerUid map (with caller UID as fallback). Admin-scoped sheets (Instance Info / Object Groups / Templates / Defense Rules) do not carry this column — these resources have no member-account ownership semantics.
Excel Workbook Structure
| Sheet | Content | |
|---|---|---|
Summary | Dashboard: backup metadata + caller UID + scenario (single UID / delegated administrator + member count) + counts per region | |
Instance Info | WAF instance specification + full raw JSON | |
Member Accounts | Member account inventory (only present in the delegated-administrator scenario): account ID / name / status / description / join time | |
Guide | Embedded documentation for rebuilding | |
CNAME (CN) / CNAME (Intl) | CNAME onboarding: ports, backends, TLS, cert + raw JSON | |
Cloud Resource (CN) / (Intl) | Cloud-product onboarding + raw JSON (skipped if none) | |
Hybrid Cloud (CN) / (Intl) | Hybrid-cloud onboarding + raw JSON (skipped if none) | |
Protected Objects (CN) / (Intl) | Full object inventory + raw JSON | |
Object Groups (CN) / (Intl) | Object groups → members + raw JSON (skipped if none) | |
Templates (CN) / (Intl) | Defense templates + raw JSON | |
{SceneLabel} (CN) / (Intl) | Defense rules per type + full Config JSON (skipped if empty) | |
Bindings (CN) / (Intl) | Template → object mapping + raw JSON | |
Changes (Diff) | Rule-level diff vs the auto-discovered baseline (Added / Removed / Modified across RuleName / Status / Action / Conditions). Skipped when --no-diff is set or when no baseline is found |
Region:CN= cn-hangzhou,Intl= ap-southeast-1. Empty combinations are skipped.Member-scoped sheets (CNAME, Cloud Resource, Hybrid Cloud, Protected Objects, Bindings) carry anOwnerUidfirst column; the column is hidden in single-UID runs and shown in delegated-administrator runs. Admin-scoped sheets (Instance Info, Object Groups, Templates, Defense Rules) have no such column.Diff is on by default: the script auto-discovers the most recentwaf_config_backup_<caller_uid>_*[_lang].xlsxin the output directory (excluding the current run, matching language) and compares against it. The baseline filename is recorded in Summary Row 5. Use--prev <path>to override auto-discovery, or--no-diffto disable diff entirely.
Installation
Pre-check: Aliyun CLI >= 3.3.3 required
Runaliyun versionto verify >= 3.3.3. If not installed or version too low,runcurl -fsSL https://aliyuncli.alicdn.com/setup.sh | bashto install/update,
Pre-check: Aliyun CLI plugin update required
[MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation.[MUST] runaliyun plugin updateto ensure that any existing plugins are always up-to-date.
Python dependency:
Authentication
Pre-check: Alibaba Cloud Credentials RequiredSecurity 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 usealiyun configure setwith literal credential values- ONLY usealiyun configure listto check credential status```bashaliyun 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 Console2. Configure credentials outside of this session (viaaliyun configurein terminal or environment variables in shell profile)3. Return and re-run afteraliyun configure listshows a valid profile
International site users must configure a separate profile (e.g.,aliyun configure --profile intl). Chinese mainland and International site AKs are NOT interchangeable.
RAM Policy
The RAM user must have read-only WAF permissions. Recommended: attach AliyunYundunWAFReadOnlyAccess.
See references/ram-policies.md for the full permission list.
[MUST] Permission Failure Handling: When any command or API call fails due to permission errors at any point during execution, follow this process:1. Read references/ram-policies.md to get the full list of permissions required by this SKILL2. Guide the user through requesting the necessary permissions3. Pause and wait until the user confirms that the required permissions have been granted
Parameter Confirmation
Parameter Confirmation — No user interaction needed. All parameters use sensible defaults.Directly proceed to Core Workflow.
| Parameter | Description | Default | |
|---|---|---|---|
| RegionId | Always query both regions (cn-hangzhou + ap-southeast-1) | Both | |
| InstanceId | Auto-discovered | — | |
| Dimensions | Export all dimensions | All | |
| CLI Profile | Uses default profile; pass --profile <name> if user specifies | default | |
| Output File | Filename embeds caller UID (auto-detected) and timestamp; bilingual mode appends _zh / _en | waf_config_backup_<UID>_YYYYMMDD_HHMMSS.xlsx (or ..._<lang>.xlsx under --lang all); UID falls back to unknown only if sts get-caller-identity fails |
Core Workflow
Observability (MUST run before any command)
Generate a random session ID (32-char lowercase hex string) once per skill invocation:
Every business API command (including aliyun waf-openapi ... and aliyun sts ...) MUST carry --user-agent with the session ID:
UA template format:
Rules:- All business API commands (e.g.,aliyun waf-openapi describe-instance,aliyun sts get-caller-identity) carry--user-agent.- System commands (aliyun configure,aliyun version,aliyun plugin) MUST NOT carry--user-agent.- Do not place PII in the user-agent string.- The bundled Python script handles--user-agentinjection automatically.
Step 1: Run the backup script
[MUST] Use the bundled script — DO NOT write your own.The bundledscripts/export_waf_config_backup.pyis the single supported entry point and already handles every scenario (single-UID, delegated administrator, unauthorized-fallback). It also injects--user-agent, builds the bilingual workbook, runs auto-discovery diff, and prints the contract success lineBackup complete!. A custom replacement script (e.g.export_waf_config.py,export_waf_final.py, or any inline ad-hoc script) will miss these guarantees and is non-compliant. If the bundled script reports an error, fix the environment (CLI version / credentials / RAM policy) and rerun it — never replace it.
Run the bundled script from the skill directory:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/security/waf/alibabacloud-waf-config-backup/SKILL.md
Popularity
- Repository stars
- 221
- Repository forks
- 28
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 21 Aug 2026, 3 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aliyun/alibabacloud-aiops-skills/alibabacloud-waf-config-backup)