×
Community Blog Lift-and-Shift: Moving VMs To Alibaba Cloud With Server Migration Center (SMC) - Friday Blog Week 45

Lift-and-Shift: Moving VMs To Alibaba Cloud With Server Migration Center (SMC) - Friday Blog Week 45

Got some existing physical servers or VMs you need to move to the cloud, but not sure where to start? In this blog post, we take you through the proce...

By: Jeremy Pedersen

Server Migration Center (SMC) is an Alibaba Cloud tool which helps users migrate existing infrastructure to the cloud as painlessly as possible.

With SMC, it's possible to manage the migration of multiple VMs to Alibaba Cloud from a "single pane of glass" within the Alibaba Cloud console. The migration itself is performed using a go2aliyun script installed on the VMs you plan to migrate, but the process can be monitored easily from the SMC web console.

The best way to get a feel for a feature like this is - of course - to try it for yourself!

Let's move an Ubuntu 20 web server from Oracle's VirtualBox to the cloud, just to test things out!

Setting Up A VM

We will need an existing physical server or virtual machine which we can migrate to Alibaba Cloud.

This could be a VM on AWS, Azure, or GCP, or it could be a local virtual machine running in VirtualBox.

In my case, I have set up an Ubuntu Server VM in VirtualBox. If you want to replicate my setup, you'll first need to install VirtualBox, then get a copy of Ubuntu Server and install that inside your VirtualBox VM.

On my VM, I will install the Apache web server and create a small "placeholder" web page, which I will use to prove that the migration has succeeded (the site should be up and working after migration).

Step 1: Create A New VM

01_setup_vm

Step 2: Install Ubuntu & Apache

02_install_ubuntu

Note: You can install Apache on Ubuntu with the command:

sudp apt-get install apache2

Setting Up A Test Page

Once Apache is installed, we can enable it to start at boot with:

systemctl enable apache2

We also need to navigate to /var/www/html and create a new index.html file with our test site:

03_test_site

Not much to look at, but it will at least help us judge whether the migration process has been successful!

Getting Things Ready In SMC

Now we're ready to try out an actual migration! First, navigate to the SMC console:

04_smc_console

You'll notice there's a "Download" link for the SMC client itself. The SMC Client needs to be installed on the VM or physical server we are planning to migrate to Alibaba Cloud.

Since my Ubuntu Server VM is headless, I used wget to download the client, rather than a web browser:

05_download_client

Unzipping the .zip archive, we find it contains several more .zip files:

06_go2aliyun

There are clients for 32-bit and 64-bit Windows and Linux systems. In my case, I have a 64-bit Linux VM, so I want to unpack and use the go2aliyun_client2.5.9_linux_x86_64.zip client.

Unpacking that .zip file creates a new directory:

07_unpacked_client

Navigating into the directory shows that it contains the go2aliyun_client executable, as well as some supporting files. The most important of which is user_config.json:

08_client_dir

To complete the migration, we will need to edit the user_config.json file by adding an Access Key and Access Key Secret, like this:

09_go2aliyun_config

If you'd rather not add your access key to this file, you can also specify it on the command line when you run the go2aliyun tool, like this:

./go2aliyun_client --accessid=<AccessKey ID> --secretkey=<AccessKey Secret>

Creating An Access Key

If you have never created an Access Key before, you'll need to follow these steps. The process is outside the scope of today's blog post, but essentially you need to:

  1. Create an authorize a RAM user (docs here)
  2. Create an Access Key for the RAM user (docs here)

Carrying Out The Migration

With our Access Key ready to go and our user_config.json file updated, we can now run the go2aliyun_client command. This will not start the migration, but it will send information about our VM to the SMC console (we will start the migration from there, in the next step).

Before we can run the script, we need to make it executable:

chmod +x go2aliyun_client

We then run the client with:

./go2aliyun_client

Note that the client must be run as root.

The tool will run some initial checks (and may ask us to install snapshot support):

10_client_start

Once we see "Import Source Server Successfully!", we can switch over to the SMC console and create a migration task!

Note: do not kill the go2aliyun_client script. We need it to stay running, so it can receive commands from SMC and start the migration process.

If we switch back to the SMC console, we should now see a new "migration source":

11_smc_console_job

Clicking on "Create Migration Task" will allow us to configure a new migration job:

12_new_job

Here, we need to choose a destination region for the Alibaba Cloud disk image that will be created as part of the migration.

If this is the first time we have used SMC to perform a migration, a warning message will appear, informing us that SMC will need to create some temporary resources (a VPC group and ECS instance) to perform the migration. We can just click "OK" here:

13_confirmation

If everything went well, we should see a "Success" screen, like this one:

14_success

Based on the selections we made when setting up the task, it should start right away:

15_progress

Returning to the console on our VM, we should see that the go2aliyun_client script has started migrating data:

16_go2aliyun_progress

Once the migration process completes (the time will vary based on the amount of data on the source VM's disks), we should see a message like this on the VM's console:

17_migration_done

The SMC console should also show the migration task's status as "Completed":

18_migration_done

That's it! We can now stop the go2aliyun_client script on the VM. Our next step will be creating a replica of our original VM on Alibaba Cloud, by creating an ECS instance from our VM disk image.

Launching The VM On Alibaba Cloud

From the SMC console's "migration tasks" page, we click on "Create Instance":

19_create_instance

This will take us through the ECS instance purchase process. Be sure to use the disk image that SMC has created:

20_instance_type

We want our instance to be reachable from the Internet, so make sure that it is assigned a public IP address and that it is assigned to a Security Group with port 80 open to the world:

21_networking

If you want to keep your original VM's logon password, make sure you choose "Inherit from image":

22_passwords

That's it! Complete the checkout process and confirm:

23_complete

24_confirm

You should now be able to see the new instance from the ECS console:

25_new_instance

If the migration was a success, visiting the instance's public IP in a web browser should show the website we created earlier:

26_final_site

We have successfully migrated a VM to Alibaba Cloud!

Remember, if you're doing a standard "lift and shift", then SMC (Server Migration Center) is the way to go.

0 1 0
Share on

JDP

71 posts | 157 followers

You may also like

Comments