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
- Check whether the CLI is installed
- If not installed: guides you to install and configure the Volcengine CLI
- If installed: check the CLI version (requires >= 1.0.39)
Phase 2: Requirements Collection
- Check required fields: accelerated domain, region, origin information, business type
- Use default values:
- Default region:
chinese_mainland(Chinese mainland) - Default project:
default
- Default region:
- 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
- Ask the user: when no default value can be found for required fields, guide the user to input
Phase 3: Add Domain
- After collecting complete information, execute the
ve cdn AddCdnDomaincommand - Display the execution results and next steps
📋 Refresh and Preload Process
Submit Preload Task:
- Select the preload operation
- Enter the list of URLs to preload
- Confirm and submit the task
Submit Refresh Task:
- Select the refresh operation
- Select the refresh type (file/directory)
- Enter the list of URLs to refresh
- Confirm and submit the task
🚀 Quick Start
Prerequisites
- Volcengine CLI version >= 1.0.39(only this version and above support the CDN service)
- 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
-
Wait for it to take effect: After successful creation, the domain status will change from "Configuring" to "Running normally" (usually takes 1-5 minutes)
-
Get the CNAME:
# 可以通过控制台查看,或使用 CLI 查询 ve cdn DescribeCdnConfig --Domain "www.example.com" -
Configure DNS: At your DNS provider, point the domain resolution to the CNAME
-
Verify access: After DNS takes effect, test access