返回顶部
d

digitaloceanDigitalOcean管理

Manage DigitalOcean resources via API — Droplets (create/destroy/resize/power), DNS zones and records, Spaces (object storage), Databases, Firewalls, Load Balancers, Kubernetes, and account/billing info.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,146
下载量
免费
免费
2
收藏
概述
安装方式
版本历史

digitalocean

DigitalOcean API 技能

以编程方式控制 DigitalOcean 基础设施:Droplet、DNS、数据库、存储、网络。

身份验证

需要 API 令牌。从以下地址获取:https://cloud.digitalocean.com/account/api/tokens

存储在 ~/.config/digitalocean/token 中(仅令牌,无换行):
bash
mkdir -p ~/.config/digitalocean
echo -n 你的API令牌 > ~/.config/digitalocean/token
chmod 600 ~/.config/digitalocean/token

快速参考

Droplet(虚拟机)

bash

列出所有 Droplet


python3 scripts/digitalocean.py droplets list

获取 Droplet 详情

python3 scripts/digitalocean.py droplets get

创建 Droplet

python3 scripts/digitalocean.py droplets create <名称> --region nyc1 --size s-1vcpu-1gb --image ubuntu-24-04-x64

电源操作

python3 scripts/digitalocean.py droplets power-on python3 scripts/digitalocean.py droplets power-off python3 scripts/digitalocean.py droplets reboot

调整 Droplet 大小

python3 scripts/digitalocean.py droplets resize --size s-2vcpu-4gb

快照

python3 scripts/digitalocean.py droplets snapshot --name backup-2024

销毁 Droplet

python3 scripts/digitalocean.py droplets destroy

DNS 管理

bash

列出域名


python3 scripts/digitalocean.py dns list

获取域名记录

python3 scripts/digitalocean.py dns records <域名>

添加记录

python3 scripts/digitalocean.py dns add <域名> --type A --name www --data 1.2.3.4 --ttl 300

更新记录

python3 scripts/digitalocean.py dns update <域名> --data 5.6.7.8

删除记录

python3 scripts/digitalocean.py dns delete <域名>

添加域名

python3 scripts/digitalocean.py dns create <域名>

防火墙

bash

列出防火墙


python3 scripts/digitalocean.py firewalls list

创建防火墙

python3 scripts/digitalocean.py firewalls create <名称> --inbound tcp:22:0.0.0.0/0 --inbound tcp:80:0.0.0.0/0 --inbound tcp:443:0.0.0.0/0

将 Droplet 添加到防火墙

python3 scripts/digitalocean.py firewalls add-droplet id> id>

Spaces(对象存储)

bash

列出 Spaces(需要 Spaces 密钥)


python3 scripts/digitalocean.py spaces list

创建 Space

python3 scripts/digitalocean.py spaces create <名称> --region nyc3

数据库

bash

列出数据库集群


python3 scripts/digitalocean.py databases list

获取数据库详情

python3 scripts/digitalocean.py databases get

账户与账单

bash

账户信息


python3 scripts/digitalocean.py account

余额

python3 scripts/digitalocean.py billing balance

账单历史

python3 scripts/digitalocean.py billing history

SSH 密钥

bash

列出 SSH 密钥


python3 scripts/digitalocean.py ssh-keys list

添加 SSH 密钥

python3 scripts/digitalocean.py ssh-keys add <名称> --key ssh-ed25519 AAAA...

镜像与快照

bash

列出可用镜像


python3 scripts/digitalocean.py images list

列出你的快照

python3 scripts/digitalocean.py images snapshots

删除快照

python3 scripts/digitalocean.py images delete

区域与规格

bash

列出区域


python3 scripts/digitalocean.py regions

列出 Droplet 规格

python3 scripts/digitalocean.py sizes

DNS 记录类型

支持的记录类型:

  • - A — IPv4 地址
  • AAAA — IPv6 地址
  • CNAME — 规范名称(别名)
  • MX — 邮件交换(需要优先级)
  • TXT — 文本记录
  • NS — 名称服务器
  • SRV — 服务记录
  • CAA — 证书颁发机构授权

常见工作流程

部署新服务器

bash

1. 创建 Droplet


python3 scripts/digitalocean.py droplets create myserver --region nyc1 --size s-1vcpu-2gb --image ubuntu-24-04-x64 --ssh-keys

2. 获取 IP 地址

python3 scripts/digitalocean.py droplets get

3. 添加 DNS 记录

python3 scripts/digitalocean.py dns add mydomain.com --type A --name @ --data

4. 设置防火墙

python3 scripts/digitalocean.py firewalls create web-server --inbound tcp:22:0.0.0.0/0 --inbound tcp:80:0.0.0.0/0 --inbound tcp:443:0.0.0.0/0 python3 scripts/digitalocean.py firewalls add-droplet id> id>

将 DNS 迁移到 DigitalOcean

bash

1. 添加域名


python3 scripts/digitalocean.py dns create example.com

2. 添加记录

python3 scripts/digitalocean.py dns add example.com --type A --name @ --data 1.2.3.4 python3 scripts/digitalocean.py dns add example.com --type CNAME --name www --data example.com.

3. 在注册商处更新名称服务器为:

ns1.digitalocean.com

ns2.digitalocean.com

ns3.digitalocean.com

直接 API 访问

对于脚本未覆盖的操作:
bash
TOKEN=$(cat ~/.config/digitalocean/token)
curl -H Authorization: Bearer $TOKEN \
-H Content-Type: application/json \
https://api.digitalocean.com/v2/droplets

API 文档

  • - 完整 API 参考:https://docs.digitalocean.com/reference/api/
  • API v2 基础 URL:https://api.digitalocean.com/v2/

常见 Droplet 规格

标识符vCPU内存磁盘月费
s-1vcpu-512mb-10gb1512MB10GB$4
s-1vcpu-1gb
1 | 1GB | 25GB | $6 | | s-1vcpu-2gb | 1 | 2GB | 50GB | $12 | | s-2vcpu-2gb | 2 | 2GB | 60GB | $18 | | s-2vcpu-4gb | 2 | 4GB | 80GB | $24 | | s-4vcpu-8gb | 4 | 8GB | 160GB | $48 |

常见区域

标识符位置
nyc1, nyc3纽约
sfo3
旧金山 | | ams3 | 阿姆斯特丹 | | sgp1 | 新加坡 | | lon1 | 伦敦 | | fra1 | 法兰克福 | | tor1 | 多伦多 | | blr1 | 班加罗尔 | | syd1 | 悉尼 |

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 digitalocean-1776328564 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 digitalocean-1776328564 技能

通过命令行安装

skillhub install digitalocean-1776328564

下载

⬇ 下载 digitalocean v1.0.0(免费)

文件大小: 5.97 KB | 发布时间: 2026-4-17 14:41

v1.0.0 最新 2026-4-17 14:41
DigitalOcean API Skill initial release.

- Manage DigitalOcean resources: droplets, DNS, databases, object storage (Spaces), firewalls, load balancers, Kubernetes, and more.
- Includes authentication guide, API token setup instructions, and detailed quick reference commands for all supported resources.
- Supports common workflows such as server deployment and DNS migration.
- Provides lists of supported regions, droplet sizes, and DNS record types.
- Direct API access instructions included for advanced usage.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部