How to Simplify Your Database Migration Using Amazon DMS


AllCloud Blog:
Cloud Insights and Innovation

Migrating your business to the cloud allows for easier management and better utilization of the cloud’s benefits. Since your database is one of the most important parts of your business, choosing the right cloud provider and migrating your databases to the cloud is critical. Amazon Relational Database Service (Amazon RDS) is an AWS service that enables us to easily set up, operate, and scale relational databases in the cloud. Amazon RDS is the leading vendor in the field of Database as a Service (DBaaS). DBaaS has become extremely important for organizations to support their growing data management needs. Scalability, performance, automation, and availability are just a few factors that are leading more organizations to use DBaaS instead of on-premises infrastructure. Another benefit of this service is that you can set up your database without any upfront payment—you only pay for the services you use.

Amazon RDS supports MySQL, MariaDB, PostgreSQL, Oracle, Microsoft SQL Server, and Amazon Aurora DB engines. If your database uses any of these database engines in your on-premises data center, your application will work properly once your database is running on an Amazon RDS instance.

Database Migration

Database migration is a demanding task that’s performed to change your database vendor, change the database software, or move your database to the cloud. One of the biggest challenges of database migration is performing it without affecting the application’s performance or user experience. The ultimate goal is to perform database migration without any downtime. If you can afford downtime or if your application has off-hours, migration isn’t a problem because you can disable writing to your database, perform a backup, and move the database wherever you want. After you’ve moved your database to the final location, you can restore it, perform a database endpoints update, and then the migration is complete. Unfortunately, lack of concern about downtime is rare—in most cases, the application needs to be available 24/7, which makes the task of migration challenging. The expressions “minimal downtime” and “virtually no downtime” don’t mean that the migration was performed without any downtime. At any moment, it’ll be necessary to perform a failover, which will cause minimal downtime, but downtime nonetheless.

What You Need to Know Before You Start

The database is one of the primary components of any application, so we have to approach migration carefully. Database migration usually includes more than just changing location from one data center to another or into the cloud—it also involves changing the database vendor. This vendor change means that the migration should be performed by an expert who knows the source and target of the vendor’s database. You need to know the size of your database, the size of the table inside the database, and the database schema. It’s also important to understand the types of data available in your database since many tools don’t support all data types. Another challenge is having objects, LOBs for example, because they can slow down the migration.

Migration to each individual cloud vendor has its own steps. To perform a migration correctly with a specific vendor, you need to understand that vendor’s conditions for networking, roles, permissions, accounts, etc. When you consider the ease of setup, ability to scale in a few simple steps, ability to resize capacity, and simplification of database administration tasks, Amazon RDS seems like an excellent option for a target database. For successful migration to Amazon RDS, you need to be familiar with backups, database updates, high availability, scalability, elasticity, and integration with other AWS services.

There are also limitations that you need to understand before you start the migration process. Be aware that you won’t have admin privileges over your database anymore, that there’s a storage limit, and that you won’t have SSH access to the host where your database is located.

Once you’ve created your DB instance inside Amazon RDS, you’ll get default configuration settings that’ll satisfy most of your needs. But if you want to change any of those settings, you can use parameter groups. DB parameter groups are containers for engine configuration values that are applied on the DB instances. You can edit parameter groups using AWS Console, CLI, or Amazon RDS API. For example, if you’re using a PostgreSQL RDS database instance, inside the parameter group you’ll find all of your PG tuning parameters that are usually in the postgresql.conf. file.

You don’t need to make a decision about everything before the migration because you can do some things after the process is completed. For example, if you migrate your MySQL database, you can use Amazon RDS Single-AZ MySQL as your target database, which will make the migration faster. Once the process is complete, you can convert your Amazon RDS database instance easily from Single-AZ into Multi-AZ mode.

Migrating Your Database Using AWS Database Migration Service (DMS)

Using commercial data migration and replication software is often expensive and difficult to configure. Some aspects of the migration won’t transfer directly between engines and there can be compatibility issues. So, depending on the amount of data you have, you may experience extended downtime.

How AWS DMS Can Simplify Migration

AWS DMS helps avoid all of these problems and migrates the database on AWS cloud with virtually no downtime. The only prerequisite is that the source or target database is on AWS. AWS DMS is a web service that enables migrating the data you use most from open-source and commercial databases such as Oracle, PostgreSQL, Microsoft SQL Server, Amazon Redshift, Amazon Aurora, MariaDB, MySQL, MongoDB, and SAP ASE to AWS. AWS DMS supports homogenous database engine migrations and heterogeneous migrations, where you can convert database engines or versions using the AWS Schema Conversion Tool.

During migration, we sometimes need to make changes to the existing database schema to match the target database engine. This task usually requires a lot of manual work or using expensive third-party tools. AWS Schema Conversion Tool enables heterogeneous database migration by automatically converting the source database schema into a format that’s compatible with the vendor’s target database. By using AWS Schema Conversion Tool, you can convert OLTP or OLAP schema. The tool is especially useful for migrating from commercial to open-source database engines.

Amazon improves their services and adds features constantly. One of the new features from the AWS DMS service is support for MongoDB. This feature enables you to set MongoDB as the source database inside DMS, making the migration process of MongoDB to DynamoDB much easier.

How to Perform the Migration

Using AWS DMS to migrate data to AWS is simple. You start by spinning replication instances in your AWS environment, and then AWS DMS connects the source and target database endpoints. You can choose what you want to migrate—DMS allows you to migrate tables, schemas, and whole databases. When migration begins, AWS DMS makes tables, loads data, and syncs the databases. Replication capability (which keeps the source and target data synced) allows you to switch applications to points on the target database at your convenience. Once the migration begins, most tasks are processed in the memory, but it’s important to note that cached transactions, bigger transactions, and log files might need to be buffered to a disk.

AWS DMS can migrate your data in several ways. The first is migration of data to the target database, where files or tables are created inside the target database, metadata needed by the target database are automatically defined, and tables are filled in with data from the source database. Another way to migrate is to capture changes during migration. Changes are captured to the source database while data is migrated to the target database. Once the process is completed, captured changes are executed on the target database in one transaction. This process guarantees transactional integrity in the target database. You can also use AWS DMS for ongoing replication, which is useful for disaster recovery. This process is called Replicating Only Data Changes on the Source Database. AWS DMS can also help perform migration in systems that contain LOBs because they can refrain from including LOB columns and can use full or limited LOB mode. DMS also enables you to have one source database and several target databases and vice versa, which you can use to avoid Amazon RDS storage limits.

Plan Twice, Migrate Once

The database migration process can be complicated, so you need a migration plan that can be adjusted to meet your workflow needs. It isn’t necessary to perform migration of all of your critical applications at once—start with less critical applications. Migration benefits outweigh the challenges of performing the migration process. With proper planning and information gathering, migration can be significantly easier.

To make the process as smooth as possible, make a migration checklist and include it in your plan. Read this checklist before you start:

Image 1. Database migration checklist

Conclusion

There are many advantages of using AWS DMS services. It’s easy to set up, low in cost, supports a wide variety of database engines, and performs constant network connectivity monitoring of target databases and replication instances. Unlike other third-party services, you only pay for compute and storage resources used, making AWS DMS very cost-effective. AWS DMS can be your replication and migration Swiss Army knife; it’ll help you migrate database workloads to AWS and change database engines while minimizing downtime. According to AWS, 20,000 database migrations to AWS cloud were performed using AWS DMS. With such widespread success using the product, there’s no reason not to migrate your database to Amazon RDS.

Image 1. Database migration checklist

Conclusion

There are many advantages of using AWS DMS services. It’s easy to set up, low in cost, supports a wide variety of database engines, and performs constant network connectivity monitoring of target databases and replication instances. Unlike other third-party services, you only pay for compute and storage resources used, making AWS DMS very cost-effective. AWS DMS can be your replication and migration Swiss Army knife; it’ll help you migrate database workloads to AWS and change database engines while minimizing downtime. According to AWS, 20,000 database migrations to AWS cloud were performed using AWS DMS. With such widespread success using the product, there’s no reason not to migrate your database to Amazon RDS.

Shay Gury

Read more posts by Shay Gury