Files
arvan-cli/README.md
2026-02-13 22:52:32 +03:30

2.6 KiB
Raw Permalink Blame History

ArvanCloud CDN CLI Tool

A lightweight Python CLI utility for managing DNS records and domains on ArvanCloud CDN via its public API.

Designed for DevOps engineers, SREs, and system administrators who need fast DNS automation directly from Linux CLI.


📦 Requirements

  • Python 3.7+
  • requests library

Install dependency:

pip install requests

📁 Project Structure

.
├── arvan_cdn_cli.py
└── README.md

🖥 How to Use as a Default Linux Command

Instead of running:

python arvan_cdn_cli.py ...

You can make it a global Linux command.


Step 1 — Make Script Executable

Ensure the shebang exists at the top (already included):

#!/bin/python3

Make it executable:

chmod +x arvan_cdn_cli.py

Step 2 — Move to System Path

Move the file to /usr/local/bin:

sudo mv arvan_cdn_cli.py /usr/local/bin/arvanctl

Now you can run it globally:

arvanctl cdn domains

Optional: Verify PATH

Check if /usr/local/bin exists in PATH:

echo $PATH

If not, add it to ~/.bashrc:

export PATH=$PATH:/usr/local/bin

Then reload:

source ~/.bashrc

📌 Usage

General syntax:

arvanctl cdn <resource> <action> [options]

🔹 Commands

1 List All Domains

arvanctl cdn domains

Example Output:

{
  "example.com": {
    "name": "example.com",
    "status": "active"
  }
}

2 Create DNS Record

arvanctl cdn records create \
  --domain example.com \
  --name api \
  --ip 192.168.1.10 \
  --ttl 120 \
  --cloud

Parameters

Parameter Required Default Description
--domain - Target domain
--name - Record name
--type a Record type
--ttl 120 TTL value
--ip - IP address
--cloud False Enable Arvan proxy

3 Remove DNS Record

arvanctl cdn records remove \
  --domain example.com \
  --name api

4 Update DNS Record

arvanctl cdn records update \
  --domain example.com \
  --name api \
  --ip 192.168.1.20

⚠️ Update logic is partially implemented in current version.


🌐 API Endpoints Used

GET    /cdn/4.0/domains
GET    /cdn/4.0/domains/{domain}/dns-records
POST   /cdn/4.0/domains/{domain}/dns-records
DELETE /cdn/4.0/domains/{domain}/dns-records/{id}