AWS Database Migration-Heterogenous Approach using DMS.
Tags: database, migration, rds, aws
Published: 2024-02-15 02:12:56

## Introduction

Ever wondered how you can migrate your database (data) from OnPrem to AWS Cloud, AWS RDS to AWS RDS or to S3 Bucket?
Then this article is for you.
We will delve into heterogeneous migration.

## Table of Contents

- Define whats data migration?

- Data Migration strategies.

- Define heterogeneous migration.

- We will use Mysql and Postgres as our databases for the use case.

### Data Migration

Data migration is the movement of data from source systems to target systems (destination systems), depending on the environment in which the data is sitting.
For example, a database, say Postgres, can be running in an EC2 instance, and the client wants to migrate the database to the AWS Relational Database System(Aurora Postgres).In this case client will need help in knowing how they want to migrate to their preferred database. Thats where these services comein.

## Data Migration Strategies

These are approaches used to migrate workloads to the AWS Cloud.
I will just mention all the approaches here only.
- Retire
- Retain
- Rehost
- Relocate
- Repurchase
- Replatform
- Refactor or re-architect

## Heterogenous Migration

When we talk about heterogenous migration, we talk about migrating data from totally different databases.
Meaning that Source database has completely different schema compared to the target database.
For example, from MySQL to Postgres or vice versa or from SQL Server to Postgres or from Posgres to Oracle.

We will first step into steps of migration:

1. Review Data Sources by checking the environment,schema,tables etc.

2.Determine the destination
 We access where the organization wants its data to sit.3. 

3.Data Migration strategy
At this point, we focus on creating a migration plan so that we understand clearly the requirements for the migration.

We will be able to:
- assess security requirements.
- Cost and time to be taken.
- systems and data migration tools.
- Implement.
- Test the connections.
- Run the migrations.

Our case, we will illustrate the process of migrating a AWS MySQL database to AWS Postgres (RDS).We will cover the demo in our next article.

**Process**

1. Create the source and target databases and insert data in the source schema(MYSQL).
2. We will be using AWS Data Migration Service and Schema Conversion Tool (AWS SCT) which we will download.
3.The first step here will be Performing Schema conversion.We convert the schema of mysql database to a PostgreSQL schema using AWS SCT.

In order to convert we need to connect our database endpoints in AWS SCT Tool locally.
Please see the below preview.

![AWS SCT](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gajp3pfdgoiz3cnsp40r.png)

4.Navigate now to AWS Data Migration Service to create endpoints source and target,create replication instance and data migration tasks. At this point we wont focus on using serverless and also  Data Migration projects we save them for later.
After creating the migration task we perform full load as shown below.

![Data Migration Service](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/68h0w6jjyp1i3j69iusg.png)

At this point we can confirm in our data whether it was migrated and successful.We can see we are successful;

![success](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2tqbu57e4qp2p5gstpjy.png)

## Conclusion

In conclusion, in this article, we covered data migration, strategies, a plan, and heterogenous migration. You realise we didn't go too technical, as we plan to have the next article contain full technical details explaining each process from connection using endpoints and IP addresses to creating migration tasks one by one. I hope you enjoyed.
Cheers! and Happy Learning.