Migrating machines from AWS to GCP secure way — using CloudEndure

Omisha Gupta
5 min readOct 18, 2019

--

I was recently working on AWS to GCP migrations, didn’t found an informative article for this easy process so I thought of writing one, hoping it could help somebody in their tough times of migration.

This article talks about migrating AWS EC2 to GCP GCE in a secure way, for which we are using Virtual Private Network. This article is divided into 2 steps, creating VPN and migration through CloudEndure.

  • VPN setup
  1. We will have to start with creating a VPN, for which we’ll start with reserving an external IP in the same region we want to migrate our instance.

2. Switching to AWS for establishing a connection there, we have to create a customer gateway, with the IP we have reserved in GCP as vpn-tunnel :

3. Create a Virtual private gateway, you can choose any name tag. Remember that the AWS and GCP ranges shouldn’t overlap with each other. Once done add it to the route table and propagate the route.

3. We now have to create a site-to-site VPN connection in aws side:

I will elaborate on the options we have to fill:

  • Name tag: Any identifier for this VPN
  • Virtual Private Gateway: We have to choose here what we have created in step 3.
  • Customer gateway: We have to choose here what we have created in step 2.
  • Routing options: Choose static and fill in the IP address range for the GCP VPC we are tunneling with.
  • We can leave the other options as it is.

4. As you can see the status of the VPN is down as of now, but we’ll use the IPs listed hereunder field Outside IP Address at the GCP end to establish a connection.

5. Download the configuration with the following details.

6. Now starting with establishing a connection at GCP end. Switch to VPN tunnel, which is under hybrid connectivity in the networking menu. For the sake of simplicity, choose classic VPN and click on create.

7. In the next screen, we need to enter the Google compute engine VPN gateway details, which includes VPC for which we are tunneling with AWS, and the IP we reserved in step1 as IP address here.

In the field IKE pre-shared key, Enter the Pre-Shared Key under the heading IPSec Tunnel #1, for routing options, choose route-based and enter the IP range for AWS VPC we’re connecting to.

Repeat the same steps for the second tunnel, remember to use Pre-Shared Key under the heading IPSec Tunnel #2 this time.

This sets our tunnel up for communication, as you can see in the image below, the status is up now.

So now we have successfully established a communication link between AWS and GCP.

Wrapping up the AWS setup, in the VPC attached to this VPN connection allow the route for VGW corresponding to a subnet CIDR range in the route table. Remember that the AWS and GCP ranges shouldn’t overlap with each other.

  • Migration using CloudEndure

Now comes the second phase of migrating the instance, for which we’ll be using cloud endure. Switching to cloud computing console, there’s an option of import VM, which kinda serves our purpose. Going ahead with this we can see GCP serves us with 2 options, this article talks about migration using cloud endure, for migrations using Velodtrata, another article is on the way.

Going ahead with it, you will be asked to configure the Project you want to migrate your instance in, it requires default compute engine service account to carry on the migrations successfully.

Starting with setup and replication information, put whatever region and zone you want to migrate the instance to, choose the subnet you want to move into, tick Use VPN pr Cloud Interconnect

Post setting up the replication settings, you need to go to the machines and click on theadd machine option, doing this will popup the dialog box stating the commands to execute in EC2 machine for downloading the CloudEndure agent and run the installer.

This will start the replication process automatically, just wait for Data Replication to get over. Meanwhile, you can also set up the blueprint for the instance where you can mention details like Machine Type, Machine Name, subnet, Private IP, and Disk Type you want to choose.

Once all this is done, feel free to launch the machine in whatever mode suits you best.

I hope this article helps you, happy migration! :)

--

--