Skip to main content

阿里云命令行工具

Project description

Ali-Ops(本项目使用GLM系列模型辅助开发)

一个简洁高效的阿里云命令行管理工具,提供交互式的云资源管理体验。

功能特性

  • ECS 实例管理 - 创建、启动、停止、删除按量付费实例
  • VPC 网络 - 查看和管理专有网络及交换机
  • 安全组 - 查看安全组列表及规则详情
  • 镜像管理 - 查询可用的系统镜像
  • 多配置支持 - 管理多套阿里云凭证配置
  • 智能补全 - 支持模糊搜索和 TAB 补全

安装

使用 uv 安装:

uv tool install ali-ops -U 

或使用 pip 安装:

pip install ali-ops

快速开始

1. 初始化配置

首次使用需要配置阿里云凭证:

ali config regen

按提示输入 AccessKey ID、AccessKey Secret 并选择默认区域。

2. 切换区域

查看当前区域:

ali config region

切换到其他区域:

ali config region --set

命令参考

ECS 实例管理

# 列出当前区域的所有 ECS 实例
ali ecs ls

# 创建新实例(交互式)
ali ecs istadd

# 停止实例
ali ecs iststop

# 启动已停止的实例
ali ecs iststart

# 删除实例
ali ecs istdel

VPC 网络

# 列出所有 VPC
ali vpc ls

# 列出 VPC 下的交换机
ali vpc vswls

# 创建交换机
ali vpc vswadd

# 删除交换机
ali vpc vswdel

安全组

# 列出安全组
ali sgp ls

# 查看安全组详细规则
ali sgp lsattr

镜像管理

# 列出 Ubuntu 镜像
ali imge ls Ubuntu

# 列出 Debian 镜像
ali imge ls Debian

# 列出 Windows Server 镜像
ali imge ls Windows

配置管理

# 查看当前配置
ali config list

# 添加新配置
ali config regen

# 查看当前区域
ali config region

# 切换区域
ali config region --set

创建实例流程

ali ecs istadd 命令提供交互式的实例创建体验:

  1. 选择 VPC
  2. 选择交换机(自动关联可用区)
  3. 选择实例规格(支持模糊搜索)
  4. 配置私网 IP(可选)
  5. 选择安全组
  6. 选择系统镜像
  7. 设置登录密码
  8. 选择系统盘类型
  9. 配置登录用户

支持的区域

区域 ID 名称
cn-shenzhen 深圳
cn-hangzhou 杭州
cn-beijing 北京
cn-shanghai 上海
cn-qingdao 青岛
cn-zhangjiakou 张家口
cn-huhehaote 呼和浩特
cn-wulanchabu 乌兰察布
cn-chengdu 成都
cn-heyuan 河源
cn-guangzhou 广州
cn-fuzhou 福州
cn-nanjing 南京
ap-southeast-1 新加坡
ap-southeast-3 吉隆坡
ap-southeast-5 雅加达
ap-northeast-1 东京
ap-northeast-2 首尔
us-east-1 美国弗吉尼亚
us-west-1 美国硅谷
eu-west-1 英国伦敦
eu-central-1 德国法兰克福

技术栈

配置文件

配置文件存储位置:

  • Linux/macOS: ~/.aliops/config.json
  • Windows: %USERPROFILE%\.aliops\config.json

配置文件格式:

{
  "profiles": [
    {
      "name": "default",
      "mode": "AK",
      "access_key_id": "your-access-key-id",
      "access_key_secret": "your-access-key-secret",
      "region_id": "cn-shenzhen"
    }
  ],
  "current": "default"
}

[!WARNING] AccessKey 具有账户完全访问权限,请妥善保管,不要泄露或提交到版本控制系统。

开发

克隆仓库并安装开发依赖:

git clone https://github.com/your-repo/ali-ops.git
cd ali-ops
uv sync

运行测试:

uv run pytest

代码检查:

uv run ruff check src/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ali_ops-1.0.18-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file ali_ops-1.0.18-py3-none-any.whl.

File metadata

  • Download URL: ali_ops-1.0.18-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for ali_ops-1.0.18-py3-none-any.whl
Algorithm Hash digest
SHA256 28f2f3ba4f485b26166b2d5344cdc459b50c823d57f022b86872f202a7b38213
MD5 29781456f92a66f8303105493df95dfb
BLAKE2b-256 9e58ac9e021128a93009b50e4bf7fca154fbdf469c66c9e1b27ccc97d7ed3c40

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page