All Products
Search
Document Center

Data Management:Preparations for deploying Dify with existing instances

Last Updated:Jan 06, 2026

You can manually create instances and import them into DMS to launch Dify. This method is ideal for users who already have instance resources. This topic describes preparations for deploy Dify with existing instances.

Required resources

Note
  • This guide uses ApsaraDB RDS for PostgreSQL as the metadata database and AnalyticDB for PostgreSQL as the vector database. The following steps are based on this example setup.

  • All four resources must be in the same Region. For example, if the ApsaraDB RDS for PostgreSQL instance is in China (Beijing), all other instances must also be in China (Beijing).

  • ApsaraDB RDS for PostgreSQL: Serves as the metadata database. It stores structured and core business data for Dify, such as permission configurations and user information, and provides transaction support.

  • Tair (Redis OSS-compatible): Provides caching, session management, and asynchronous task processing to improve system real-time performance and concurrency.

  • Vector Engine (for example, AnalyticDB for PostgreSQL): Stores vector data, such as knowledge base content.

  • OSS: Stores unstructured data for Dify, such as knowledge base files and images.

1. Purchase an ApsaraDB RDS for PostgreSQL instance and add it to DMS

1.1 Purchase an ApsaraDB RDS for PostgreSQL instance

  1. Go to the RDS purchase page.

  2. Select the Region for the instance and configure the edition, storage type, and instance type.

    imageExample configuration: Select an instance type with 4 cores and 8 GB of memory, and set the storage space to 100 GB. You can also choose other options with higher specifications.

    image

  3. Follow the on-screen instructions to complete the purchase.

1.2 Configure the instance

1.2.1 Create a database account

  1. Go to the RDS instance list.

  2. Click the name of the target instance and go to the Accounts page to create a database account.

    image

1.2.2 Create databases

Go to the Databases page and create two databases named dify and dify_plugin. For more information, see Create databases and accounts.

screenshot_2025-08-05_13-07-03

1.2.3 Configure the whitelist

Go to the Whitelist and SecGroup page. To allow resources in your Dify VPC to access the instance, add the IPv4 CIDR block of the corresponding vSwitch to the instance's whitelist. For more information, see Configure a whitelist and Create and manage a vSwitch.

image

1.3 Add the instance to DMS

  1. Log on to the DMS console V5.0.
  2. Move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Data Assets > Instances.

    Note

    If you use the DMS console in normal mode, choose Data Assets > Instances in the top navigation bar.

  3. On the Instance Management page, click New and configure the required information.

    Note

    Enable Security hosting for your instance.

    image

  4. After completing the configuration, click Submit.

2. Purchase a Tair (Redis OSS-compatible) instance and add it to DMS

2.1 Purchase a Tair (Redis OSS-compatible) instance

  1. Go to the Tair (Redis OSS-compatible) purchase page.

  2. Select the instance parameters.

    1. For Service and Deployment Mode, select Redis Open-Source Edition and Cloud-native, respectively.

      image

    2. For Major Version and Architecture, select Redis 6.0 and Non-Cluster, respectively.

      image

    3. Select other parameters based on your business requirements.

  3. Follow the on-screen instructions to complete the purchase. For more information, see Step 1: Create an instance.

2.2 Configure the instance

2.2.1 Create a database account

  1. Go to the Tair (Redis OSS-compatible) instance list.

  2. Click the name of the target instance and go to the Account Management page to create a database account named dify_user. Ensure that the password for the dify_user account is the same as the password for the default account. For more information, see Create and manage accounts.

2.2.2 Configure the whitelist

Go to the Whitelist Settings page. To allow resources in your Dify VPC to access the instance, add the IPv4 CIDR block of the corresponding vSwitch to the instance's whitelist. For more information, see Configure an IP address whitelist and Create and manage a vSwitch.

image

2.3 Add the instance to DMS

  1. Log on to the DMS console V5.0.
  2. Move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Data Assets > Instances.

    Note

    If you use the DMS console in normal mode, choose Data Assets > Instances in the top navigation bar.

  3. On the Instance Management page, click New and configure the required information.

    Note

    Enable Security hosting for your instance.

    image

  4. After completing the configuration, click Submit.

3. Purchase a vector engine and add it to DMS

Dify on DMS supports several vector engines, including AnalyticDB for PostgreSQL, AnalyticDB for MySQL, PolarDB for PostgreSQL, RDS PostgreSQL, and Lindorm. The following section uses an AnalyticDB for PostgreSQL instance as an example.

3.1 Purchase an AnalyticDB for PostgreSQL instance

  1. Go to the AnalyticDB for PostgreSQL purchase page.

  2. Configure the instance resource type, node specifications, and vector engine optimization.

    Note

    Enable vector engine optimization for the instance to ensure all knowledge base features are available. For more information, see Enable or disable vector search engine optimization.

    image

  3. Follow the on-screen instructions to complete the purchase. For more information, see Create an instance.

3.2 Configure the instance

3.2.1 Create a database account

  1. Go to the AnalyticDB for PostgreSQL instance list.

  2. Click the instance name and create an initial account on the Account Management page. For more information, see Create an initial account.

    image

3.2.2 Configure the whitelist

Go to the Security Controls page. To grant access from your Dify resources, add the IPv4 CIDR block of the vSwitch in their VPC to the whitelist. For more information, see Configure a whitelist and Create and manage a vSwitch.

image

3.3 Add the instance to DMS

  1. Log on to the DMS console V5.0.
  2. Move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Data Assets > Instances.

    Note

    If you use the DMS console in normal mode, choose Data Assets > Instances in the top navigation bar.

  3. On the Instance Management page, click New and configure the required information.

    Note

    Enable Security hosting for your instance.

    image

  4. After completing the configuration, click Submit.

4. Create an OSS bucket and add it to DMS

4.1 Create an OSS bucket

  1. Go to the Bucket List page and click Create Bucket.

  2. When configuring the bucket information, enter a bucket name and select the same Region as your other instances.

  3. Scroll down and click Create. Follow the on-screen instructions to complete the creation process. For more information, see Quick start.

4.2 Add the OSS bucket to DMS

  1. Log on to the DMS console V5.0.
  2. Move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Data Assets > Instances.

    Note

    If you use the DMS console in normal mode, choose Data Assets > Instances in the top navigation bar.

  3. On the Instance Management page, click New and configure the required information.

    Note

    Enable Security hosting for your instance.

    image

    For more information about how to obtain an AccessKey pair, see View a RAM user’s AccessKey information.

  4. After completing the configuration, click Submit.

Enable Public Access for Dify on DMS

If you need to access Dify over the internet or if Dify needs to connect to public services, follow these steps.

Find the VPC ID of your Dify instance

  1. Log on to the DMS console V5.0.
  2. Move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner and choose All Features > Data+AI > Workspace.

    Note

    If you do not use the DMS console in Simple mode, choose Data+AI > Workspace in the top navigation bar.

    image

  3. Click the name of the target workspace.

  4. In the lower-left corner, click the Settings image icon, select Workspace Management, and obtain the VPC ID of the Dify instance.

    image

Create a NAT gateway for the Dify VPC

  1. Log on to the Virtual Private Cloud (VPC) console.

  2. Find and click the VPC ID of the Dify instance.

  3. On the Resource Management tab, hover over the Internet NAT Gateway area and click Create Now.

    image

  4. On the purchase page, fill in the configuration information such as Network and Zone and Instance Name. After completing the configuration, click Buy Now in the lower-right corner.

    The following table describes some of the parameters on the purchase page.

    Parameter

    Description

    Region

    The Region of the NAT Gateway must be the same as the Region of Dify.

    Network and Zone

    The VPC must be the same as the VPC of the Dify instance.

    Instance Name

    Set a name for the NAT Gateway instance.

    EIP

    If you have an existing EIP in the same region, choose the Select EIP option. Otherwise, you must purchase a new one.

    image

  5. After the purchase is successful, wait a few minutes for the resource to be ready.