Wordpress Website Database Migration from AWS to GCP

Harsh Muniwala
Petabytz
Published in
3 min readJul 23, 2019

Prerequisites

  • Wordpress is required in both AWS Ec2 instance and GCP Compute Engine instance.

In Google Cloud Platform

In Amazon Web Service

  • We installed in both using shell script
#!/bin/bash
yum update -y
yum upgrade -y
yum install wget zip unzip -y
yum install httpd -y
yum groupinstall Mariadb Mariadb-client -y
yum install php -y
systemctl restart httpd
systemctl enable httpd
wget https://wordpress.org/latest.zip
unzip -d /var/www/html/ latest.zip
mv /var/www/html/wordpress/* /var/www/html/
restorecon -Rv /var/www/
mysql -u root <<MYSQL_SCRIPT
CREATE DATABASE wordpress;
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'wordpress123';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
systemctl restart mariadb
systemctl enable mariadb
firewall-cmd --permanent --add-service={http,https}
fireall-cmd --reload

Note : This is script for Redhat 7 OS instance. If you are using different OS then you have to modify according to that in this file.

  • Installation process of wordpress

Migration Process

1. Created Multiple users in AWS Ec2 instance wordpress site.

2. Reviewing Database

3. Creating Database dump file for migrating database

4. Users Table data in Compute Engine is different from Ec2.

5. Uploaded that database file from Ec2 instance to GCP Cloud Storage.

6. Getting file from Cloud Storage to GCP Compute Engine

7. Updating database of GCP wordpress website

8. Successfully Migrated Database of wordpress site from AWS to GCP

--

--