用途:在华为云上端到端部署“快速搭建 YOLO 视觉模型训练平台”方案,提供 GPU 加速 ECS 用于 YOLO 模型训练,全部基础设施通过 Terraform 声明式创建。架构包含 ECS(GPU,P2s/Pi2)、VPC、子网、安全组(ICMP/SSH/HTTP)、EIP(300 Mbit/s)、EVS(100 GB 系统盘 + 500 GB 数据盘)和 CBR(备份库与策略);cloud-init 安装 Docker 并在 GPU 上启动 YOLO 容器。工具链为 Playwright CLI(提取方案信息)+ Python 3.8+(辅助脚本)+ Terraform 1.15.4+,不使用 KooCLI。
主要能力:提取方案信息、下载并规范化 Terraform 模板、列出变量供确认、部署、验证与清理。核心命令包括:python3 ./scripts/extract_sac_deploy_info.py --url "<方案详情页URL>" --out /tmp/sac_selected.json;python3 ./scripts/download_tf_template_file.py --url "<tf模板URL>" --out-dir /tmp/yolo-workdir;python3 ./scripts/normalize_tf_providers.py /tmp/yolo-workdir --region "cn-north-4";python3 ./scripts/list_tf_variables.py /tmp/yolo-workdir;随后 terraform init、terraform plan、terraform apply、terraform state list、terraform output -json、terraform destroy。
使用方式:需 Python 3.8+、Playwright CLI、Terraform 1.15.4+;通过环境变量 HW_ACCESS_KEY、HW_SECRET_KEY 提供 AK/SK,未设置时需手动编辑 terraform.auto.tfvars.json 填写。需具备足够权限的 IAM 用户或 rf_admin_trust 委托。部署前必须审阅 terraform plan 并获用户明确确认,不得自动 apply。部署后需在华为云控制台手动为 TCP 8001 端口添加安全组入方向规则(使用受限 CIDR,勿对所有地址开放),等待约 10 分钟 cloud-init 完成。验证方式:curl -s http://<EIP>:8001 返回 200,ssh root@<EIP> "docker ps" 与 "nvidia-smi" 检查容器与 GPU。terraform output -json 返回 access_instructions、ecs_eip、ecs_id、vpc_id。
限制:仅支持 cn-north-4 区域;terraform.auto.tfvars.json 含敏感信息,禁止提交到版本库;AK/SK 不得在对话或输出中暴露,也不得要求用户在聊天中输入;修改类操作(apply、destroy)需用户明确确认。参数方面 region 必填默认 cn-north-4,ecs_password 必填(8-26 位,含大小写、数字与特殊字符),ecs_flavor 默认 p2s.2xlarge.8,system_disk_size 默认 100 GB(40-1024),data_disk_size 默认 500 GB(40-1024),bandwidth_size 默认 300 Mbit/s(1-300),charging_unit 默认 month(可选 year),charging_period 默认 1。其他细节暂未提供。