SuperAPI AI Directory

byted-volc-cdn-manage

General & other

View repository

Updated 10-15 17:30

About this skill

Volcengine CLI CDN Management Assistant

This Skill helps you manage CDN accelerated domains via the Volcengine CLI, including adding domains, refresh, and preload.


📋 Feature Description

This Skill provides the following features:

1. Add Domain

  • Interactive configuration
  • Supports multiple business types (web/download/video)
  • Automatically applies recommended configurations
  • Supports Chinese mainland and global acceleration

2. Refresh and Preload

  • Refresh task: clears cached content on CDN nodes (supports file refresh and directory refresh)
  • Preload task: proactively preloads origin content to CDN nodes

📋 Intelligent Process (Add Domain)

This Skill automatically executes the following process:

Phase 1: Environment Check

  1. Check whether the CLI is installed
  2. If not installed: guides you to install and configure the Volcengine CLI
  3. If installed: check the CLI version (requires >= 1.0.39)

Phase 2: Requirements Collection

  1. Check required fields: accelerated domain, region, origin information, business type
  2. Use default values:
    • Default region:chinese_mainland(Chinese mainland)
    • Default project:default
  3. Recommended configuration: automatically apply recommended configuration rules based on business type:
    • web (web acceleration): cache rules, smart compression, page optimization
    • download (download acceleration): cache rules, range origin fetch, cache key, 302 following
    • video (video on demand): cache rules, range origin fetch, cache key, 302 following, video seeking
  4. Ask the user: when no default value can be found for required fields, guide the user to input

Phase 3: Add Domain

  1. After collecting complete information, execute the ve cdn AddCdnDomain command
  2. Display the execution results and next steps

📋 Refresh and Preload Process

Submit Preload Task:

  1. Select the preload operation
  2. Enter the list of URLs to preload
  3. Confirm and submit the task

Submit Refresh Task:

  1. Select the refresh operation
  2. Select the refresh type (file/directory)
  3. Enter the list of URLs to refresh
  4. Confirm and submit the task

🚀 Quick Start

Prerequisites

  1. Volcengine CLI version >= 1.0.39(only this version and above support the CDN service)
  2. AK/SK and Region have been configured

Verify Environment

# 检查 CLI 版本
ve version

# 查看当前配置
ve configure list

Add Domain

Method 1: Use the interactive script (recommended)

bash scripts/add-cdn-domain.sh

Method 2: Use the quick script (command-line parameters)

# 格式: bash scripts/add-domain-quick.sh <域名> <源站> [源站2] [源站3] [权重1] [权重2] [权重3] [业务类型] [服务区域]
# 业务类型: web / download / video
# 服务区域: chinese_mainland (默认) / global

# 示例:添加网页加速域名(中国内地)
bash scripts/add-domain-quick.sh www.example.com 1.1.1.1 "" "" 100 "" "" web chinese_mainland

# 示例:添加网页加速域名(全球)
bash scripts/add-domain-quick.sh www.example.com 1.1.1.1 "" "" 100 "" "" web global

# 示例:添加视频点播域名
bash scripts/add-domain-quick.sh video.example.com 1.1.1.1 "" "" 100 "" "" video

Method 3: Use the command directly (basic version)

BODY='{
  "Domain": "www.example.com",
  "Origin": [
    {
      "OriginAction": {
        "OriginLines": [
          {
            "Address": "1.1.1.1",
            "InstanceType": "ip",
            "OriginType": "primary"
          }
        ]
      }
    }
  ],
  "Project": "default",
  "ServiceRegion": "chinese_mainland",
  "ServiceType": "download"
}'

ve cdn AddCdnDomain --body "$BODY"

Method 4: Use the recommended configuration command (recommended version)

Web acceleration example:

BODY='{
  "Domain": "www.example.com",
  "Origin": [
    {
      "OriginAction": {
        "OriginLines": [
          {
            "Address": "1.1.1.1",
            "InstanceType": "ip",
            "OriginType": "primary"
          }
        ]
      }
    }
  ],
  "Project": "default",
  "ServiceRegion": "chinese_mainland",
  "ServiceType": "web",
  "Cache": [
      {
        "CacheAction": {
          "Action": "cache",
          "IgnoreCase": false,
          "Ttl": 0,
          "DefaultPolicy": "no_cache"
        },
        "Condition": {
          "ConditionRule": [
            {
              "Object": "filetype",
              "Operator": "match",
              "Type": "url",
              "Value": "php;jsp;asp;aspx"
            }
          ]
        }
      },
      {
        "CacheAction": {
          "Action": "cache",
          "IgnoreCase": false,
          "Ttl": 2592000,
          "DefaultPolicy": "default"
        },
        "Condition": {
          "ConditionRule": [
            {
              "Object": "path",
              "Operator": "match",
              "Type": "url",
              "Value": "/*"
            }
          ]
        }
      }
    ],
    "Compression": {
      "Switch": true,
      "CompressionRules": [
        {
          "CompressionAction": {
            "CompressionType": ["gzip"],
            "CompressionFormat": "default",
            "CompressionTarget": "*",
            "MinFileSizeKB": 0
          }
        }
      ]
    },
  "PageOptimization": {
    "PageOptimizationAction": "on"
  }
}'

ve cdn AddCdnDomain --body "$BODY"

For recommended configurations for more business types, refer to Parameter Description。


📚 Detailed Documentation

Documentation Description
Parameter Description Complete API parameter description
Usage Scenario Examples 9 common usage scenario examples
FAQ FAQ frequently asked questions and answers
CLI Installation Guide Volcengine CLI installation and configuration guide

✅ Successful Response Example

{
  "ResponseMetadata": {
    "Action": "AddCdnDomain",
    "Region": "cn-guangzhou",
    "RequestId": "20260415170258108D89026C070556E439",
    "Service": "cdn",
    "Version": "2021-03-01"
  },
  "Result": {
    "ResourceIds": [
      "www.example.com"
    ]
  }
}

🔄 Refresh and Preload

Submit Preload Task

Method 1: Use the interactive script (recommended)

bash scripts/cdn-refresh-preload.sh
# 选择 1. 提交预热任务

Method 2: Use the quick script

# 格式: bash scripts/submit-preload.sh <url1> <url2> ...

# 示例:预热多个URL
bash scripts/submit-preload.sh https://www.example.com/1.jpg https://www.example.com/2.jpg

Method 3: Use the command directly

BODY='{
  "UrlList": [
    "https://www.example.com/1.jpg",
    "https://www.example.com/2.jpg"
  ]
}'

ve cdn SubmitPreloadTask --body "$BODY"

Submit Refresh Task

Method 1: Use the interactive script (recommended)

bash scripts/cdn-refresh-preload.sh
# 选择 2. 提交刷新任务

Method 2: Use the quick script

# 格式: bash scripts/submit-refresh.sh [--type <file|directory>] <url1> <url2> ...

# 示例:刷新文件(默认)
bash scripts/submit-refresh.sh https://www.example.com/1.jpg https://www.example.com/2.jpg

# 示例:刷新目录
bash scripts/submit-refresh.sh --type directory https://www.example.com/path/

Method 3: Use the command directly

Refresh file:

BODY='{
  "Type": "file",
  "UrlList": [
    "https://www.example.com/1.jpg",
    "https://www.example.com/2.jpg"
  ]
}'

ve cdn SubmitRefreshTask --body "$BODY"

Refresh directory:

BODY='{
  "Type": "directory",
  "UrlList": [
    "https://www.example.com/path/"
  ]
}'

ve cdn SubmitRefreshTask --body "$BODY"

📝 Steps After Adding a Domain

  1. Wait for it to take effect: After successful creation, the domain status will change from "Configuring" to "Running normally" (usually takes 1-5 minutes)

  2. Get the CNAME:

    # 可以通过控制台查看,或使用 CLI 查询
    ve cdn DescribeCdnConfig --Domain "www.example.com"
    
  3. Configure DNS: At your DNS provider, point the domain resolution to the CNAME

  4. Verify access: After DNS takes effect, test access


🔗 Related Documentation