Created
December 4, 2023 07:29
-
-
Save INDIAN2020/72667bec4a1d963dd8e5d5f8adcdfc0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STEP 1: Install the AWS CLI tool in Cloud Shell to access the AWS resources from Google Cloud. | |
machine@cloudshell:~(xxyyxyyxyxyx)$ sudo apt-get update && sudo apt-get install dnsutils -y | |
machine@cloudshell:~(xxyyxyyxyxyx)$ dig <HOSTNAME> | |
machine@cloudshell:~(xxyyxyyxyxyx)$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
machine@cloudshell:~(xxyyxyyxyxyx)$ unzip awscliv2.zip && sudo ./aws/install | |
machine@cloudshell:~(xxyyxyyxyxyx)$ aws configure | |
Ask for: | |
AWS Access Key ID [None]: | |
AWS Secret Access Key [None]: | |
Default region name [None]: | |
Configure the AWS account by giving the following properties: | |
1. AWS ACCESS KEY ID | |
2. AWS SECRET ACCESS KEY | |
3. Region | |
STEP 2: Creating a new connection profile. | |
https://cloud.google.com/sdk/gcloud/reference/database-migration/connection-profiles/create | |
Goto the Database migration > Connection profile from GCP home burger icon. | |
Click on "CREATE PROFILE" button. | |
Select Database engine as "Amazon RDS for MySQL" | |
Connection profile name as "mysql-rds" | |
Paste AWS RDS Database - Source link (mysql://<HOSTNAME>:3306/SourceMySQLDatabase) into "Hostname or IP address" box (remove mysql:// and :3306/SourceMySQLDatabase) | |
Paste username & password then click on create. | |
COMMAND: gcloud database-migration connection-profiles create mysql $PROFILE --region=us-central1 --password=123456 --username=my-user --host=$HOST_IP --port=3306 | |
Where PROFILE = "mysql-rds" | |
REGION = "us-central1" | |
HOST_IP = $(dig AES_MYSQL_HOST_DNS_NAME) gives IP address | |
STEP 3: Creating a one-time migration job. | |
Goto the Database migration > Migration jobs | |
Click on "CREATE MIGRATION JOB" | |
In Get started: | |
Type rds-to-cloudsql in "Migration job name" | |
Select "Amazon RDS for MySQL" in Source database engine | |
Select "One-time" for Migration job type | |
Click "SAVE & CONTINUE" | |
In Define a source: | |
Select "mysql-rds" in Select source connection profile | |
Click "SAVE & CONTINUE" | |
In Create a destination: | |
Type "mysql-cloudsql" in Destination Instance ID | |
Create new secure password (Save it in another place) | |
Select "Cloud SQL for MySQL 5.6/5.7/8.0" (If your source MySQL is older than supported, then do manual backup and import) | |
Select "Standard" in Machine Type | |
Select "" storage capacity | |
Click "CREATE & CONTINUE" | |
Define connevity method: | |
Select "IP allowist" | |
Wait till the Destination outgoing IP address popup (Save it in another place <a.b.c.d>) | |
Click "SAVE & CONTINUE" | |
Step 4: Configuring the outgoing destination IP allow list in Amazon RDS. | |
Open the cloudshell and type: | |
aws ec2 authorize-security-group-ingress --group-id <sg-id> --protocor tcp --port 3306 --cidr <a.b.c.d>/32 | |
Where sg-id = AWS RDS Database Security Group | |
To list DB security groups: aws rds describe-db-security-groups | |
Step 5: Testing and Creating a Migration job. | |
Goto the Database migration > Migration jobs | |
References: | |
https://www.youtube.com/watch?v=pR7BV0fTmI0 | |
https://www.youtube.com/watch?v=zUNFEtptYsc | |
https://dxhero.io/migrating-aws-rds-to-cloud-sql-using-gcp-dms/ | |
https://medium.com/google-cloud/migrating-aws-rds-to-cloud-sql-using-gcp-dms-3614fda55d9e | |
https://www.mouritech.com/2022/01/21/migrating-data-from-amazon-rds-to-cloud-sql-using-dms/ | |
Ask for: | |
AWS Access Key ID [None]: | |
AWS Secret Access Key [None]: | |
Default region name [None]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment