The database is one of the primary components of any application and database migration is a demanding task that is performed to change your database vendor, change the database software, or move your database to the cloud.
Challenge: There are many tools available in the market today which can be used for migration but the key concern is performing the migration without affecting the application’s performance or user experience. The ultimate goal is to perform database migration quickly and securely, without any downtime.
Solution: AWS Database Migration Service (AWS 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.
The AWS Database Migration Service can migrate your data to and from the most widely used commercial and open-source databases.
Supported source databases: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Introduction.Sources.html Supported target databases: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Introduction.Targets.html
1. Supports homogeneous migrations such as Oracle to Oracle, as well as heterogeneous migrations between different database platforms, such as Oracle or Microsoft SQL Server to Amazon Aurora. 2. Continuously replicate data with low latency from any supported source to any supported target. 3. Simple to use- There is no need to install any drivers or applications, and it does not require changes to the source database in most cases. 4. Supports widely used databases 5. Low cost 6. On-going replication
The following walkthrough will show you how to move your Microsoft Azure SQL database to the Microsoft SQL database hosted in aws ec2 instance.
Step 1: Create a Replication Instance An AWS DMS replication instance performs the actual data migration between source and target. The replication instance also caches the changes during the migration. How much CPU and memory capacity a replication instance has influences the overall time required for the migration. Use the following procedure to set the parameters for a replication instance. To create an AWS DMS replication instance, do the following:
Sign in to the AWS Management Console, and open the AWS DMS console and choose Replication instances.
Choose Create replication instance
On the Create replication instance page, specify your replication instance information as shown following:
Name — Name for your replication ec2 instance Instance class — AWS DMS can use a fair bit of memory and CPU. If you have a large database (many tables) or use a number of LOB data types, setting up a larger instance is probably better. VPC — Here you can choose the VPC where your replication instance will be launched. We recommend that, if possible, you select the same VPC where either your source or target database is (or both). AWS DMS needs to access your source and target database from within this VPC. If either or both of your database endpoints are outside of this VPC, modify your firewall rules to allow AWS DMS access. Publicly accessible — If either your source or your target database are outside of the VPC where your replication instance is, you need to make your replication instance publicly accessible.
Step 2: Create your Azure Mysql source endpoint While your replication instance is being created, you can specify the Microsoft Azure Mysql source endpoint using the AWS Management Console. However, you can only test connectivity after the replication instance has been created, because the replication instance is used to test the connection. To specify source or target database endpoints, do the following:
In the AWS DMS console, choose Endpoints on the navigation pane.
Choose Create endpoint and specify your connection information
Endpoint Identifier — Name for your target connection Source Engine — Microsoft Azure SQL Database Server name — If your database is on-premises, type an IP address that AWS DMS can use to connect to your database from the replication server. If your database is running on Amazon Elastic Compute Cloud (Amazon EC2) or Amazon RDS, type the public Domain Name Service (DNS) address. Port — Type the port which your database is listening for connections (the Microsoft SQL default is 1433). Username — Type the source db username here Password — Type the password Database name — Type the database name here
Before you save your endpoint, you can test it. To do so, select a VPC and replication instance from which to perform the test.Step
3: Create your Ec2 Mysql target endpoint
Create the target endpoint with the target db credentials as Step 2.
Step 4: Create a Migration Task When you create a migration task you tell AWS DMS exactly how you want your data migrated. Within a task you define which tables you’d like migrated, where you’d like them migrated, and how you’d like them migrated. Here in my walkthrough, Iam going to migrate 2 tables ‘AmpJobLogs’ and ‘WebJobLogs’ from source to destination db. To create a migration task, do the following:
On the navigation pane, choose Tasks.
Choose Create Task.
On the Create Task page, specify the task options
Step 5: Save Click save and monitor your migration progress. Once the task is finished you will get the status as Load Complete as shown below.