ctyun-cli-天翼云-命令行

Polar Sponsor
爱发电 赞助
.NET 9.0

天翼云CLI工具——企业级命令行工具,轻松管理天翼云资源。支持ECS、VPC、EBS、ELB、CCE、Redis、Kafka、CSS、EMR、监控、账务、IAM、Aone、CloudPC、AIServer等17大服务模块,覆盖397+ API、383+ 命令。

天翼云 CLI (ctyun-cli)

功能概述

天翼云 CLI (ctyun-cli)是一项面向实际任务的技能,主要用于天翼云 CLI 工具,功能强大的企业级命令行工具,帮助您轻松管理天翼云资源;支持云服务器(ECS)、监控告警、安全防护、Redis分布式缓存、弹性负载均衡(ELB)、容器引擎(CCE)、VPC网络、费用查询等核心功能;

核心要点

  • 规模统计: 55,000+行代码,650+个API,580+个命令,29+大服务模块;
  • 使用 pip 安装(推荐);
  • 使用 pipx。

使用与执行

它将相关步骤、工具调用和结果整理方式集中到统一流程中,帮助使用者更快完成目标并减少重复操作。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。

结果检查与注意事项

执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。该技能适合用于一次性任务,也可以接入自动化工作流,与其他技能或上层代理配合完成更完整的业务链路;在组合使用时,应明确每一步的输入输出关系,并避免不同步骤之间出现参数冲突。

天翼云 CLI (ctyun-cli)

天翼云 CLI 工具,功能强大的企业级命令行工具,帮助您轻松管理天翼云资源。支持云服务器(ECS)、监控告警、安全防护、Redis分布式缓存、弹性负载均衡(ELB)、容器引擎(CCE)、VPC网络、费用查询等核心功能。

规模统计: 55,000+行代码,650+个API,580+个命令,29+大服务模块

安装

使用 pip 安装(推荐)

pip install ctyun-cli

使用 pipx 安装(隔离环境)

pipx install ctyun-cli

从源码安装

git clone https://github.com/fengyucn/ctyun-cli.git
cd ctyun-cli
pip install -e .

验证安装

ctyun-cli --version
ctyun-cli --help

配置与认证

方式一:环境变量(推荐,更安全)

export CTYUN_ACCESS_KEY=your_access_key
export CTYUN_SECRET_KEY=your_secret_key

将上述命令添加到 ~/.bashrc 或 ~/.zshrc 以实现永久配置。

方式二:交互式配置

ctyun-cli configure --access-key YOUR_ACCESS_KEY --secret-key YOUR_SECRET_KEY --region cn-north-1

查看当前配置

ctyun-cli show-config

列出所有配置文件

ctyun-cli list-profiles

测试 API 连接

ctyun-cli test

全局选项

所有命令都支持以下全局选项:

  • --profile TEXT: 指定配置文件名称
  • --access-key TEXT: 访问密钥
  • --secret-key TEXT: 密钥
  • --region TEXT: 区域
  • --endpoint TEXT: API 端点
  • --output [table|json|yaml]: 输出格式(默认 table)
  • --debug: 启用调试模式

云服务器 (ECS) 管理

列出云主机实例

ctyun-cli ecs list
ctyun-cli ecs list --region cn-north-1 --output json

查询云主机详情

ctyun-cli ecs detail --instance-id YOUR_INSTANCE_ID

查询多台云主机详细信息

ctyun-cli ecs multidetail --instance-ids ID1,ID2,ID3

查询云主机统计信息

ctyun-cli ecs statistics

查询资源池列表

ctyun-cli ecs regions

订单询价

ctyun-cli ecs query-price --flavor-id FLAVOR_ID --quantity 1

资源续订询价

ctyun-cli ecs renew-price --region-id REGION_ID --resource-type VM --resource-uuid RESOURCE_UUID --cycle-type MONTH --cycle-count 1

虚拟私有云 (VPC) 管理

列出 VPC

ctyun-cli vpc list
ctyun-cli vpc new-list

查询 VPC 详情

ctyun-cli vpc show --vpc-id YOUR_VPC_ID

子网查询

ctyun-cli vpc subnet --vpc-id YOUR_VPC_ID

安全组查询

ctyun-cli vpc security --vpc-id YOUR_VPC_ID

路由表查询

ctyun-cli vpc route-table --vpc-id YOUR_VPC_ID

弹性公网 IP 查询

ctyun-cli vpc eip

NAT 网关查询

ctyun-cli vpc nat-gateway

VPC 对等连接查询

ctyun-cli vpc peering

流日志查询

ctyun-cli vpc flow-log

云硬盘 (EBS) 管理

列出云硬盘

ctyun-cli ebs list
ctyun-cli ebs list --region cn-north-1 --output json

弹性负载均衡 (ELB) 管理

负载均衡器管理

ctyun-cli elb loadbalancer --help
ctyun-cli elb loadbalancer list

监听器管理

ctyun-cli elb listener --help

目标组管理

ctyun-cli elb targetgroup --help

健康检查管理

ctyun-cli elb health-check --help

监控数据管理

ctyun-cli elb monitor --help

保障型负载均衡询价

# 创建询价
ctyun-cli elb pgelb-create-price --region-id REGION_ID --subnet-id SUBNET_ID --name my-elb --sla-name elb.s2.small --resource-type internal --cycle-type month --cycle-count 1

# 续订询价
ctyun-cli elb pgelb-renew-price --region-id REGION_ID --elb-id ELB_ID --cycle-type month --cycle-count 1

# 变配询价
ctyun-cli elb pgelb-modify-price --region-id REGION_ID --elb-id ELB_ID --sla-name elb.s3.small

ELB 查询类 API(19个)

# 访问控制
ctyun-cli elb list-access-controls --region-id REGION_ID
ctyun-cli elb show-access-control --region-id REGION_ID --access-control-id AC_ID

# 规格/证书
ctyun-cli elb list-sla --region-id REGION_ID
ctyun-cli elb list-certificates --region-id REGION_ID
ctyun-cli elb show-certificate --region-id REGION_ID --certificate-id CERT_ID
ctyun-cli elb list-domain-cert-links --region-id REGION_ID

# 转发规则/健康检查
ctyun-cli elb list-rules --region-id REGION_ID --listener-id LISTENER_ID
ctyun-cli elb show-rule --region-id REGION_ID --policy-id POLICY_ID
ctyun-cli elb list-health-checks --region-id REGION_ID

# 旧版监控
ctyun-cli elb legacy-history-monitor --region-id REGION_ID --device-ids '["ID"]' --metric-names '["metric"]' --start-time 2026-07-01 --end-time 2026-07-17
ctyun-cli elb legacy-realtime-monitor --region-id REGION_ID

# GWLB 网关负载均衡
ctyun-cli elb list-gwlb --region-id REGION_ID
ctyun-cli elb show-gwlb --region-id REGION_ID --gwlb-id GWLB_ID
ctyun-cli elb gwlb-list-targets --region-id REGION_ID
ctyun-cli elb gwlb-show-target --region-id REGION_ID
ctyun-cli elb gwlb-list-target-groups --region-id REGION_ID
ctyun-cli elb gwlb-show-target-group --region-id REGION_ID

# IP 监听器
ctyun-cli elb list-ip-listeners --region-id REGION_ID
ctyun-cli elb show-ip-listener --region-id REGION_ID

# 标签
ctyun-cli elb list-labels --region-id REGION_ID --elb-id ELB_ID

容器引擎 (CCE) 管理

列出集群

ctyun-cli cce list-clusters

查询集群详情

ctyun-cli cce describe-cluster --cluster-id YOUR_CLUSTER_ID

获取 Kubeconfig

ctyun-cli cce get-kubeconfig --cluster-id YOUR_CLUSTER_ID

列出节点

ctyun-cli cce list-nodes --cluster-id YOUR_CLUSTER_ID

查询节点详情

ctyun-cli cce get-node-detail --cluster-id CLUSTER_ID --node-id NODE_ID

列出 Pod

ctyun-cli cce list-pods --cluster-id CLUSTER_ID

列出 Deployment

ctyun-cli cce list-deployments --cluster-id CLUSTER_ID

列出 Service

ctyun-cli cce list-services --cluster-id CLUSTER_ID

集群日志管理

ctyun-cli cce logs --help

节点池管理

ctyun-cli cce nodepool --help

弹性伸缩管理

ctyun-cli cce autoscaling --help

ConfigMap 管理

ctyun-cli cce configmap --help

标签管理

ctyun-cli cce tag --help

Namespace 命名空间管理

# 列出命名空间
ctyun-cli cce namespace list --cluster-id CLUSTER_ID --region-id REGION_ID

# 查询命名空间详情
ctyun-cli cce namespace show --cluster-id CLUSTER_ID --namespace-name default --region-id REGION_ID

# 创建命名空间
ctyun-cli cce namespace create --cluster-id CLUSTER_ID --region-id REGION_ID --namespace-yaml "apiVersion: v1
kind: Namespace
metadata:
  name: my-namespace"

# 更新命名空间
ctyun-cli cce namespace update --cluster-id CLUSTER_ID --namespace-name my-namespace --region-id REGION_ID --namespace-yaml "apiVersion: v1
kind: Namespace
metadata:
  name: my-namespace
  labels:
    env: production"

# 删除命名空间
ctyun-cli cce namespace delete --cluster-id CLUSTER_ID --namespace-name my-namespace --region-id REGION_ID

Redis 分布式缓存服务

列出 Redis 实例

ctyun-cli redis list

查询实例详情

ctyun-cli redis describe --instance-id YOUR_INSTANCE_ID
ctyun-cli redis describe -i YOUR_INSTANCE_ID -f table

查询实例网络信息

ctyun-cli redis network --instance-id YOUR_INSTANCE_ID
ctyun-cli redis network -i YOUR_INSTANCE_ID --region-id RESOURCE_POOL_ID

查询实例逻辑拓扑

ctyun-cli redis topology --instance-id YOUR_INSTANCE_ID

批量查询集群节点信息

ctyun-cli redis cluster-nodes
ctyun-cli redis cluster-nodes --page 1 --size 20

创建 Redis 实例

ctyun-cli redis create-instance --help

查询可用区

ctyun-cli redis zones

查询引擎版本

ctyun-cli redis engine-version --instance-id INSTANCE_ID
ctyun-cli redis instance-version --instance-id INSTANCE_ID

监控数据查询

ctyun-cli redis monitor-history --instance-id INSTANCE_ID

诊断服务

ctyun-cli redis diagnose --instance-id INSTANCE_ID

客户端连接管理

ctyun-cli redis clients --instance-id INSTANCE_ID

节点列表查询

ctyun-cli redis node-list --prod-inst-id INSTANCE_ID --region-id REGION_ID

日志下载

ctyun-cli redis log-download --prod-inst-id INSTANCE_ID --node-name NODE_NAME --date 2026-06-23

副本状态查询

ctyun-cli redis replication-state --prod-inst-id INSTANCE_ID --fragment-name redis-0

租户标签查询

ctyun-cli redis labels --region-id REGION_ID
ctyun-cli redis labels -r REGION_ID --label-key APPNAME

运行日志查询

ctyun-cli redis running-logs --prod-inst-id INSTANCE_ID --node-name NODE_NAME

实例账号查询

ctyun-cli redis accounts --prod-inst-id INSTANCE_ID

费用查询(询价)

# 订购询价
ctyun-cli redis price --order-type BUY --charge-type PrePaid --period 1 --edition DirectCluster --shard-mem-size 1 --shard-count 3 --engine-version 6.0 --capacity 3

# 变配询价
ctyun-cli redis price --order-type EXPANSION --prod-inst-id INSTANCE_ID

Redis 查询类 API 扩展(52+ 个)

实例生命周期与统计

# 回收站实例
ctyun-cli redis recycle-bin --region-id REGION_ID
ctyun-cli redis running-statistics --region-id REGION_ID
ctyun-cli redis quota --region-id REGION_ID
ctyun-cli redis dedicated-cluster-instances --region-id REGION_ID
ctyun-cli redis export-task --task-id TASK_ID --region-id REGION_ID
ctyun-cli redis auto-renew -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis can-expand -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis maintain-time -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis maintain-az -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis port-modify-range -i INSTANCE_ID --region-id REGION_ID

备份恢复

ctyun-cli redis backups -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis backup-tasks -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis backup-policy -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis backup-download-url -i INSTANCE_ID --restore-name BACKUP_NAME --ip-type publicIp --region-id REGION_ID
ctyun-cli redis data-flashback -i INSTANCE_ID --region-id REGION_ID

安全与 SSL

ctyun-cli redis ssl -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis security-ips -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis rename-command -i INSTANCE_ID --region-id REGION_ID

命令与日志监控

ctyun-cli redis slow-log -i INSTANCE_ID --node-name NODE_NAME --region-id REGION_ID
ctyun-cli redis slow-log-history -i INSTANCE_ID --node-name NODE_NAME --start-time '2026-07-20 08:00:00' --end-time '2026-07-20 10:00:00' --region-id REGION_ID
ctyun-cli redis command-audit-status -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis monitor-items-v2 -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis node-monitor-values -i INSTANCE_ID --type string --node-name NODE_NAME --start-time '...' --end-time '...' --region-id REGION_ID
ctyun-cli redis node-command-list -i INSTANCE_ID --node-name NODE_NAME --start-time '...' --end-time '...' --region-id REGION_ID
ctyun-cli redis node-command-monitor -i INSTANCE_ID --node-name NODE_NAME --start-time '...' --end-time '...' --type redis_latency_insight_max --region-id REGION_ID
ctyun-cli redis hit-rate -i INSTANCE_ID --node-name NODE_NAME --region-id REGION_ID

会话与客户端

ctyun-cli redis client-map -i INSTANCE_ID --node-name NODE_NAME --region-id REGION_ID

参数与模板管理

ctyun-cli redis instance-config-v3 -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis param-history -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis templates --type sys --region-id REGION_ID
ctyun-cli redis templates --type custom --region-id REGION_ID
ctyun-cli redis template-detail --template-id TEMPLATE_ID --region-id REGION_ID

Key 管理与分析

ctyun-cli redis dbkey-count -i INSTANCE_ID --groups 1 --region-id REGION_ID
ctyun-cli redis auto-scan-conf -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis scan-logs -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis eviction-strategy -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis big-and-hot-keys -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis big-hot-key-history -i INSTANCE_ID --node-name NODE_NAME --start-time '...' --end-time '...' --region-id REGION_ID

大key/热key 分析工具

ctyun-cli redis big-key-tasks -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis hot-key-tasks -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis big-key-policy -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis hot-key-policy -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis key-task-record -i INSTANCE_ID --task-id TASK_ID --region-id REGION_ID
ctyun-cli redis diagnosis-tasks -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis offline-key-analysis-list -i INSTANCE_ID --region-id REGION_ID
ctyun-cli redis offline-key-analysis-info -i INSTANCE_ID --task-id TASK_ID --region-id REGION_ID

数据迁移与任务中心

ctyun-cli redis transfer-tasks --page-num 1 --page-size 10 --region-id REGION_ID
ctyun-cli redis transfer-task-info --task-id TASK_ID --region-id REGION_ID
ctyun-cli redis transfer-progress --task-id TASK_ID --region-id REGION_ID
ctyun-cli redis transfer-running-log --task-id TASK_ID --search-date 2026-07-20 --region-id REGION_ID
ctyun-cli redis task-center-list --start-time 20260701 --end-time 20260720 --status -1 --region-id REGION_ID
ctyun-cli redis task-center-info --task-id TASK_ID --region-id REGION_ID

混沌工程故障查询

ctyun-cli redis experiments -i INSTANCE_ID --region-id REGION_ID

云监控服务管理

查询监控数据

ctyun-cli monitor list

查询告警规则

ctyun-cli monitor query-alarm-rules

查询告警历史

ctyun-cli monitor query-alert-history

查询资源组

ctyun-cli monitor query-resource-groups

自定义监控指标查询

ctyun-cli monitor query-custom-trend

CPU Top 排名

ctyun-cli monitor cpu-top

内存 Top 排名

ctyun-cli monitor mem-top

磁盘 Top 排名

ctyun-cli monitor disk-top

数据订阅管理

ctyun-cli monitor query-message-subscription
ctyun-cli monitor describe-message-subscription

通知套餐管理

ctyun-cli monitor notice-pack-list
ctyun-cli monitor notice-pack-used
ctyun-cli monitor notice-pack-limit-detail

监控看板

ctyun-cli monitor list-monitor-board
ctyun-cli monitor query-monitor-board-sys-services
ctyun-cli monitor query-monitor-board-view-data

监控对象资源列表

ctyun-cli monitor query-ecs-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-pms-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-evs-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-eip-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-traffic-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-elb-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-listener-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-scaling-group-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-zos-user-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-zos-bucket-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-vpc-endpoint-list --region-id RESOURCE_POOL_ID
ctyun-cli monitor query-vpc-endpoint-service-list --region-id RESOURCE_POOL_ID

设备类型监控项查询

ctyun-cli monitor query-monitor-items-by-device --region-id RESOURCE_POOL_ID

数据导出任务管理

# 查询数据导出任务列表
ctyun-cli monitor data-export-tasks --region-id REGION_ID

# 创建数据导出任务
ctyun-cli monitor create-data-export-task --region-id REGION_ID --task-name my-task

# 删除数据导出任务
ctyun-cli monitor delete-data-export-task --region-id REGION_ID --task-ids TASK_ID1,TASK_ID2

# 下载导出文件
ctyun-cli monitor download-data-export-task --region-id REGION_ID --task-id TASK_ID

拨测管理

# 查询拨测点列表
ctyun-cli monitor query-detection-point

# 查询即时拨测任务结果
ctyun-cli monitor query-instant-detection-task --task-id TASK_ID --detect-type http

账务中心管理

消费类型汇总

ctyun-cli billing bill-summary 202606

账户账单(按账户ID)

ctyun-cli billing account-bill 202606 --account-id ACCOUNT_ID

账单详情(按账单ID)

ctyun-cli billing bill-detail BILL_ID

包周期流水账单

ctyun-cli billing cycle-flow 202606 --page-size 10

包周期订单账单详情

ctyun-cli billing cycle-bill 202606 --page-size 10

包周期账单明细(按产品汇总)

ctyun-cli billing cycle-product 202606

按需流水账单

ctyun-cli billing ondemand-flow 202606 --page-size 10

按需账单明细(按产品汇总)

ctyun-cli billing ondemand-product 202606

按需账单明细(资源+明细)

ctyun-cli billing bill-list 202606 --page-size 10

按需账单明细(资源+账期)

ctyun-cli billing ondemand-resource-cycle 202606

按需账单明细(使用量类型+账期)

ctyun-cli billing ondemand-usage 202606

按需账单明细(使用量类型+明细)

ctyun-cli billing ondemand-detail 202606

统一身份认证 (IAM) 管理

查询企业项目列表

ctyun-cli iam list-projects

查询企业项目详情

ctyun-cli iam get-project --project-id PROJECT_ID

分页查询资源信息

ctyun-cli iam list-resources

服务器安全卫士

查看使用示例

ctyun-cli security examples

主机防护

ctyun-cli security wrapper --help

防篡改更新

ctyun-cli security tamper-update --help

服务器安全卫士(原生版)

服务器管理

# 服务器列表
ctyun-cli csscn list --size 20

# 服务器详情
ctyun-cli csscn describe --agent-guid AGENT_GUID

安全总览统计

# 待处理风险统计
ctyun-cli csscn risk-stats

# 服务器统计
ctyun-cli csscn server-stats

# Agent防护状态统计
ctyun-cli csscn agent-stats

# Agent在线/离线分布
ctyun-cli csscn agent-distribution

# 漏洞统计
ctyun-cli csscn vuln-stats

安全事件查询

# 告警列表
ctyun-cli csscn alarms --time-type LAST_ONE_WEEK --severity 3

# 病毒事件列表
ctyun-cli csscn viruses --os-type 3 --time-type LAST_ONE_MONTH

配额管理

ctyun-cli csscn quotas --version 3 --size 20

关系数据库MySQL版 (RDS)

查询实例列表

ctyun-cli ctmysql list --region-id REGION_ID --page-size 10
ctyun-cli ctmysql list --region-id REGION_ID --engine 8.0 --name mysql-prod

实例标签管理

# 绑定标签
ctyun-cli ctmysql batch-label --region-id REGION_ID --action bind --instance-ids ID1,ID2 --label env=prod

# 解绑标签
ctyun-cli ctmysql batch-label --region-id REGION_ID --action unbind --instance-ids ID1 --label env=prod

监控数据查询

ctyun-cli ctmysql batch-monitor --region-id REGION_ID --instance-ids ID1,ID2 --metric mysql_monitor_tcp_states --period 60 --last-hours 1

询价

# 新建实例询价
ctyun-cli ctmysql inquiry --region-id REGION_ID --project-id 0 --bill-mode 1 --prod-version 5.7 --host-type S7 --period 1 --count 1 --auto-renew 0 --prod-id 10001003 --node-type master --inst-spec 1 --storage-type SATA --storage-space 100 --perf-spec 2C4G --az-name AZ_NAME

# 变更实例询价(磁盘扩容)
ctyun-cli ctmysql inquiry-upgrade --region-id REGION_ID --project-id 0 --inst-id INSTANCE_ID --disk-volume 200 --node-type master

# 续费询价
ctyun-cli ctmysql inquiry-renew --region-id REGION_ID --inst-id INSTANCE_ID --month 1

云专线 (CDA) 管理

物理专线管理

ctyun-cli cda physical-line --help

专线网关管理

ctyun-cli cda gateway --help

VPC 管理

ctyun-cli cda vpc --help

BGP 路由管理

ctyun-cli cda bgp-route --help

静态路由管理

ctyun-cli cda static-route --help

健康检查和链路探测管理

ctyun-cli cda health-check --help

跨账号授权管理

ctyun-cli cda account-auth --help

分布式消息服务 (Kafka) 管理

查询实例列表

ctyun-cli kafka list --region-id RESOURCE_POOL_ID
ctyun-cli kafka list -r xxx --name test --exact-match
ctyun-cli kafka list -r xxx --status 1 --page 1 --size 20

查看实例节点状态

ctyun-cli kafka node-status --region-id RESOURCE_POOL_ID --instance-id INSTANCE_ID

查询弹性IP列表

ctyun-cli kafka floating-ips --region-id RESOURCE_POOL_ID

获取实例配置

ctyun-cli kafka config --region-id RESOURCE_POOL_ID --instance-id INSTANCE_ID

云搜索服务 (CSS) 管理

查询实例列表

ctyun-cli css list --region-id RESOURCE_POOL_ID --type 1
ctyun-cli css list -r xxx --name test

查询实例详情

ctyun-cli css describe --cluster-id CLUSTER_ID

查询 Logstash 实例列表

ctyun-cli css logstash-list --region-id RESOURCE_POOL_ID

翼 MapReduce (EMR) 管理

查询集群列表

ctyun-cli emr list --region-id RESOURCE_POOL_ID
ctyun-cli emr list -r xxx --name test --v2

查询集群详情

ctyun-cli emr describe --cluster-id CLUSTER_ID
ctyun-cli emr describe --cluster-id CLUSTER_ID --v2

查询节点组信息

ctyun-cli emr node-groups --cluster-id CLUSTER_ID
ctyun-cli emr node-groups --cluster-id CLUSTER_ID --v2

查询节点组详情

ctyun-cli emr node-detail --cluster-id CLUSTER_ID
ctyun-cli emr node-detail --cluster-id CLUSTER_ID --node-state 8

查询 Hive 元数据概览

ctyun-cli emr meta-overview --cluster-id CLUSTER_ID

查询 Hive 表元数据

ctyun-cli emr meta-table --cluster-id CLUSTER_ID --database test_db --table test_table

云日志服务 (LTS) 管理

ctyun-cli lts --help

弹性文件服务 (SFS) 管理

ctyun-cli sfs --help

海量文件服务 (OceanFS) 管理

ctyun-cli oceanfs --help
ctyun-cli oceanfs renew-price --region-id REGION_ID --sfs-uid FS_ID --cycle-type month --cycle-cnt 1
ctyun-cli oceanfs upgrade-price --region-id REGION_ID --sfs-uid FS_ID --sfs-size 100

对象存储 (ZOS) 管理

桶管理查询

# 查询所有桶
ctyun-cli zos list-buckets --region-id REGION_ID

# 桶信息/位置/统计
ctyun-cli zos get-bucket-info --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-location --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-statistics --region-id REGION_ID --bucket BUCKET

# 桶配置查询
ctyun-cli zos get-bucket-acl --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-encryption --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-lifecycle --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-logging --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-policy --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-versioning --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-bucket-tagging --region-id REGION_ID --bucket BUCKET
ctyun-cli zos head-bucket --region-id REGION_ID --bucket BUCKET

对象管理查询

# 对象列表/版本/分段
ctyun-cli zos list-objects --region-id REGION_ID --bucket BUCKET
ctyun-cli zos list-object-versions --region-id REGION_ID --bucket BUCKET
ctyun-cli zos list-multipart-uploads --region-id REGION_ID --bucket BUCKET
ctyun-cli zos list-all-parts --region-id REGION_ID --bucket BUCKET
ctyun-cli zos list-parts --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY --upload-id UPLOAD_ID

# 对象详情/ACL/标签
ctyun-cli zos head-object --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY
ctyun-cli zos get-object-acl --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY
ctyun-cli zos get-object-tagging --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY
ctyun-cli zos get-object-retention --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY

# 碎片/数量
ctyun-cli zos get-fragment-num --region-id REGION_ID --bucket BUCKET
ctyun-cli zos get-object-num --region-id REGION_ID --bucket BUCKET

IAM/资源/服务管理

ctyun-cli zos get-keys --region-id REGION_ID
ctyun-cli zos get-endpoint --region-id REGION_ID
ctyun-cli zos list-regions --region-id REGION_ID
ctyun-cli zos get-service-status --region-id REGION_ID
ctyun-cli zos list-policies --region-id REGION_ID
ctyun-cli zos get-policy-detail --region-id REGION_ID --policy-id POLICY_ID
ctyun-cli zos list-roles --region-id REGION_ID
ctyun-cli zos get-role-detail --region-id REGION_ID --role-id ROLE_ID
ctyun-cli zos get-user-event-bridge --region-id REGION_ID
ctyun-cli zos get-object-lock-conf --region-id REGION_ID --bucket BUCKET

标签管理

# 设置/查询/删除桶标签
ctyun-cli zos put-bucket-tagging --region-id REGION_ID --bucket BUCKET --tag key1=value1 --tag key2=value2
ctyun-cli zos get-bucket-tagging --region-id REGION_ID --bucket BUCKET
ctyun-cli zos delete-bucket-tagging --region-id REGION_ID --bucket BUCKET

# 设置/查询/删除对象标签
ctyun-cli zos put-object-tagging --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY --tag env=prod
ctyun-cli zos get-object-tagging --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY
ctyun-cli zos delete-object-tagging --region-id REGION_ID --bucket BUCKET --key OBJECT_KEY

询价

ctyun-cli zos query-price --region-id REGION_ID --pkg-type zosSize --pkg-spec-type ...

应用性能监控 (APM) 管理

终端节点 arms-global.ctapi.ctyun.cn,regionId 通过 header 传递。共 44 个查询类命令,分 8 个子组。

基础配置与元数据

ctyun-cli apm meta project-metadata --region-id REGION_ID
ctyun-cli apm meta env-types --region-id REGION_ID
ctyun-cli apm meta envs --region-id REGION_ID
ctyun-cli apm meta app-conf --region-id REGION_ID --service-name APP --project-code PROJ --deployment ENV
ctyun-cli apm meta license-key --region-id REGION_ID
ctyun-cli apm meta monitor-status --region-id REGION_ID --environment-code ENV_CODE
ctyun-cli apm meta default-jobs --region-id REGION_ID --environment-code ENV_CODE
ctyun-cli apm meta common-labels --region-id REGION_ID --environment-code ENV_CODE

应用与实例管理

ctyun-cli apm app list --region-id REGION_ID
ctyun-cli apm app transaction-types --region-id REGION_ID
ctyun-cli apm app agents --region-id REGION_ID --agent-status 1
ctyun-cli apm app env-instances --region-id REGION_ID --env-type CS
ctyun-cli apm app tasks --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --deployment ENV --env-uuid ENV_UUID
ctyun-cli apm app instances-stat --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP

调用链与拓扑

ctyun-cli apm trace detail --region-id REGION_ID --trace-id TRACE_ID
ctyun-cli apm trace span-detail --region-id REGION_ID --trace-id TRACE_ID --span-id SPAN_ID
ctyun-cli apm trace list --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm trace topology --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP

性能监控数据

ctyun-cli apm perf overview --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf request-curve --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf http-code-curve --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf slow-transactions --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf exceptions --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf sql-stat-page --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP --db-types mysql
ctyun-cli apm perf sql-stat-histogram --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf nosql-stat-histogram --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf nosql-stat-page --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf mq-stat-page --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf transaction-stat --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf jvm-info --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf app-instance-curve --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf jvm-gc-count --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP
ctyun-cli apm perf jvm-thread-count --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --service-name APP

用量统计

ctyun-cli apm usage total-view --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201
ctyun-cli apm usage span-report --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --step 3600
ctyun-cli apm usage agent-hour --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --step 3600
ctyun-cli apm usage span-store --region-id REGION_ID --start-time 1715656183201 --end-time 1716174583201 --step 3600

告警/通知/Webhook 管理

# 告警规则
ctyun-cli apm alert rules --region-id REGION_ID --obj-type ctgcache
ctyun-cli apm alert rule-templates --region-id REGION_ID --obj-type ctgcache
ctyun-cli apm alert send-history --region-id REGION_ID --page-num 1 --page-size 10

# 通知管理
ctyun-cli apm notify contacts --region-id REGION_ID --page-num 1 --page-size 10
ctyun-cli apm notify contact-groups --region-id REGION_ID --page-num 1 --page-size 10
ctyun-cli apm notify strategies --region-id REGION_ID --page-num 1 --page-size 10

# Webhook
ctyun-cli apm webhook list --region-id REGION_ID --page-num 1 --page-size 10

物理机 (DPS) 管理

查询操作系统列表

ctyun-cli dps list-os --region-id REGION_ID --az-name AZ_NAME

批量查询物理机列表

ctyun-cli dps list --region-id REGION_ID --az-name AZ_NAME
ctyun-cli dps list --region-id REGION_ID --az-name AZ_NAME --status RUNNING --page-size 20

查询单台物理机详情

ctyun-cli dps describe --region-id REGION_ID --az-name AZ_NAME --instance-uuid INSTANCE_UUID

查询物理机网卡信息

ctyun-cli dps interfaces --region-id REGION_ID --az-name AZ_NAME --instance-uuid INSTANCE_UUID

查询挂载卷ID列表

ctyun-cli dps volumes --region-id REGION_ID --az-name AZ_NAME --instance-uuid INSTANCE_UUID

查询镜像信息

ctyun-cli dps image --region-id REGION_ID --az-name AZ_NAME --instance-uuid INSTANCE_UUID

查询元数据

ctyun-cli dps metadata --region-id REGION_ID --az-name AZ_NAME --instance-uuid INSTANCE_UUID

查询物理机库存

ctyun-cli dps stock --region-id REGION_ID --az-name AZ_NAME
ctyun-cli dps stock --region-id REGION_ID --az-name AZ_NAME --device-type physical.t3.large --count 2

边缘安全加速平台 (Aone) 管理

ctyun-cli aone --help

网络管理

ctyun-cli network --help

存储管理

ctyun-cli storage --help

缓存管理

清空所有缓存

ctyun-cli clear-cache

使用技巧

JSON 输出便于脚本处理

ctyun-cli ecs list --output json | jq '.[] | select(.status=="running")'

YAML 输出便于阅读

ctyun-cli vpc show --vpc-id vpc-xxx --output yaml

调试模式排查问题

ctyun-cli ecs list --debug

使用指定配置文件

ctyun-cli ecs list --profile production

注意事项

  1. 首次使用前必须先配置认证信息(推荐使用环境变量方式)
  2. 大部分命令需要指定资源 ID(如 instance-id、vpc-id 等)
  3. 建议使用 --help 查看具体子命令的详细参数
  4. 使用 JSON 输出格式便于与其他工具集成
  5. 按需查询大量数据时建议分页或使用过滤参数

相关链接

  • PyPI 包: https://pypi.org/project/ctyun-cli/
  • GitHub 仓库: https://github.com/fengyucn/ctyun-cli
  • 问题反馈: https://github.com/fengyucn/ctyun-cli/issues
  • 作者邮箱: popfrog@gmail.com

版本信息

  • 当前版本: v1.26.0 (2026-07-20)
  • 开源协议: MIT
  • Python 要求: Python 3.8+
  • API 覆盖: 650+ 个 API
  • 命令数量: 580+ 个命令
  • 服务模块: 29+ 大服务模块
  • 最新功能:
    • 🚀 Redis 查询类 API 全面扩充:新增 52 个查询命令,Redis 模块从 33 个扩展到 85 个命令
      • 实例生命周期/回收站/配额/专属集群、备份恢复/数据闪回、SSL/IP白名单/危险命令重命名
      • 慢日志/审计日志/节点命令监控/命中率分析、参数模板(V3)/修改历史
      • 大key/热key/离线全量key分析、过期key扫描、淘汰策略、数据迁移进度/日志、任务中心、混沌工程故障
    • 🆕 APM(应用性能监控)模块:终端节点 arms-global.ctapi.ctyun.cn,实现 44 个查询类 API
      • 基础配置(项目/环境/LicenseKey/采集状态)、应用与实例、调用链与拓扑、性能监控(SQL/NoSQL/MQ/JVM)、用量统计、告警/通知/Webhook
    • 🚀 ZOS(对象存储)全面增强:从仅询价扩展到 39 个命令(桶/对象/IAM/服务/标签管理)
    • 🚀 ELB 查询类 API:新增 19 个查询命令(访问控制/规格/证书/转发规则/健康检查/GWLB/IP监听器/旧版监控/标签)
    • 🆕 ctmysql(关系数据库MySQL版)模块:实例列表、标签管理、监控查询、询价(新建/变更/续费)
    • 🆕 csscn(服务器安全卫士原生版)模块:10个命令,服务器/风险/漏洞/告警/病毒/配额查询
    • 🔧 billing 模块清理:移除全部 mock 数据逻辑,删除失效的 balance/arrears 命令
    • 🆕 DPS(物理机)模块:8个命令,实例/网卡/镜像/元数据/库存查询
    • 🚀 ELB 新增3个PGELB询价API(创建/续订/变配)
    • 🚀 ECS 新增资源续订询价(支持VM/EBS/IP/NAT/BMS等9种资源类型)
    • 🚀 Monitor 新增拨测点查询和拨测任务结果查询
    • 🚀 OceanFS 新增续订询价和扩容询价
    • 🚀 Redis 新增7个API:Proxy监控、读写分离、分片管理、节点状态、可用区查询
    • 🆕 Aone(边缘安全加速平台)/ AIServer(模型推理服务)/ CloudPC(云电脑)模块

相关专题

更多
PixTV官网入口地址合集
PixTV官网入口地址合集

本专题汇总了 PixTV AI 一站式视频创作平台的官方入口与使用教程。无需下载软件,浏览器直接访问即可使用。平台将剧本、图像、视频、声音与剪辑整合在“无限画布”中,接入 GPT Image 2.5、Seedance 2.5 等头部模型。本专题整理了从新建画布、角色锚定、分镜拆分到视频生成与导出的完整操作指南,助你快速上手 AI 短剧与漫剧创作。

2026.10.10

0

15

Kratos框架HTTP与gRPC服务开发教程
Kratos框架HTTP与gRPC服务开发教程

本专题围绕Kratos框架双协议服务开发,涵盖HTTP路由与处理器编写、参数获取、gRPC服务实现与客户端调用、metadata上下文传递、encoding编解码注册、统一响应封装、超时控制与流式响应实现方法。

2026.10.10

0

15

Kratos框架Protobuf接口定义与代码生成合集
Kratos框架Protobuf接口定义与代码生成合集

本专题讲解Kratos框架接口定义体系,涵盖proto编写规范、proto add/client/server生成命令、http注解路由、validate校验、OpenAPI文档生成、跨服务proto复用与兼容性设计。

2026.10.10

0

15

C++虚函数怎么定义和调用
C++虚函数怎么定义和调用

C++虚函数是实现运行时多态的重要机制。本专题从virtual关键字的基本用法入手,介绍基类与派生类之间的函数重写、基类指针调用派生类方法,以及动态绑定的执行过程,帮助初学者掌握虚函数的核心语法。

2026.10.10

0

26

C++类与对象的封装方法教程
C++类与对象的封装方法教程

C++封装是面向对象编程的核心特性之一,通过类将数据与操作数据的函数组织在一起,并利用访问权限控制外部访问。本专题介绍类的定义、成员变量、成员函数以及public、private和protected的使用方法,帮助初学者掌握封装的基本原理。

2026.10.10

0

32

C++构造函数定义与调用方法
C++构造函数定义与调用方法

C++构造函数用于初始化类对象,是面向对象编程的重要基础。本专题从构造函数的定义、声明和调用入手,介绍默认构造函数、带参数构造函数、拷贝构造函数及成员初始化列表,帮助初学者掌握对象创建与初始化的基本方法。

2026.10.10

0

16

Kratos框架零基础入门教程
Kratos框架零基础入门教程

本专题整理Kratos框架入门内容,涵盖Go环境准备、kratos CLI安装升级、new命令创建项目、目录结构分层说明、服务启动与双协议端口、依赖下载报错排查,帮助开发者快速跑通第一个Kratos框架微服务应用。

2026.10.10

0

15

C++条件判断语句怎么写
C++条件判断语句怎么写

C++条件判断是控制程序执行流程的重要基础。本专题介绍if、if-else、else if和switch等常见分支语句,结合条件表达式、比较运算符与代码示例,帮助初学者掌握不同场景下的判断逻辑。

2026.10.10

0

13

C++变量怎么声明和赋值
C++变量怎么声明和赋值

C++变量是编写程序和存储数据的基础。本专题围绕变量声明、定义、初始化、赋值和类型选择等内容展开,帮助初学者理解不同变量的用法,并掌握在实际代码中定义和使用变量的方法。

2026.10.10

0

20

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
热门推荐
/
最新课程
phpStudy极速入门视频教程
phpStudy极速入门视频教程

共6课时 | 54.6万人学习

独孤九贱(4)_PHP视频教程
独孤九贱(4)_PHP视频教程

共89课时 | 133.4万人学习