Logo

dev-resources.site

for different kinds of informations.

Database Migration steps with the AWS CLI - 1

Published at
1/31/2023
Categories
cli
dms
migration
Author
awsmine
Categories
3 categories in total
cli
open
dms
open
migration
open
Author
7 person written this
awsmine
open
Database Migration steps with the AWS CLI - 1

According to AWS documentation "AWS Database Migration Service (AWS DMS) is a cloud service that makes it possible to migrate relational databases, data warehouses, NoSQL databases, and other types of data stores. You can use AWS DMS to migrate your data into the AWS Cloud or between combinations of cloud and on-premises setups."

The process of Database Migration consists of creating and setting up a replication instance, source and target endpoints, and a replication task. The replication task runs on the replication instance and migrates data from the source endpoint to the target endpoint.

In the 1st article, Database Migration steps with the AWS CLI - 1, I will be showing on how to create and set up a replication instance, source and target endpoints.

The rest of the steps will be covered in my 2nd article.

You can use the AWS DMS console or the AWS CLI or the AWS SDK to perform the database migration.

Please visit my GitHub Repository for Database Migration articles on various topics being updated on constant basis.

Let’s get started!

Objectives:

1. Create a replication instance.

2. Describe the replication instance.

3. Create the source and target endpoints.

4. Test source and target endpoints from the replication instance.

5. Describe connections to the source and target endpoints.

Pre-requisites:

  • AWS user account with admin access, not a root account.
  • Cloud9 IDE with AWS CLI.

Resources Used:

AWS Database Migration Service

AWS CLI Command Reference on DMS

Steps for implementation to this project:

1. Create a replication instance.

  • A replication instance is an Amazon EC2 instance that can host
    replication tasks within AWS DMS.

  • Use the following command to create a replication instance with the name dms-instance.

dms-instance

aws dms create-replication-instance --replication-instance-identifier dms-instance --replication-instance-class dms.t2.micro --allocated-storage 50

Enter fullscreen mode Exit fullscreen mode
  • This command creates the replication instance on a t2.micro instance with 50 GB of allotted storage.

  • Use default values for other parameters.

2. Describe the replication instance.

  • Run the following command to describe the replication instance.

  • The response of this command will include the status of create-replication-instance.

aws dms describe-replication-instances --filter=Name=replication-instance-id,Values=dms-instance

Enter fullscreen mode Exit fullscreen mode
  • Run the following command to save the ReplicationInstanceArn for use in later steps.

ReplicationInstanceArn

rep_instance_arn=$(aws dms describe-replication-instances --filter=Name=replication-instance-id,Values=dms-instance --query 'ReplicationInstances[0].ReplicationInstanceArn' --output text)

Enter fullscreen mode Exit fullscreen mode
  • Wait 4-5 minutes to create the replication instance.

3. Create the source and target endpoints.

  • An endpoint describes the connection address, credentials, and other information required to connect to a database.

  • Run the following command to create the source and target endpoints.

  • Provide source and target database details like the engine-name, the hostname and port and the username and password.

source-endpoint

aws dms create-endpoint --endpoint-identifier source-endpoint --endpoint-type source --engine-name --username --password --server-name --port

Enter fullscreen mode Exit fullscreen mode

target-endpoint

aws dms create-endpoint --endpoint-identifier target-endpoint --endpoint-type target --engine-name --username --password --server-name --port

Enter fullscreen mode Exit fullscreen mode
  • Run the following commands to save the endpoint ARNs for use in later steps.

source_endpoint_arn

source_endpoint_arn=$(aws dms describe-endpoints --filter="Name=endpoint-id,Values=source-endpoint " --query="Endpoints[0].EndpointArn" --output text)

Enter fullscreen mode Exit fullscreen mode

target_endpoint_arn

target_endpoint_arn=$(aws dms describe-endpoints --filter="Name=endpoint-id,Values=target-endpoint" --query="Endpoints[0].EndpointArn" --output text) 

Enter fullscreen mode Exit fullscreen mode

4. Test source and target endpoints from the replication instance.

  • After the replication instance is active and the endpoints have been successfully created and before you save your endpoint, you should test the connection to ensure it was configured correctly.

  • Run the following commands to test connectivity tests from the replication instance to the database endpoints:

aws dms test-connection --replication-instance-arn $rep_instance_arn --endpoint-arn $source_endpoint_arn

Enter fullscreen mode Exit fullscreen mode
aws dms test-connection --replication-instance-arn $rep_instance_arn --endpoint-arn $target_endpoint_arn 

Enter fullscreen mode Exit fullscreen mode

5. Describe connections to the source and target endpoints.

  • Describe the connections to ensure that the tests are successful.

  • If the test connection fails, it must be fixed and retested.

aws dms describe-connections --filter "Name=endpoint-arn,Values=$source_endpoint_arn,$target_endpoint_arn"

Enter fullscreen mode Exit fullscreen mode

What we have done so far

We have successfully demonstrated on how to create and set up a replication instance, source and target endpoints.

dms Article's
30 articles in total
Favicon
Top 9 Challenges and Solutions for eDMS Software in Pharma Industry
Favicon
Optimizing Security and Efficiency in AWS Database Migration with DMS: Understanding Outbound-Only Connectivity
Favicon
Database and Their Relationships
Favicon
AWS Database Migration Service now includes enhanced monitoring dashboard for your DMS tasks
Favicon
AWS DMS Table failure due to freeze period in source
Favicon
Building a Scalable Data Platform: Addressing Uncertainty in Data Requirements with AWS
Favicon
Testing AWS Database Migrations & Accelerating Development with Cloud Pods
Favicon
DMS error - Failed to get the capture list from the endpoint
Favicon
Distribution Management Software
Favicon
Troubleshooting and Fixing AWS DMS Instance Creation Error
Favicon
Why AWS DMS is loved by ETL experts
Favicon
RDS Database Migration Series - A horror story of using AWS DMS with a happy ending
Favicon
Migrando geometries con DMS
Favicon
Download Amazon invoices automatically
Favicon
Amazon Rechnungen automatisiert herunterladen
Favicon
Jeder braucht ein DMS zuhause
Favicon
Everyone needs a DMS at home
Favicon
Using DMS to replicate data from RDS(MySQL) to Open Search
Favicon
How can product suppliers balance DMS benefits with integration challenges for an efficient supply chain?
Favicon
AWS DMS - Database Migration to AWS
Favicon
Database Migration steps with the AWS CLI - 2
Favicon
Database Migration steps with the AWS CLI - 1
Favicon
AWS DMS and Prefect: The Key to Building a Robust Data Warehouse
Favicon
Migrating a MySQL database to AWS RDS using AWS DMS with zero downtime
Favicon
Case Study: How to replicate database from AWS to outside?
Favicon
Build An App Like Amazon - Amazon Clone App
Favicon
Implementing Change Data Capute (CDC) with Aurora Serverless v2
Favicon
Configure SSL between RDS and Weblogic / DMS endpoint
Favicon
How to use SQL Developer’s Diff Wizard to Complete a DMS Migration for Oracle 12c
Favicon
AWS Database Migration Service: Limitations

Featured ones: