All Products
Search
Document Center

ApsaraDB RDS:Create a migration account on a self-managed PostgreSQL instance

Last Updated:Feb 27, 2026

To migrate data from a self-managed PostgreSQL instance to ApsaraDB RDS for PostgreSQL, create a dedicated database account with replication privileges on the source instance. This account enables the cloud migration feature to stream data from your self-managed instance.

Prerequisites

Before you begin, ensure that you have:

  • A self-managed PostgreSQL instance deployed on an Elastic Compute Service (ECS) instance or in a data center

  • Administrative access to the self-managed PostgreSQL instance (a superuser or a role with CREATEROLE privilege)

  • An ApsaraDB RDS for PostgreSQL instance as the migration target

Procedure

The migration account requires three permissions: CREATEROLE, REPLICATION, and membership in the pg_monitor role.

If an account with these permissions already exists on the self-managed PostgreSQL instance, skip this procedure and proceed to Update the pg_hba.conf file of a self-managed PostgreSQL instance.
  1. Connect to the self-managed PostgreSQL instance and run the following SQL statement to create the migration account:

    CREATE USER migratetest CREATEROLE REPLICATION LOGIN PASSWORD '123456';
    Note: Replace 123456 with a strong, unique password. Do not use the example password in production environments.
    ParameterDescription
    migratetestAccount name. Replace with your preferred name.
    CREATEROLEGrants the ability to create and manage roles, required for the migration process.
    REPLICATIONEnables WAL (Write-Ahead Logging) streaming for data replication.
    LOGINAllows the account to establish connections.
    PASSWORDSets the login password for the account.
  2. Grant the pg_monitor role to the migration account:

    GRANT pg_monitor TO migratetest;

    The pg_monitor role provides read access to monitoring views and functions used to monitor database server activity, including replication progress.

  3. Verify that the account was created with the correct permissions:

    SELECT rolname, rolcreaterole, rolreplication FROM pg_roles WHERE rolname = 'migratetest';

    Expected output:

      rolname    | rolcreaterole | rolreplication
    -------------+---------------+----------------
     migratetest | t             | t

    To verify pg_monitor membership:

    SELECT pg_has_role('migratetest', 'pg_monitor', 'member');

    Expected output:

     pg_has_role
    -------------
     t

Next steps

Update the pg_hba.conf file of a self-managed PostgreSQL instance