Data Migration from MariaDB to Redshift using AWS Data Migration Service (DMS)
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.
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.
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.
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.
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.
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.
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.