alibabacloud-dms-data-agent-platform-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate Dify Instance
创建Dify实例
Provision a Dify instance automatically via Alibaba Cloud OpenAPI.
Supports Simple Mode (create all resources from scratch) and Advanced Mode (fine-grained control over each component).
通过阿里云OpenAPI自动部署Dify实例。
支持简易模式(从零创建所有资源)和高级模式(对每个组件进行细粒度控制)。
Prerequisites
前提条件
1. Check Aliyun CLI
1. 检查Aliyun CLI
[REQUIRED] Verify Aliyun CLI version >= 3.3.1 before proceeding.
bash
aliyun versionIf the command is not found or the version is below 3.3.1, install or upgrade:
macOS (Homebrew, recommended)
bash
brew install aliyun-cli[必填] 操作前请确认Aliyun CLI版本 >= 3.3.1。
bash
aliyun version如果未找到该命令或版本低于3.3.1,请安装或升级:
macOS(推荐使用Homebrew)
bash
brew install aliyun-cliUpgrade if already installed
若已安装则升级
brew upgrade aliyun-cli
After installation, enable automatic plugin installation:
```bash
aliyun configure set --auto-plugin-install truebrew upgrade aliyun-cli
安装完成后,启用自动插件安装:
```bash
aliyun configure set --auto-plugin-install true2. Enable Aliyun CLI AI-Mode
2. 启用Aliyun CLI AI模式
Before executing any CLI commands in this skill, run the following to enable AI-Mode, set the User-Agent, and update plugins:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-dms-data-agent-platform-setup"
aliyun plugin update[REQUIRED] Runafter the workflow is complete.aliyun configure ai-mode disable
在执行此技能中的任何CLI命令前,请运行以下命令启用AI模式、设置User-Agent并更新插件:
bash
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-dms-data-agent-platform-setup"
aliyun plugin update[必填] 工作流完成后,请运行关闭AI模式。aliyun configure ai-mode disable
3. Configure Alibaba Cloud Credentials
3. 配置阿里云凭证
[REQUIRED] Both credential sets must be configured — Aliyun CLI credentials AND Python SDK credentials. Neither can be omitted. NEVER read, echo, or print AK/SK values.
This skill performs two types of operations, each using a different credential method:
- Query instance list (): uses Aliyun CLI credentials
aliyun dms-enterprise list-instances - Provision Dify instance (): uses the Alibaba Cloud default credential chain
openAPI_call.py
[必填] 必须同时配置两组凭证 —— Aliyun CLI凭证和Python SDK凭证,二者缺一不可。 绝对不要读取、回显或打印AK/SK值。
此技能执行两类操作,分别使用不同的凭证方式:
- 查询实例列表():使用Aliyun CLI凭证
aliyun dms-enterprise list-instances - 部署Dify实例():使用阿里云默认凭证链
openAPI_call.py
3a. Configure Aliyun CLI Credentials
3a. 配置Aliyun CLI凭证
bash
aliyun configure listConfirm that a valid profile exists in the output (AK, STS, or OAuth).
If no valid profile exists, stop and prompt the user to:
- Obtain an AccessKey from the Alibaba Cloud Console
- Configure credentials outside of this session to avoid exposing secrets:
bash
aliyun configure set \ --mode AK \ --access-key-id <your-access-key-id> \ --access-key-secret <your-access-key-secret> \ --region cn-hangzhou - Re-run to confirm the profile is active
aliyun configure list
bash
aliyun configure list确认输出中存在有效的配置文件(AK、STS或OAuth)。
如果没有有效配置文件,请停止操作并提示用户:
- 从阿里云控制台获取AccessKey
- 在本次会话外配置凭证,避免泄露密钥:
bash
aliyun configure set \ --mode AK \ --access-key-id <your-access-key-id> \ --access-key-secret <your-access-key-secret> \ --region cn-hangzhou - 重新运行 确认配置文件已激活
aliyun configure list
3b. Configure Python Script Credentials
3b. 配置Python脚本凭证
openAPI_call.pyConfigure your credentials by following the official guide:
Alibaba Cloud Python SDK v2 — Manage Access Credentials
NEVER hardcode AK/SK values in code or pass them as command-line arguments.
openAPI_call.py请按照官方指南配置凭证:
阿里云Python SDK v2 —— 管理访问凭证
绝对不要在代码中硬编码AK/SK值,也不要将其作为命令行参数传递。
4. Python Environment
4. Python环境
It is recommended to use uv to create an isolated virtual environment with pinned dependencies:
bash
uv venv .venv
uv pip install --python .venv/bin/python -r scripts/requirements.txtrequirements.txt./scripts/推荐使用uv创建独立的虚拟环境并固定依赖版本:
bash
uv venv .venv
uv pip install --python .venv/bin/python -r scripts/requirements.txtrequirements.txt./scripts/Script Location
脚本位置
./scripts/openAPI_call.pyRun commands from the directory containing thisfile.skill.md
./scripts/openAPI_call.py请在包含此文件的目录下运行命令。skill.md
Simple Mode
简易模式
All components (Workspace, database, KV store, vector database) are newly created.
所有组件(工作区、数据库、KV存储、向量数据库)均为全新创建。
Parameters to Collect from User
需要向用户收集的参数
| Parameter | Description |
|---|---|
| VPC ID |
| VSwitch ID |
| Backup VSwitch ID |
| Security Group ID |
| Availability Zone ID |
| Data region |
| Name for the new Workspace |
| Account | Database account (used for DbInstanceAccount, KvStoreAccount, VectordbAccount; default: |
| Password | Database password (used for DbInstancePassword, KvStorePassword, VectordbPassword) |
| Recommended: set to |
| 参数 | 描述 |
|---|---|
| VPC ID |
| 交换机ID |
| 备用交换机ID |
| 安全组ID |
| 可用区ID |
| 数据地域 |
| 新工作区的名称 |
| Account | 数据库账号(用于DbInstanceAccount、KvStoreAccount、VectordbAccount;默认值: |
| Password | 数据库密码(用于DbInstancePassword、KvStorePassword、VectordbPassword) |
| 推荐:先设置为 |
Execution Command
执行命令
bash
.venv/bin/python ./scripts/openAPI_call.py '{
"VpcId": "<VpcId>",
"VSwitchId": "<VSwitchId>",
"BackupVSwitchId": "<BackupVSwitchId>",
"SecurityGroupId": "<SecurityGroupId>",
"ZoneId": "<ZoneId>",
"DataRegion": "<DataRegion>",
"ResourceQuota": "12CU",
"WorkspaceOption": "CreateNewInstance",
"WorkspaceName": "<WorkspaceName>",
"DatabaseOption": "CreateNewInstance",
"DbInstanceAccount": "<account>",
"DbInstancePassword": "<password>",
"KvStoreOption": "CreateNewInstance",
"KvStoreAccount": "<account>",
"KvStorePassword": "<password>",
"VectordbOption": "CreateNewInstance",
"VectordbAccount": "<account>",
"VectordbPassword": "<password>",
"StorageType": "cloud_essd",
"NatGatewayOption": "NoNeed",
"MajorVersion": "1.13.x",
"Edition": "OpenCommunity",
"DryRun": true
}'bash
.venv/bin/python ./scripts/openAPI_call.py '{
"VpcId": "<VpcId>",
"VSwitchId": "<VSwitchId>",
"BackupVSwitchId": "<BackupVSwitchId>",
"SecurityGroupId": "<SecurityGroupId>",
"ZoneId": "<ZoneId>",
"DataRegion": "<DataRegion>",
"ResourceQuota": "12CU",
"WorkspaceOption": "CreateNewInstance",
"WorkspaceName": "<WorkspaceName>",
"DatabaseOption": "CreateNewInstance",
"DbInstanceAccount": "<account>",
"DbInstancePassword": "<password>",
"KvStoreOption": "CreateNewInstance",
"KvStoreAccount": "<account>",
"KvStorePassword": "<password>",
"VectordbOption": "CreateNewInstance",
"VectordbAccount": "<account>",
"VectordbPassword": "<password>",
"StorageType": "cloud_essd",
"NatGatewayOption": "NoNeed",
"MajorVersion": "1.13.x",
"Edition": "OpenCommunity",
"DryRun": true
}'Advanced Mode
高级模式
Allows fine-grained control over all parameters, including using existing Workspace, database, KV store, and vector database instances.
允许对所有参数进行细粒度控制,包括使用现有的工作区、数据库、KV存储和向量数据库实例。
Step 1: Collect Base Network Parameters
步骤1:收集基础网络参数
Ask the user for the following:
| Parameter | Description |
|---|---|
| VPC ID |
| VSwitch ID |
| Backup VSwitch ID |
| Security Group ID |
| Availability Zone ID |
| Data region |
向用户询问以下信息:
| 参数 | 描述 |
|---|---|
| VPC ID |
| 交换机ID |
| 备用交换机ID |
| 安全组ID |
| 可用区ID |
| 数据地域 |
Step 2: Confirm WorkspaceOption
步骤2:确认WorkspaceOption
Ask the user: use an existing Workspace or create a new one?
- : user must provide
UseExistingInstance(string)WorkspaceId - : user must provide
CreateNewInstanceWorkspaceName - Note: and
WorkspaceIdare mutually exclusive. If both are provided, prompt the user to correct the input.WorkspaceName
询问用户:使用现有工作区还是创建新工作区?
- :用户必须提供
UseExistingInstance(字符串类型)WorkspaceId - :用户必须提供
CreateNewInstanceWorkspaceName - 注意:和
WorkspaceId互斥。如果同时提供,需提示用户修正输入。WorkspaceName
Step 3: Confirm Each Sub-Service Option Individually
步骤3:单独确认每个子服务选项
Ask the user to choose for each of the following independently:
请用户为以下每个服务独立选择:
DatabaseOption
DatabaseOption
- : no additional parameters needed; uses default configuration
CreateNewInstance - :
UseExistingInstance- Ask the user if they know the (integer)
DbResourceId - If not, run the following command and find the from
InstanceId:InstanceList.Instancebashaliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- Ask the user if they know the
- :无需额外参数;使用默认配置
CreateNewInstance - :
UseExistingInstance- 询问用户是否知道 (整数类型)
DbResourceId - 如果不知道,运行以下命令并从 中查找
InstanceList.Instance:InstanceIdbashaliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- 询问用户是否知道
KvStoreOption
KvStoreOption
- : no additional parameters needed
CreateNewInstance - :
UseExistingInstance- Ask the user if they know the (integer)
KvStoreResourceId - If not, run:
bash
aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- Ask the user if they know the
- :无需额外参数
CreateNewInstance - :
UseExistingInstance- 询问用户是否知道 (整数类型)
KvStoreResourceId - 如果不知道,运行:
bash
aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- 询问用户是否知道
VectordbOption
VectordbOption
- : no additional parameters needed
CreateNewInstance - :
UseExistingInstance- Ask the user if they know the (integer)
VectordbResourceId - If not, run:
bash
aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- Ask the user if they know the
- :无需额外参数
CreateNewInstance - :
UseExistingInstance- 询问用户是否知道 (整数类型)
VectordbResourceId - 如果不知道,运行:
bash
aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
- 询问用户是否知道
Step 4: Collect Account and Password
步骤4:收集账号和密码
Ask the user for account name and password, and fill in:
- /
DbInstanceAccountDbInstancePassword - /
KvStoreAccountKvStorePassword - /
VectordbAccountVectordbPassword
向用户询问账号名称和密码,并填入以下字段:
- /
DbInstanceAccountDbInstancePassword - /
KvStoreAccountKvStorePassword - /
VectordbAccountVectordbPassword
Step 5: Confirm Other Advanced Parameters
步骤5:确认其他高级参数
The following parameters have default values. Ask the user if any need to be changed:
| Parameter | Default | Allowed Values |
|---|---|---|
| | Custom string |
| | Integer |
| | |
| | |
| | |
| | Integer |
| | Custom string |
| | |
| | |
| | |
| | Recommended: |
以下参数有默认值。询问用户是否需要修改:
| 参数 | 默认值 | 允许值 |
|---|---|---|
| | 自定义字符串 |
| | 整数 |
| | |
| | |
| | |
| | 整数 |
| | 自定义字符串 |
| | |
| | |
| | |
| | 推荐:先设置为 |
Step 6: Dry Run and Final Provisioning
步骤6:试运行与最终部署
- Construct the full JSON with and run the script
DryRun=true - After confirming no errors, set to
DryRunand run again to provisionfalse
- 构造完整的JSON并设置 ,运行脚本
DryRun=true - 确认无错误后,将 设置为
DryRun,再次运行脚本完成部署false
Notes
注意事项
- The Python script uses the Alibaba Cloud default credential chain; configure credentials per the official guide before running the script
- (use existing Workspace) and
WorkspaceId(create new Workspace) are mutually exclusiveWorkspaceName - ,
DbResourceId, andKvStoreResourceIdare all integer typesVectordbResourceId - Always perform a dry run with before final provisioning
DryRun=true - After the workflow is complete, run to disable AI-Mode
aliyun configure ai-mode disable
- Python脚本使用阿里云默认凭证链;运行脚本前请按照官方指南配置凭证
- (使用现有工作区)和
WorkspaceId(创建新工作区)互斥WorkspaceName - 、
DbResourceId和KvStoreResourceId均为整数类型VectordbResourceId - 最终部署前,请务必使用 进行试运行
DryRun=true - 工作流完成后,请运行 关闭AI模式
aliyun configure ai-mode disable