The term multi-cloud refers to the utilization of services from many public cloud providers simultaneously for a variety of workloads. Its primary objective revolves around achieving operational flexibility by leveraging the most suitable computing environment for each specific workload. Additional benefits include avoiding vendor lock-in, guaranteeing robust website availability to avert outages, establishing resilient data protection and risk mitigation strategies, optimizing latency for customers, securing competitive pricing across cloud providers, and adhering to region-specific compliance standards.
Alibaba Cloud ECS provides the high service level agreement (SLA) commitment for both single instance and multiple instances in multiple availability zones among the top cloud providers worldwide. Therefore, migrating compute workload to Alibaba Cloud ECS may be one of the best options in muti-cloud environment. At the time of writing this document, Alibaba Cloud can achieve 99.975% (single instance) and 99.995% (multiple instances) in stability SLA, which is at the leading position among the mainstream cloud vendors.
To make the server migration process easy, Alibaba cloud provides Server Migration Center (SMC) as a platform for migrating source servers that run various versions of Windows and Linux operating systems. SMC helps customers to migrate data from servers in self-managed data centers, on-premises VMs (VMware, VirtualBox, Xen, KVM, and Hyper-V), or third-party cloud servers to Alibaba Cloud.
Fig-1: Alibaba Cloud Server Migration Center Overview
In this tutorial, we will demonstrate how to migrate AWS EC2 instance to Alibaba Cloud ECS without service interruption.
We already have an AWS EC2 instance that is running ubuntu operating system and is hosting a simple website for the sake of illustration. We will generate commands in the SMC console and then run it on the EC2 instance. This will import all the information to SMC automatically. After successful import, we will be able to spin up a new ECS instance in Alibaba cloud that will be an exact replica of the source (EC2).
Fig-2 shows the AWS EC2 instances that is to be migrated to Alibaba cloud.
Fig-2: Source instance on AWS
Clicking on instance ID will display the details of the source instances. It is essential that the instance is in running state.
Fig-3: AWS instance details (Public IP, instance state=Running)
For the demo purpose, we have Apache Web server running on the source instance with a simple html page, as shown in Fig-4:
Fig-4: Webpage on source EC2 instance
Before starting migration, we need to make sure that the full login credentials for EC2 instance including private key (.pem format) are available. The same login credentials will be used for ECS instance as well.
Using SMC to migrate a source to Alibaba Cloud involves importing the information about the migration source to the SMC console, and then creating and starting a migration task. Fig-5 shows the migration process procedure. It’s a 3-step process. Our focus here is on 3rd party Server migration only.
Fig-5: SMC workflow
In the Alibaba Cloud console, launch Server Migration Center service. For the first time use, you may get a prompt on the welcome page asking for the activation of RAM role to access cloud services such as snapshot etc. Click on Authorize now (Fig-6).
Fig-6: SMC Console
This step has the following two parts:
SMC supports multiple methods to import the information about a migration source. We will use command line interface (CLI) of import EC2 instance for import.
To do this, navigate to the Migration sources in the left menu and click import migration source (Fig-7).
Fig-7: Migration sources
To generate an activation code in the SMC console select the option of Use CLI to import Sever (Fig-8a). Select Linux Shell as EC2 instance is running Ubuntu Operating System and Click Generate.
Fig-8a: Using CLI to import server
As shown in Fig-8b, After clicking Generate, the activation code will be automatically created. The code contains linux command for downloading the SMC client on EC2 instance. It also provides the scriptalong with the credentials to transfer the data to SMC.
Note down the values of accesstokenid and accesstokencode.
Fig-8b: Activation code and Access Token ID & Code
Login into the AWS EC2 instance using AWS credentials like user name & private key and execute the following commands on the terminal to download shell script and make it executable (Fig-9).
wget https://p2v-tools-sg1.oss-ap-southeast-1.aliyuncs.com/smc/run_smc_client.sh
chmod +x run_smc_client.sh
Fig-9: Using Activation code on source server
In order to import the information about a migration source, we need to execute the following (Fig-10):
sudo ./run_smc_client.sh --accesstokenid=xxxxx --accesstokencode=yyyyy
Here xxxxx and yyyyy are the values noted from Fig-8b
Fig-10: Executing the script to generate migration source at SMC
If we go the SMC page on Alibaba cloud console, it will automatically generate a record for the migration source in the SMC (Fig-11). Once completed, the Migration Source Status will show Online.
Fig-11: Automatic migration source generation when the script is executed
We can create a migration job for a migration source only when the migration source status is in the Online state. In the left-side navigation pane, click Migration Sources and click Create Migration Job in the Actions column (Fig-12)
Fig-12: Creating Migration job
Once clicked on the Create Migration Job dialog box, a configure box will appear asking for various parameters such as migration job type, destination type, region and image name (Fig-13). For the details of parameters, user may optionally refer to the following link: https://www.alibabacloud.com/help/en/smc/user-guide/create-a-server-migration-job
Fig-13: Dialog box for creating migration job
The Image Name i.e. FromEC2 provided in Fig-13 will be used later on to create/spin up ECS instance. This image will be available in the Destination Region (Singapore, in our case).
After creating the migration job, its status can be seen by clicking on the Migration job in the left panel, as shown in Fig-14. Initially, it will be in the Preparing state.
Fig-14: Migration job status
During the entire process, information messages and prompts can be seen on the EC2 terminal as well (Fig-15).
Fig-15: Successful migration completion on EC2 terminal
Once the migration job is over, the Status on Migration Job under the Server Migration will be shown as Completed (Fig-16). A prompt will also appear on the EC2 terminal. We can now stop the script running on EC2 instance by executing Ctrl+C.
Fig-16: Completed migration task (on SMC) for creating replica on ECS instance
Creating ECS instance is similar to using a custom image. We will discuss the important configuration parameter only. Go to the Elastic Compute Service page on Alibaba cloud console.
By clicking on Create instance (Fig-16), will open up the ECS Custom Launch as shown in Fig-17.
It is essential to select the same Image Name that was used during the migration job creation (refer to Fig-13). In our case, we termed it as FromEC2.
Fig-17: Creation of ECS instance from imported EC2 image
For the logon Credentials, select Password Preset Image. Instance Name and Hostname may also be optionally selected, as shown in Fig-18.
Fig-18: Login Credentials and Hostname of ECS
In our example, we also picked a public IP Address for our ECS instances. Once the ECS instance is launched, it will become visible in on the ECS (Fig-19)
Fig-19: New ECS instance launched from EC2 image
We can log into the ECS instance using SSH while supplying the same private (.pem) key utilized for the AWS EC2 instance (Fig-20). MS Windows users can use putty or other similar software for logging into the ECS instance.
Fig-20: ECS instance login using credentials of the source EC2 instance
Finally, we can use the public IP address of the ECS instance to check the data and files are successfully migrated. Fig-21 shows the same webpage that was hosted on EC2 instance (refer to fig-4), indicating a successful migration to Alibaba Cloud ECS.
Fig-21: Successful migration of data and applications on ECS
To conclude, Alibaba Cloud Server Migration Center (SMC) can be used to migrate servers from self-managed data centers or third-party cloud servers to Alibaba Cloud with great ease. This can help the customers to get flexibility and high SLA while working in a mulit-cloud environment.
Developing and Testing IoT (MQTT) Applications Using ECS Instance
Rupal_Click2Cloud - April 17, 2020
Alibaba Cloud Indonesia - August 12, 2024
Alibaba Cloud Community - March 22, 2024
Alibaba Cloud MaxCompute - May 5, 2019
Alibaba Clouder - January 16, 2019
Alibaba Cloud MaxCompute - May 9, 2019
Secure and easy solutions for moving you workloads to the cloud
Learn MoreMigrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.
Learn MoreAlibaba Cloud offers Independent Software Vendors (ISVs) the optimal cloud migration solutions to ready your cloud business with the shortest path.
Learn MoreMigrate your legacy Oracle databases to Alibaba Cloud to save on long-term costs and take advantage of improved scalability, reliability, robust security, high performance, and cloud-native features.
Learn MoreMore Posts by JwdShah