DEVELOPER BLOG

HOME > DEVELOPER BLOG > 【Introduction to AWS】Achieving Data Migration from PostgreSQL with AWS DMS - PrismScaler

【Introduction to AWS】Achieving Data Migration from PostgreSQL with AWS DMS - PrismScaler

1. Introduction

Hello! We are a writer team from Definer Inc. In this issue, you are wondering how to migrate data from PostgreSQL using AWS Database Migration Service (DMS). Let's take a look at the actual screens and resources to explain in detail.

2. Purpose/Use Cases

This article summarizes information and practices that can be helpful when you want to achieve data migration from PostgreSQL with the AWS Database Migration Service (DMS). AWS DMS (Database Migration Service) can be used in the following cases:
  • Migrating on-premises databases to AWS Cloud.
  • Migrating databases between different database engines.
  • Migrating databases within the same database engine for upgrades or region changes.
  • Consolidating multiple databases into a single database on AWS.
  • Continuous data replication for reporting, backup, or disaster recovery.
  • Replicating databases across different AWS regions for high availability.

3. What is AWS Database Migration Service?

AWS DMS (Database Migration Service) is a cloud-based solution by Amazon Web Services that enables easy and efficient migration of databases. With AWS DMS, organizations can seamlessly move their on-premises databases to the AWS Cloud, migrate between different database engines, consolidate databases, and perform continuous data replication across regions. It provides a robust and scalable platform for data migration and replication tasks, minimizing downtime and ensuring data integrity. AWS DMS simplifies the process of database migration, enabling organizations to leverage the benefits of cloud computing and seamlessly transition their data to AWS services.   The following three terms are important to remember when using the Database Migration Service:   ・Endpoint Endpoint is the definition of the connection information to the database. There are two endpoints, one for the source DB and the other for the target DB.   ・Replication Instance This is the instance that connects the source and target DBs and executes the data replication task.   ・Replication Task This is the execution unit of data replication and where data migration is actually performed.     The following three patterns exist as data replication methods:   ・Full load The specified table data is migrated from the source DB to the target DB as it is. A "full load" is a data migration process where the entire source database is copied to the target database during the initial migration. It is typically used to perform the initial bulk transfer of data from the source database to the target database.   ・Full load + CDC (continuous replication) Full load is executed while capturing changes in the source DB. After the full load is completed, the captured changes are periodically reflected in the target DB. The full load establishes the initial copy of the data, while CDC enables the ongoing synchronization of changes between the source and target databases, keeping them up to date. This combination allows organizations to migrate their databases with minimal disruption and maintain data consistency throughout the migration process and beyond.   ・CDC (Continuous replication) Without performing a full load, changes in the source DB are periodically read and the changed data is reflected in the target DB.     We will also briefly review PostgreSQL. PostgreSQL is an open source (OSS) relational database. It is free to use and is available for Linux and Mac as well as Windows. It has a very liberal license, so there is no obligation to publish your own customizations.

4. PostgreSQL Migration with MDS

Let's try out the Database Migration Service. As a prerequisite, it is assumed that the source PostgreSQL database exists.   ① Create the RDS that will be the migration destination (target). Access the RDS console, click on the "Databases" tab, then "Create Database Create Standard" -> "PostgreSQL" engine type Select the same engine version as the source DB, 13.6. For the template, a free usage frame was used this time. The master user's ID and password are necessary for the subsequent work, so they should be noted down.   ② Creating a replication instance of DMS Go to the DMS console and select "Replication Instance" -> "Create Replication Instance". Enter the name, instance class, and network information such as VPC and SecurityGroup. For Public Access, check the box if you need to connect to the replication instance from the source/target DB via the Internet. Wait a few minutes for the creation to complete.     ③ DMS endpoint creation Two endpoints, one for the source DB and one for the target DB, need to be created. In the DMS console, click "Endpoints" -> "Create Endpoints". For the source DB, user ID/password and other connection information were entered. Since the target DB is RDS, "Select RDS DB instance" was checked.     ④ Creating DB migration task In the DMS console, click "Database Migration Task" -> "Create Task". Specify the endpoints and replication instances created earlier. For the data replication type, we selected "Full load" this time.   When the status becomes "Load Complete", replication is complete. After logging into the DB and checking the table list, the DB migration was successful.
## Login to postgreSQL
psql -p 5432 -d ${Database Name} -U postgres -h ${RDS Endpoints}                
 

Display DB table list
\dt
                    List of relations
 Schema |            Name             | Type  |  Owner   
--------+-----------------------------+-------+----------
 dev    | all_employee                     | table | postgres
 dev    | all_devision                   | table | postgres                  

5. Cited/Referenced Articles

6. About the proprietary solution "PrismScaler

・PrismScaler is a web service that enables the construction of multi-cloud infrastructures such as AWS, Azure, and GCP in just three steps, without requiring development and operation. ・PrismScaler is a web service that enables multi-cloud infrastructure construction such as AWS, Azure, GCP, etc. in just 3 steps without development and operation. ・The solution is designed for a wide range of usage scenarios such as cloud infrastructure construction/cloud migration, cloud maintenance and operation, and cost optimization, and can easily realize more than several hundred high-quality general-purpose cloud infrastructures by appropriately combining IaaS and PaaS.  

7. Contact us

This article provides useful introductory information free of charge. For consultation and inquiries, please contact "Definer Inc".

8. Regarding Definer

・Definer Inc. provides one-stop solutions from upstream to downstream of IT. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition/design development/implementation, and maintenance and operation. ・We are committed to providing integrated support for advanced IT technologies such as AI and cloud IT infrastructure, from consulting to requirement definition, design development, implementation, maintenance, and operation. ・PrismScaler is a high-quality, rapid, "auto-configuration," "auto-monitoring," "problem detection," and "configuration visualization" for multi-cloud/IT infrastructure such as AWS, Azure, and GCP.