×
Community Blog Streamline Your Database: Migrating and Replicating AWS RDS PostgreSQL to Alibaba Cloud PolarDB

Streamline Your Database: Migrating and Replicating AWS RDS PostgreSQL to Alibaba Cloud PolarDB

This tutorial describes how to migrate and replicate AWS RDS PostgreSQL to Alibaba Cloud PolarDB.

by Andre Budiman Kramadibrata, Solution Architect Alibaba Cloud Indonesia

Introduction

Migrating from AWS RDS PostgreSQL to Alibaba Cloud PolarDB presents a strategic opportunity for businesses to enhance database performance and scalability. PostgreSQL, known for its reliability and advanced features, is widely utilized in various applications. While AWS RDS simplifies PostgreSQL deployment by automating many administrative tasks, the need for more robust and cost-effective solutions is driving businesses to consider Alibaba PolarDB as a compelling alternative.

Alibaba Cloud PolarDB is a next-generation relational database that fully supports PostgreSQL, making migration straightforward. PolarDB's architecture decouples computing from storage, enabling automatic scaling, high performance, and vast storage capabilities. This design allows data sharing across all compute nodes, ensuring seamless scaling and rapid disaster recovery, which are critical for maintaining business continuity.

Migrating to PolarDB not only provides enhanced scalability and reliability but also integrates with the Alibaba Cloud ecosystem. This integration unlocks additional cost savings and efficiencies, making PolarDB a compelling choice for businesses looking to optimize their database operations while leveraging the full suite of Alibaba Cloud services.

Architecture Diagram

1

Assume that both AWS and Alibaba VPCs are already configured with a Site-to-Site VPN (VPN S2S).

The migration process involves setting up a secure connection between AWS and Alibaba Cloud, using Database Gateway to connect AWS RDS PostgreSQL to PolarDB, and Data Transmission Service (DTS) for replication.

Preparation

Before migrating, ensure that AWS RDS PostgreSQL and Alibaba PolarDB are properly configured. This involves enabling logical replication in AWS and setting up a Database Gateway on Alibaba Cloud. Refer to the official documentation for detailed instructions.

And below are the preparation steps:

1.  Datasource: I'm using the Northwind sample database, which can be found at Northwind on GitHub.

2.  AWS RDS PostgreSQL: For self-managed PostgreSQL databases, the wal_level parameter must be set to logical to migrate incremental data.

In AWS RDS PostgreSQL or Aurora PostgreSQL, set the rds.logical_replication parameter in your DB cluster parameter group to 1. This static parameter change requires a reboot of the DB instance to take effect. Please also refer to User Guide for Aurora.

2

3.  Alibaba Cloud Database Gateway: Connect your Database Gateway to AWS RDS PostgreSQL, for details about create Database gateway, you can refer to Database Gateway Documentation.

4.  Alibaba Cloud PolarDB: Create the polarDB cluster as a target, for details you can refer to PolarDB for PostgreSQL Documentation.

Migration and Replication

Data Transmission Service

After setting up AWS RDS PostgreSQL, Database Gateway, and PolarDB as the target, the next step is to configure DTS for replication.

Step 1: Configure Source and Target Databases

Fill in the source and target database information. For the source, select Database Gateway as the access method. For the target, select the previously created PolarDB instance. DTS will then perform a connectivity test for both the source and target databases.

3

Step 2: Configure Task Objects

Choose the objects you want to replicate. In this use case, select all tables from the source database.

4

Step 3: Prechecks

DTS will perform pre-checks before proceeding with the replication. If all checks pass, you can continue to purchase a DTS instance.

5

Step 4: Purchase the DTS Instance

Complete the purchase process for the DTS instance.

6

Step 5: Monitor the DTS Task and Review Replication Results

Monitor the DTS task to ensure it runs smoothly and review the replication results to confirm that the data has been accurately replicated. Additionally, perform several DML operations on the source database and verify that they are correctly replicated on the target database.

7
8

Conclusion

Migrating and replicating databases from AWS RDS PostgreSQL or AWS Aurora PostgreSQL to Alibaba Cloud PolarDB can be efficiently achieved using Data Transmission Service (DTS). This process allows you to maintain data consistency while leveraging the advanced features of PolarDB.

A key difference to note is that while the wal_level parameter is typically used in self-managed PostgreSQL for enabling logical replication, it is not available in AWS RDS or Aurora. Instead, you need to set the rds.logical_replication parameter to 1 in your DB cluster parameter group. This configuration change requires a reboot of the DB instance to take effect.

By carefully following the steps outlined, you can ensure a smooth migration and replication process, enabling you to take full advantage of Alibaba Cloud's robust and scalable database solutions. We encourage you to explore the powerful capabilities of Alibaba PolarDB and start your migration journey today. If you need further guidance, Alibaba Cloud's comprehensive documentation and support are readily available to assist you.

0 1 0
Share on

Alibaba Cloud Indonesia

99 posts | 15 followers

You may also like

Comments

Alibaba Cloud Indonesia

99 posts | 15 followers

Related Products

  • PolarDB for PostgreSQL

    Alibaba Cloud PolarDB for PostgreSQL is an in-house relational database service 100% compatible with PostgreSQL and highly compatible with the Oracle syntax.

    Learn More
  • Database Migration Solution

    Migrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.

    Learn More
  • Oracle Database Migration Solution

    Migrate your legacy Oracle databases to Alibaba Cloud to save on long-term costs and take advantage of improved scalability, reliability, robust security, high performance, and cloud-native features.

    Learn More
  • PolarDB for Xscale

    Alibaba Cloud PolarDB for Xscale (PolarDB-X) is a cloud-native high-performance distributed database service independently developed by Alibaba Cloud.

    Learn More