在终端管理阿里云百炼沙箱实例与模版:创建、查询、连接、暂停、恢复、释放实例,以及创建、更新、查询、删除模版和查看构建状态。
Sandbox 相关能力目前仅对中国站(aliyun.com)账号开放,要求 cn-beijing 地域并完成 Sandbox SLR 授权。
任意命令追加 --help 可查看完整参数说明,例如 bl sandbox create --help。连接凭据默认脱敏,需要时使用 --show-credentials 获取。
实例管理
| 能力 | 命令 | 说明 |
|---|
| 实例列表 | bl sandbox list | 列出工作空间内的沙箱实例 |
| 实例详情 | bl sandbox get | 查看指定实例的配置与连接信息 |
| 创建实例 | bl sandbox create | 创建沙箱实例 |
| 连接实例 | bl sandbox connect | 获取实例连接信息(WebShell、CDP、VNC) |
| 暂停实例 | bl sandbox pause | 暂停运行中的实例 |
| 恢复实例 | bl sandbox resume | 恢复已暂停的实例 |
| 释放实例 | bl sandbox delete | 释放(删除)实例(高危操作) |
模版管理
| 能力 | 命令 | 说明 |
|---|
| 模版列表 | bl sandbox template list | 列出工作空间内的沙箱模版 |
| 模版详情 | bl sandbox template get | 查看指定模版的配置 |
| 创建模版 | bl sandbox template create | 创建沙箱模版,支持 --image 选择内置基础镜像 |
| 更新模版 | bl sandbox template update | 更新模版配置 |
| 构建状态 | bl sandbox template build-status | 查询模版构建状态(--async 提交后轮询) |
| 删除模版 | bl sandbox template delete | 删除模版(高危操作) |
内置镜像与文件
| 能力 | 命令 | 说明 |
|---|
| 内置镜像 | bl sandbox official-images | 查看内置基础镜像预设(Code Interpreter、Browser、All-in-One),无需鉴权 |
| 上传挂载文件 | bl sandbox file upload | 上传模版挂载文件(source=sandbox_template),返回 File ID 用于 mntConfig |
bl sandbox official-images
bl sandbox create --template-id <模版ID> --instance-timeout 3600
bl sandbox get --sandbox-id <实例ID> --show-credentials --output json
bl sandbox template create --image code-interpreter --name my-sandbox-template