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 命令提供交互式的实例创建体验:
- 选择 VPC
- 选择交换机(自动关联可用区)
- 选择实例规格(支持模糊搜索)
- 配置私网 IP(可选)
- 选择安全组
- 选择系统镜像
- 设置登录密码
- 选择系统盘类型
- 配置登录用户
支持的区域
| 区域 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 | 德国法兰克福 |
技术栈
- Python 3.13+
- Alibaba Cloud SDK
- Fire - CLI 框架
- Questionary - 交互式命令行
- Prompt Toolkit - 命令行补全
配置文件
配置文件存储位置:
- 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"
}
开发
克隆仓库并安装开发依赖:
git clone https://github.com/your-repo/ali-ops.git
cd ali-ops
uv sync
运行测试:
uv run pytest
代码检查:
uv run ruff check src/
Metadata
Release files for ali-ops 1.0.18
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ali_ops-1.0.18-py3-none-any.whl | Python 3 | none | any | Details for ali_ops-1.0.18-py3-none-any.whl |
Release files / ali_ops-1.0.18-py3-none-any.whl
| Download URL | ali_ops-1.0.18-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
28f2f3ba4f485b26166b2d5344cdc459b50c823d57f022b86872f202a7b38213
|
|
BLAKE2b-256 checksum How to use checksums |
9e58ac9e021128a93009b50e4bf7fca154fbdf469c66c9e1b27ccc97d7ed3c40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.6
|
Security for ali-ops 1.0.18
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.