Update 09/19 –Since I originally wrote this Article, AWS have bought cloudedure. At present this procedure is still valid for GCP customers, but there may come a day when GCP customers cannot use CloudEndure for Migrations
In this blog post I will be migrating a Linux server from my home VM lab into GCP. CloudEndure will work with physicals or virtual servers and is great for migrating individual servers in a controlled manor.
- Log into GCP console
- Goto Compute Engine > VM Instances and click Import (you need to have atleast 1x VM running for the import button to show up)
- Choose CloudEndure – this will open the CloudEndure SSO page and log in with your GCP account
- After a short initial setup you will be presented with the CloudEndure main console. If this is the very first time you have use this it may take up to 10 minutes become ready.
- Below you can see my token IDs and install commands to run on my local linux machine (note I had censored mine key below)
- From the physical server download the latest cloudendure agent using the command
wget -O ./installer_linux.py https://gcp.cloudendure.com/installer_linux.py
- This will download the agent that will do the migration to the cloud.
- Next use the phython script to install the agent with the Token ID assigned to you.
- The process will take a few minutes to complete
- Next switch back to the GCP console and you will see the server
- Click on the server and you can monitor the progres on the migration
- Whilst it migrates, you can look at the options under “blueprint”, here you can set the server:
- IP address
- VPC network settings
- Server name
- Disk size if you want to resize the server
- Disk type if you want SSD or HDD
Now you have to wait for the migration to complete. This will depend on your network speed
- Once completed you will see the following screen
- Next we need to test the server to make sure it boots and connects to GCP. This is done by clicking the button Launch Target Instance > Test Mode
- After a few minutes the instance will be available in your GCP VM instances.
- You can monitor the job into the “job progress” tab
It takes a few minutes for this process to complete. Once done you will see the VM in the compute engine
Now we have to test the instance and ensire that the server is working. As this is a custom server the Google Daemon which enables SSH console in the GCP web browser will not work.
You can test the server with a SSH serial connection instead
- To do this click on the Virtual Machine > Edit and ticket the box for “Enable connecting to serial ports”
Conduct some testing to make sure the server is healthy, once your are happy to can cut over the server into Production. In the example above you can see that my NIC ENS4 is down. This is a common issue which happens when you migrate and I will fix after cutover to production.
- Go back to the CloudEndure console and select Launch Target Machine > Cutover
After a few minutes your VM will be in Production
Fixing the network
Now to fix the network, I have re-enabled SSH over serial again (as above)
- SSH to the serial console and type
ip address show
- Make a note of the adapter details for your production network. In this example it is ENS4
- To fix this type (note this OS is Ubuntu 17.04LTS)
sudo netplan generate
sudo vi /etc/netplan/01-netcfg.yaml
- Now edit the YAML file to match your NIC ID
sudo netplan apply
ip address show
- You can now see you server NIC is UP and it has an IP address
- Now you can connect to your VM using SSH to the external IP. If you have any issues
- Open the Putty Key Generator from the putty folder on your start menu.
- Click generate and follow on screen prompt to wiggle mouse to create randomness
- Keep wiggling the mouse to generate the key
- Enter the Username and password you want to use in the Key Comment and Key Passphrase sections. In this example I am using root, but you can use anything providing there is an associated account on the server.
- Next copy the entire key box and click Save private key
- Next Log into GCP and navigate to Compute Engine. Find the VM you want external SSH access to and click on it to see details.
- In the details page click edit
- Scroll down to the SSH Keys section, Click Add item and paste you key value and user name
- Click save and make a note of the external IP of the server.
- Go back to Putty.
- Type the External IP of your server into the client
- On the left pane, scroll down to expand connection > SSH > Auth
- Click the browse button and locate the key file you saved earlier
- Next click Open to SSH to you GCP Instance. Log in with the credentials you provided earlier.