alibabacloud-dms-data-agent-platform-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Create 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 version
If 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-cli

Upgrade if already installed

若已安装则升级

brew upgrade aliyun-cli

After installation, enable automatic plugin installation:
```bash
aliyun configure set --auto-plugin-install true
brew upgrade aliyun-cli

安装完成后,启用自动插件安装:
```bash
aliyun configure set --auto-plugin-install true

2. 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] Run
aliyun configure ai-mode disable
after the workflow is complete.
在执行此技能中的任何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
[必填] 工作流完成后,请运行
aliyun configure ai-mode disable
关闭AI模式。

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 (
    aliyun dms-enterprise list-instances
    ): uses Aliyun CLI credentials
  • Provision Dify instance (
    openAPI_call.py
    ): uses the Alibaba Cloud default credential chain
[必填] 必须同时配置两组凭证 —— Aliyun CLI凭证和Python SDK凭证,二者缺一不可。 绝对不要读取、回显或打印AK/SK值。
此技能执行两类操作,分别使用不同的凭证方式:
  • 查询实例列表
    aliyun dms-enterprise list-instances
    ):使用Aliyun CLI凭证
  • 部署Dify实例
    openAPI_call.py
    ):使用阿里云默认凭证链

3a. Configure Aliyun CLI Credentials

3a. 配置Aliyun CLI凭证

bash
aliyun configure list
Confirm that a valid profile exists in the output (AK, STS, or OAuth).
If no valid profile exists, stop and prompt the user to:
  1. Obtain an AccessKey from the Alibaba Cloud Console
  2. 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
  3. Re-run
    aliyun configure list
    to confirm the profile is active
bash
aliyun configure list
确认输出中存在有效的配置文件(AK、STS或OAuth)。
如果没有有效配置文件,请停止操作并提示用户:
  1. 阿里云控制台获取AccessKey
  2. 在本次会话外配置凭证,避免泄露密钥:
    bash
    aliyun configure set \
      --mode AK \
      --access-key-id <your-access-key-id> \
      --access-key-secret <your-access-key-secret> \
      --region cn-hangzhou
  3. 重新运行
    aliyun configure list
    确认配置文件已激活

3b. Configure Python Script Credentials

3b. 配置Python脚本凭证

openAPI_call.py
uses the Alibaba Cloud default credential chain — no environment variables need to be set manually. The SDK automatically resolves credentials in the following order: environment variables, credentials file, instance RAM role, etc.
Configure 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
使用阿里云默认凭证链 —— 无需手动设置环境变量。SDK会按以下顺序自动解析凭证:环境变量、凭证文件、实例RAM角色等。
请按照官方指南配置凭证: 阿里云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.txt
requirements.txt
is provided in
./scripts/
.
推荐使用uv创建独立的虚拟环境并固定依赖版本:
bash
uv venv .venv
uv pip install --python .venv/bin/python -r scripts/requirements.txt
requirements.txt
文件位于
./scripts/
目录下。

Script Location

脚本位置

./scripts/openAPI_call.py
Run commands from the directory containing this
skill.md
file.

./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

需要向用户收集的参数

ParameterDescription
VpcId
VPC ID
VSwitchId
VSwitch ID
BackupVSwitchId
Backup VSwitch ID
SecurityGroupId
Security Group ID
ZoneId
Availability Zone ID
DataRegion
Data region
WorkspaceName
Name for the new Workspace
AccountDatabase account (used for DbInstanceAccount, KvStoreAccount, VectordbAccount; default:
dify_user
)
PasswordDatabase password (used for DbInstancePassword, KvStorePassword, VectordbPassword)
DryRun
Recommended: set to
true
for a dry run first, then
false
to provision
参数描述
VpcId
VPC ID
VSwitchId
交换机ID
BackupVSwitchId
备用交换机ID
SecurityGroupId
安全组ID
ZoneId
可用区ID
DataRegion
数据地域
WorkspaceName
新工作区的名称
Account数据库账号(用于DbInstanceAccount、KvStoreAccount、VectordbAccount;默认值:
dify_user
Password数据库密码(用于DbInstancePassword、KvStorePassword、VectordbPassword)
DryRun
推荐:先设置为
true
进行试运行,再设置为
false
执行部署

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:
ParameterDescription
VpcId
VPC ID
VSwitchId
VSwitch ID
BackupVSwitchId
Backup VSwitch ID
SecurityGroupId
Security Group ID
ZoneId
Availability Zone ID
DataRegion
Data region
向用户询问以下信息:
参数描述
VpcId
VPC ID
VSwitchId
交换机ID
BackupVSwitchId
备用交换机ID
SecurityGroupId
安全组ID
ZoneId
可用区ID
DataRegion
数据地域

Step 2: Confirm WorkspaceOption

步骤2:确认WorkspaceOption

Ask the user: use an existing Workspace or create a new one?
  • UseExistingInstance
    : user must provide
    WorkspaceId
    (string)
  • CreateNewInstance
    : user must provide
    WorkspaceName
  • Note:
    WorkspaceId
    and
    WorkspaceName
    are mutually exclusive. If both are provided, prompt the user to correct the input.
询问用户:使用现有工作区还是创建新工作区?
  • UseExistingInstance
    :用户必须提供
    WorkspaceId
    (字符串类型)
  • CreateNewInstance
    :用户必须提供
    WorkspaceName
  • 注意:
    WorkspaceId
    WorkspaceName
    互斥。如果同时提供,需提示用户修正输入。

Step 3: Confirm Each Sub-Service Option Individually

步骤3:单独确认每个子服务选项

Ask the user to choose for each of the following independently:
请用户为以下每个服务独立选择:

DatabaseOption

DatabaseOption

  • CreateNewInstance
    : no additional parameters needed; uses default configuration
  • UseExistingInstance
    :
    • Ask the user if they know the
      DbResourceId
      (integer)
    • If not, run the following command and find the
      InstanceId
      from
      InstanceList.Instance
      :
      bash
      aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
  • CreateNewInstance
    :无需额外参数;使用默认配置
  • UseExistingInstance
    • 询问用户是否知道
      DbResourceId
      (整数类型)
    • 如果不知道,运行以下命令并从
      InstanceList.Instance
      中查找
      InstanceId
      bash
      aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com

KvStoreOption

KvStoreOption

  • CreateNewInstance
    : no additional parameters needed
  • UseExistingInstance
    :
    • Ask the user if they know the
      KvStoreResourceId
      (integer)
    • If not, run:
      bash
      aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
  • CreateNewInstance
    :无需额外参数
  • UseExistingInstance
    • 询问用户是否知道
      KvStoreResourceId
      (整数类型)
    • 如果不知道,运行:
      bash
      aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com

VectordbOption

VectordbOption

  • CreateNewInstance
    : no additional parameters needed
  • UseExistingInstance
    :
    • Ask the user if they know the
      VectordbResourceId
      (integer)
    • If not, run:
      bash
      aliyun dms-enterprise list-instances --endpoint dms-enterprise.aliyuncs.com
  • 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:
  • DbInstanceAccount
    /
    DbInstancePassword
  • KvStoreAccount
    /
    KvStorePassword
  • VectordbAccount
    /
    VectordbPassword
向用户询问账号名称和密码,并填入以下字段:
  • DbInstanceAccount
    /
    DbInstancePassword
  • KvStoreAccount
    /
    KvStorePassword
  • VectordbAccount
    /
    VectordbPassword

Step 5: Confirm Other Advanced Parameters

步骤5:确认其他高级参数

The following parameters have default values. Ask the user if any need to be changed:
ParameterDefaultAllowed Values
ResourceQuota
12CU
Custom string
Replicas
1
Integer
NatGatewayOption
NoNeed
NoNeed
,
Enable
PayType
PrePaid
PrePaid
,
PostPaid
PayPeriodType
Month
Month
,
Year
PayPeriod
1
Integer
MajorVersion
1.13.x
Custom string
Edition
OpenCommunity
OpenCommunity
,
Community
,
Enterprise
EnableExtraEndpoint
true
true
,
false
OnlyIntranet
false
true
,
false
DryRun
true
Recommended:
true
for dry run first, then
false
to provision
以下参数有默认值。询问用户是否需要修改:
参数默认值允许值
ResourceQuota
12CU
自定义字符串
Replicas
1
整数
NatGatewayOption
NoNeed
NoNeed
,
Enable
PayType
PrePaid
PrePaid
,
PostPaid
PayPeriodType
Month
Month
,
Year
PayPeriod
1
整数
MajorVersion
1.13.x
自定义字符串
Edition
OpenCommunity
OpenCommunity
,
Community
,
Enterprise
EnableExtraEndpoint
true
true
,
false
OnlyIntranet
false
true
,
false
DryRun
true
推荐:先设置为
true
进行试运行,再设置为
false
执行部署

Step 6: Dry Run and Final Provisioning

步骤6:试运行与最终部署

  1. Construct the full JSON with
    DryRun=true
    and run the script
  2. After confirming no errors, set
    DryRun
    to
    false
    and run again to provision

  1. 构造完整的JSON并设置
    DryRun=true
    ,运行脚本
  2. 确认无错误后,将
    DryRun
    设置为
    false
    ,再次运行脚本完成部署

Notes

注意事项

  • The Python script uses the Alibaba Cloud default credential chain; configure credentials per the official guide before running the script
  • WorkspaceId
    (use existing Workspace) and
    WorkspaceName
    (create new Workspace) are mutually exclusive
  • DbResourceId
    ,
    KvStoreResourceId
    , and
    VectordbResourceId
    are all integer types
  • Always perform a dry run with
    DryRun=true
    before final provisioning
  • After the workflow is complete, run
    aliyun configure ai-mode disable
    to disable AI-Mode
  • Python脚本使用阿里云默认凭证链;运行脚本前请按照官方指南配置凭证
  • WorkspaceId
    (使用现有工作区)和
    WorkspaceName
    (创建新工作区)互斥
  • DbResourceId
    KvStoreResourceId
    VectordbResourceId
    均为整数类型
  • 最终部署前,请务必使用
    DryRun=true
    进行试运行
  • 工作流完成后,请运行
    aliyun configure ai-mode disable
    关闭AI模式