×

Data Migration from MariaDB to Redshift using AWS Data Migration Service (DMS)

Shiv Deshmukh
Shiv Deshmukh

Thursday, June 24th, 2021

Read Time
3 min read

The AWS Database Migration Service (DMS) helps you migrate databases to AWS quickly and securely. The source database remains fully operational during the migration, minimizing downtime to applications that rely on the database. With the AWS Database Migration Service, you can migrate your data to and from most widely used commercial and open-source databases.

The following steps explain how to migrate a database from the AWS MariaDB to AWS Redshift using DMS.

Step 1: Create DMS replication instance

From the DMS console, select Replication instances and then Create replication instance.

Create DMS replication instance

mariadb-to-redshift-migration

replication instance

Step 2: Create DMS Source Endpoint

From DMS console, select Endpoints: and then Create endpoint. Select the respective ARN under Server name, port and credentials for the MariaDB instance to be connected.

DMS Source Endpoint

Trellis_MariaDB

Step 3: Create DMS Target Endpoint

In order to create a target endpoint for your Redshift cluster, we need the following IAM role associated with a Redshift cluster for DMS to access it.

DMS Target Endpoint

DMS Target Endpoint_summary

DMS Target Endpoint_summary_2

Now from the DMS console, select Endpoints and then Create endpoint. Select respective ARN under Server name, port, credentials and database name to connect the Redshift cluster.

Create endpoint

Trellis_maridb_redshift_dms

Step 4: Create Database Migration Task

Now from the DMS console, select Database migration tasks and Create task.

Select the respective replication instance, source and target endpoints created above from the dropdown list and other specifications as needed.

Database Migration Task

Database Migration Task_Table Mapping

mariadb_to_redshift_migration_task

Based on the option selected above, the database migration task is automatically started after creating the task. This task can be executed periodically on a specified schedule using a Lambda function.

Once the task is completed (you’ll see Load complete), we should see the db, schema and tables in your target Redshift cluster.

Amazon Redshift

The above screenshot shows the schema with countrydata and table. countrycaps is migrated from MariaDB in Redshift.

Once these tables are available, we can execute queries in Redshift on this DB as well as across other DBs within the Redshift cluster.

Amazon Redshift_1

Amazon  Redshift_2