How to Migrate Your Magento Site to Google Cloud with Minimal Downtime
- The latest version of Google Chrome
- Firefox
- Microsoft Edge
- Microsoft Internet Explorer 11 and later
- Safari 8 and later. Note that Safari in private browser mode is not supported.
- All Linux VM images are natively available in Google Cloud.
No additional software or browser extensions are needed. Log in to Google Cloud Console and go to Menu ==> Compute Engine ==> VM instances.
In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to.

Alternatively, you can open an SSH connection to an instance by clicking its name and SSH from the instance details page.
An SSH terminal window with the Ubuntu Linux instance created in the series’s second post will open.
You should now be able to run commands in Ubuntu Linux created on the Google Cloud server.

Install LAMP or LEMP on the new server before migration
Before migrating your Magento site, you must install the same software stack, like LAMP or LEMP, on your new Google Cloud server that your old server uses. This means installing essential packages such as Apache or Nginx, MySQL, and PHP to ensure everything is compatible and your site works correctly.
Your goal is to make sure the new Google server has all the same server configurations and software packages as your current one. We’ve listed some helpful posts that you can use to install Apache, Nginx, MySQL, MariaDB, or PHP.
Some other posts that you may want to use when installing LAMP or LEMP on Ubuntu Linux.
- How to install Apache on a Google Cloud server (alternative to Nginx)
- How to install Nginx on a Google Cloud server (alternative to Apache)
- How to install PHP on a Google Cloud server
- How to install MySQL or MariaDB database server
You can use the posts above to install the same servers and packages you have installed on your current server. However, if you want to install specific packages on your new server, use the same posts mentioned above.
Once all the packages are installed, you can transfer content from your current server to the new one.
Configure your new Google server similar to your current server
To make your new Google Cloud server work just like your old one for a smooth Magento migration, you need to match key settings. This includes ensuring your web server (Apache or Nginx) settings, directory structures, and PHP configurations are exactly the same on both servers.
Ensure the web server (Apache or Nginx) settings are on old and new servers, including the same directory structure and Virtual Host or Server block content.
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
Your PHP configuration should also be identical to your current server’s PHP settings. Use the post above to install a specific PHP version and all the modules on your current server.
- PHP directory: /etc/php/
Your MySQL or MariaDB configurations should also mimic your current server. Validate each file, directory, and other data to ensure your new server is no different from your current server before migration.
- MySQL / MariaDB directory: /etc/mysql/
Once you have that done, you can continue with the migration process.
Back up current server data and database before migration
Backing up all your Magento website files and database from your current server is a critical step before your Magento migration to Google Cloud. Stop any changes to your site before starting the backup to ensure all your data is safe and accurate for the move.
You need to move your Magento website content and database content to the new server. Back up the website content as well as the content in the database.
Before backing up your current server, stop all changes. You don’t want new ones added after the backup is complete.
To back up Magento content, log on to your server via SSH if you have access. Once on your current server SSH console, run the commands below to back up your Magento content, usually at this location: /var/www/html/.
When you run the commands below, a backed-up file named current-server-backup.tar will be created with your Magento content.
The database backup process requires using the root account or an account with full access to the database. This ensures a complete copy of your database content is saved before migration.
To back up all databases on the server, run the following commands:
The all_databases_backup.sql file, a complete snapshot of your database, must be created in your current working directory. This backup file is essential for data integrity during the migration process.
You should now have two files: current-server-backup.tar and all_database_backup.sql.
Copy the current server’s content to the Google Cloud server
At this point, you should be ready to copy the current server’s content over to your new server. There are many ways to get the tar and SQL data files to the new server.
You can use the rsync command from the new server by SSHing into it and using a similar command to that shown below (changing the host names as needed).
While connected to your Google Cloud console, run the commands below to connect to your current server and copy over the backed-up content.
You can use SCP (Secure Copy Protocol) to copy your Magento site files securely. The SCP command syntax for copying files looks like this: `scp -r /local/path/to/your/magento/files username@remote_host:/remote/path/to/destination`. This method offers a protected way to transfer data, which is vital for maintaining site integrity during migration.
scp user@old-server.com:/home/<username>/all_database_backup.sql /home/username/ scp user@old-server.com:/home/<username>/current-server-backup.tar /home/username/
If you can’t get the files using SSH, then you can use the wget command to download the files to your new Google Cloud server.
You must copy the files to the current server’s web server root directory to be able to use the commands below.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once the files are copied to your new server, continue below to extract them and import the database content into your database server.
Restore the current server’s content to the Google Cloud server
After backing up your Magento site’s content and database, the next step in your Magento migration to Google Cloud is to restore it onto your new server. You will copy your website files and import the database backup into the correct places on your Google Cloud instance using commands like tar and cp.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, run the commands below to import the database content to your servers.
sudo mysql -u root -p < all_database_backup.sql
At this point, your Google server should have the same server configurations and database content as your current one. Next, run the commands below to set up the current permissions to match the server.
Validate that all configurations on your current server match your new Google Cloud server. Once all have been validated, restart your web server.
sudo systemctl restart nginx sudo systemctl restart apache2
If you get an error, make sure to resolve the error.
Update your DNS and point your domain to your new Google server IP address
To make your Magento site live on Google Cloud, you need to update your DNS records to point your domain name to the new server’s IP address. First, test the site using your computer’s host file to confirm it works, then log in to your DNS provider to change the A record.
Once your local test is successful, log in to your DNS provider portal and update the DNS A record to point to your new server IP address.
Once these steps are complete and everything appears to be working, you can fine-tune your new server’s configuration.
That should do it!
Conclusion:
This post showed you how to migrate a Magento website to a Google Cloud server. Please use the comment form below if you find any errors above or have something to add.
Migrating your Magento site to Google Cloud involves moving your entire online store to Google’s servers with the goal of keeping it available to customers. This process transfers everything, including your store’s database and files, to the Google Cloud Platform (GCP).
Achieving minimal downtime means your store stays online as much as possible during the switch. A common strategy involves setting up your new Google Cloud environment first, then moving your data, and finally directing customers to the new location.
This migration can improve your store’s speed and ability to handle more visitors. While Google Cloud is being set up, you need to understand how DNS, the system that directs web traffic, works. DNS changes can take 24 to 48 hours to update everywhere in the world.
Prepare your new Google Cloud environment by taking inventory of your current server and installing LAMP or LEMP on the new server. Then, migrate your Magento files and database. Finally, update your DNS records to point to the new Google Cloud server for a seamless transition.
Taking inventory of a Linux server before migration
Taking inventory of your current Linux server is crucial before your Magento migration to Google Cloud. Know all the software running, like your web server, database, and PHP versions, so your new Google Cloud server has everything it needs for your site to work correctly.
These are what you’ll need to gather from your current server:
- Web server and version number
- Database server and version number
- PHP and related modules
- Other servers and services and how they’re configured
If you’re running Apache, use the commands below to check its version on Ubuntu Linux. For more detailed steps on installing specific Apache versions, consult this guide.
apache2 -v
For more detailed version checks and steps to install a specific version of Apache, read the post below:
How to check and install specific Apache versions on Ubuntu Linux
If you’re running Nginx, use the commands below to check its version on Ubuntu Linux. For more detailed steps on installing specific Nginx versions, consult this guide.
nginx -v
For more detailed version checks and steps to install a specific version of Nginx, read the post below:
How to check and install specific Nginx versions on Ubuntu Linux
To check what version of PHP is installed and how to install a specific version on Ubuntu Linux, read the post below:
How to check and install specific PHP versions on Ubuntu Linux
Whether you’re running MySQL or MariaDB, the post below shows you how to determine which version of MySQL or MariaDB runs on Ubuntu Linux.
How to find what version of MySQL or MariaDB runs on Ubuntu Linux
How to set up and connect to your Google Cloud server
Connecting to your new Google Cloud server is the first step in setting it up for your Magento site migration. Google Cloud’s Compute Engine allows you to connect to your virtual machine (VM)—a server in the cloud—using SSH directly from your browser within the Google Cloud Console.
Google Cloud’s Compute Engine allows you to connect to your virtual machine (VM) – a server in the cloud – using SSH directly from your browser within the Google Cloud Console.
SSH from the browser supports the following:
- Web browsers
- The latest version of Google Chrome
- Firefox
- Microsoft Edge
- Microsoft Internet Explorer 11 and later
- Safari 8 and later. Note that Safari in private browser mode is not supported.
- All Linux VM images are natively available in Google Cloud.
No additional software or browser extensions are needed. Log in to Google Cloud Console and go to Menu ==> Compute Engine ==> VM instances.
In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to.

Alternatively, you can open an SSH connection to an instance by clicking its name and SSH from the instance details page.
An SSH terminal window with the Ubuntu Linux instance created in the series’s second post will open.
You should now be able to run commands in Ubuntu Linux created on the Google Cloud server.

Install LAMP or LEMP on the new server before migration
Before migrating your Magento site, you must install the same software stack, like LAMP or LEMP, on your new Google Cloud server that your old server uses. This means installing essential packages such as Apache or Nginx, MySQL, and PHP to ensure everything is compatible and your site works correctly.
Your goal is to make sure the new Google server has all the same server configurations and software packages as your current one. We’ve listed some helpful posts that you can use to install Apache, Nginx, MySQL, MariaDB, or PHP.
Some other posts that you may want to use when installing LAMP or LEMP on Ubuntu Linux.
- How to install Apache on a Google Cloud server (alternative to Nginx)
- How to install Nginx on a Google Cloud server (alternative to Apache)
- How to install PHP on a Google Cloud server
- How to install MySQL or MariaDB database server
You can use the posts above to install the same servers and packages you have installed on your current server. However, if you want to install specific packages on your new server, use the same posts mentioned above.
Once all the packages are installed, you can transfer content from your current server to the new one.
Configure your new Google server similar to your current server
To make your new Google Cloud server work just like your old one for a smooth Magento migration, you need to match key settings. This includes ensuring your web server (Apache or Nginx) settings, directory structures, and PHP configurations are exactly the same on both servers.
Ensure the web server (Apache or Nginx) settings are on old and new servers, including the same directory structure and Virtual Host or Server block content.
- Apache directory: /etc/apache2/
- Nginx directory: /etc/nginx/
Your PHP configuration should also be identical to your current server’s PHP settings. Use the post above to install a specific PHP version and all the modules on your current server.
- PHP directory: /etc/php/
Your MySQL or MariaDB configurations should also mimic your current server. Validate each file, directory, and other data to ensure your new server is no different from your current server before migration.
- MySQL / MariaDB directory: /etc/mysql/
Once you have that done, you can continue with the migration process.
Back up current server data and database before migration
Backing up all your Magento website files and database from your current server is a critical step before your Magento migration to Google Cloud. Stop any changes to your site before starting the backup to ensure all your data is safe and accurate for the move.
You need to move your Magento website content and database content to the new server. Back up the website content as well as the content in the database.
Before backing up your current server, stop all changes. You don’t want new ones added after the backup is complete.
To back up Magento content, log on to your server via SSH if you have access. Once on your current server SSH console, run the commands below to back up your Magento content, usually at this location: /var/www/html/.
When you run the commands below, a backed-up file named current-server-backup.tar will be created with your Magento content.
The database backup process requires using the root account or an account with full access to the database. This ensures a complete copy of your database content is saved before migration.
To back up all databases on the server, run the following commands:
The all_databases_backup.sql file, a complete snapshot of your database, must be created in your current working directory. This backup file is essential for data integrity during the migration process.
You should now have two files: current-server-backup.tar and all_database_backup.sql.
Copy the current server’s content to the Google Cloud server
At this point, you should be ready to copy the current server’s content over to your new server. There are many ways to get the tar and SQL data files to the new server.
You can use the rsync command from the new server by SSHing into it and using a similar command to that shown below (changing the host names as needed).
While connected to your Google Cloud console, run the commands below to connect to your current server and copy over the backed-up content.
You can use SCP (Secure Copy Protocol) to copy your Magento site files securely. The SCP command syntax for copying files looks like this: `scp -r /local/path/to/your/magento/files username@remote_host:/remote/path/to/destination`. This method offers a protected way to transfer data, which is vital for maintaining site integrity during migration.
scp user@old-server.com:/home/<username>/all_database_backup.sql /home/username/ scp user@old-server.com:/home/<username>/current-server-backup.tar /home/username/
If you can’t get the files using SSH, then you can use the wget command to download the files to your new Google Cloud server.
You must copy the files to the current server’s web server root directory to be able to use the commands below.
cd ~ wget http://old-web-site.com/all_database_backup.sql wget http://old-web-site.com/current-server-backup.tar
Once the files are copied to your new server, continue below to extract them and import the database content into your database server.
Restore the current server’s content to the Google Cloud server
After backing up your Magento site’s content and database, the next step in your Magento migration to Google Cloud is to restore it onto your new server. You will copy your website files and import the database backup into the correct places on your Google Cloud instance using commands like tar and cp.
tar -xvf current-server-content.tar sudo cp -rf /var/www/html/ /var/www/html/
Next, run the commands below to import the database content to your servers.
sudo mysql -u root -p < all_database_backup.sql
At this point, your Google server should have the same server configurations and database content as your current one. Next, run the commands below to set up the current permissions to match the server.
Validate that all configurations on your current server match your new Google Cloud server. Once all have been validated, restart your web server.
sudo systemctl restart nginx sudo systemctl restart apache2
If you get an error, make sure to resolve the error.
Update your DNS and point your domain to your new Google server IP address
To make your Magento site live on Google Cloud, you need to update your DNS records to point your domain name to the new server’s IP address. First, test the site using your computer’s host file to confirm it works, then log in to your DNS provider to change the A record.
Once your local test is successful, log in to your DNS provider portal and update the DNS A record to point to your new server IP address.
Once these steps are complete and everything appears to be working, you can fine-tune your new server’s configuration.
That should do it!
Conclusion:
This post showed you how to migrate a Magento website to a Google Cloud server. Please use the comment form below if you find any errors above or have something to add.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!