Live Migration of Linux VM from AWS/Azure/On-Prem to GCP(Google Cloud) using CloudEndure

You can migrate from any cloud or on-premise to Google Cloud using CloudEndure's SaaS model. However, in this blog I will walk you through all the steps required for migrating a live/running server from AWS to GCP using CloudEndure.

Before we start you will need following things:

  1. Debit/Credit Card: To create an account with any of the below Cloud provider.
  2. AWS Account
  3. Google Cloud Account

I assume you have experience launching an EC2 instance on AWS, if not you can follow this article for the same.

First of all, we need to create credentials for CloudEndure to launch VMs in our GCP account during live migration process. So let's start by logging into Google Cloud account. Upon successfull login you should be redirected to Dashboard page.

Once you are on dashboard page click the menu icon on top left corner and go to Credentials in APIs & Services section.

In the Credentials tab, hover over Create credentials and click on Service account key.

Select Compute Engine default service account from the dropdown, JSON as Key type and click Create button. Save the key at secure place and DO NOT share it with anyone.

We now have the JSON key file required for migration.

Let's go to VMs section. Click on Menu > Compute Engine > VM instances.

Once you are at the dashboard and if this is the first time you are using VM instances you will be asked to enable the Compute Engine API. Please go ahead and enable the API. It will take couple of minutes so please keep patience.

If not, you should see the same landing page as mine.

On the landing page click on Import followed by CloudEndure. It will open a new tab asking you to sign in for using the CloudEndure service. Please sign in using your GCP account.

After signing in you will be prompted to accept TERMS OF SERVICE so please read and accept it.

Upon accepting TERMS OF SERVICE you will be prompted with two pop-ups. Read the message and click Start for first and Continue for second pop-up.

It will now ask you for Google Cloud Platform Project ID and Google Cloud Platform JSON Private Key.

To get the Project ID, switch to Google Cloud tab, click on the Project Name on top and from the popup select Project ID.

JSON Secret Key is the one which we generated and downloaded sometime back. Open the JSON file, copy content and paste it here and click Save.

Note: In case you receive any permission error, make sure you have provided the correct Project ID and JSON Private Key.

Next step is to complete Replication Settings:

  1. Select the region where you want to migrate your AWS instance.
  2. Select the Zone.
  3. Leave other parameters to their default values.
  4. Click Save Replication Settings button.

You should see a pop-up congratulating you on setting up the project. Click Show Me How button to proceed.

Next step is to install script provided by CloudEndure on our source instances. For this we have to switch to AWS account and SSH into our source instance.

Switch back to your Google Cloud window and copy wget command for downloading CloudEndure python script.

After successfull download use ls command to see python script in your directory.

Use the next command to run the python script and start the migration process.

Note: Running command with --no-prompt flag will by default replicate all the volumes attached to your instance. If you DO NOT want to replicate all the volumes run the command without --no-prompt flag.

As I have run the command without --no-prompt flag it is asking me to provide disk paths which I want to migrate. Because I just have single disk attached to my VM I will simply hit enter and proceed.

After you hit Enter it will take some time to download CloudEndure Agent, install it and start the replication process.

Switch back to Google Cloud window and click on Machines from the left panel to see AWS instace in the list.

Click on the machine name and you should see Replication process has started.

Replication process will take time depending on the location and size of your server. Be patient while CloudEndure completes all the Replication stages before launching machine on Google Cloud.

Once the replication process is completed, you are asked to create a blueprint for the destination/target machine. Fill all the required parameters and click Save Blueprint

In the bottom left, click on Launch Target Machine dropdown button. You should two options: Test Mode and Cutover Mode.

  1. Test Mode: This will launch the target machine as a replica of source machine with asynchronous replication mode switched on.
  2. Cutover Mode: This will launch the target machine as a replica of source machine but WITHOUT replication mode switched on. Moreover, will also delete any existing target machine of the same source machine after launch of new target machine.

Select Mode as per your requirement and click Continue button to launch the target machine.

From the left panel click on Job Progress to see the status if machine launch.

After job completion:

After the job is completed switch to GCP VM instances and you should see the target instance.

Before you can SSH into migrated VM, SSH public key needs to be attached to it. To do so:

  • Click on VM name
  • Click on Edit button on top
  • Scroll down until you see SSH Keys section, paste the SSH Public Key into the box and hit Save button.

Note: The last part of SSH Public key refers to the username Google Cloud will be creating for us to SSH into the machine. In my case I have provided the same username(ec2-user) as it was for my source EC2 instance.

It's now time to verify if the live migration was completed successfully by getting the remote access of our target linux machine.

Above image verifies that the live migration was completed successfully as the files from source EC2 machine as seen in Google Cloud VM instance.