In my previous blog, I have written how to migrate workloads from VMware to Azure Cloud. In this tutorial, I am going to elaborate you how to migrate Amazon Web Services (AWS) EC2 virtual machines (VMs) to Azure VMs by using Azure Site Recovery.
Supported Workloads Which can be migrated:
- Windows Server 2016 or later version
- Red Hat Enterprise Linux 6.7
- The Mobility service must be installed on each VM that you want to replicate. Site Recovery installs this service automatically when you enable replication for the VM.
- For non-domain joined Windows VMs, disable Remote User Access control on the local machine at the registry, under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System, add the DWORD entry LocalAccountTokenFilterPolicy and set the value to 1.
- A separate VM in AWS subscriptions to use as Site Recovery Configuration Server. This instance must be running Windows Server 2012 R2.
- root credential on the source Linux server
- A Domain Admin Credentials for Windows VM.
- A Local Admin Account for non-domain joined VM.
Prepare Azure resources (Target)
Step1: Create a Storage Account
- In the Azure portal, in the left menu, select Create a resource > Storage > Storage account.
- Create a Storage Account in your region.
Step2: Create a Recovery Vault
- In the Azure portal, select All services. Search for and then select Recovery Services vaults.
- Add new Recovery Vault in your region.
Step3: Add a separate network for migrated VM
- In the Azure portal, select Create a resource > Networking > Virtual network.
- Add new Network and Address Space.
Step4: Prepare Recovery Goal
- On your vault page in the Azure portal, in the Getting Started section, select Site Recovery, and then select Prepare Infrastructure.
- Create a protection goal from On-prem to Azure.
- When you’re done, select OK to move to the next section.
Step5: Create a Replication Policy
- To create a new replication policy, click Site Recovery infrastructure > Replication Policies > +Replication Policy. Create replication policy, specify a policy name.
- In RPO threshold, specify the recovery point objective (RPO) limit. This value specifies how often data recovery points are created. An alert is generated if continuous replication exceeds this limit.
- In Recovery point retention, specify how long (in hours) the retention window is for each recovery point. Replicated VMs can be recovered to any point in a window. Up to 24 hours retention is supported for machines replicated to premium storage, and 72 hours for standard storage.
- In App-consistent snapshot frequency, specify how often (in minutes) recovery points containing application-consistent snapshots will be created. Click OK to create the policy.
Prepare Source Environment (Alibaba Cloud)
Step6: Deploy an Alibaba ECS Instance (this is similar steps like OpenStack or AWS)
- Log on to the ECS console.
- In the left-side navigation pane, click Instances.
- On the Instances, list page, click Create Instance.
- Complete the Basic Configurations such as region, billing method, instance type, key pair, storage type and VPC to create an ECS instance.
Step7: Prepare Source ASR Configuration Server
- Log on to the Alibaba ECS instance (Step6) where you would like to install Configuration Server
- Configure the proxy on the EC2 instance VM you’re using as the configuration server so that it can access the service URLs.
- Download the Microsoft Azure Site Recovery Unified Setup. You can download it to your local machine and then copy it to the VM you’re using as the configuration server.
- Select the Download button to download the vault registration key. Copy the downloaded file to the VM you’re using as the configuration server.
- On the VM, right-click the installer you downloaded for Microsoft Azure Site Recovery Unified Setup, and then select Run as administrator.
- Under Before You Begin, select Install the configuration server and process server, and then select Next.
- In Third-Party Software License, select I accept the third-party license agreement and then select Next.
- In Registration, select Browse, and then go to where you put the vault registration key file. Select Next.
- In Internet Settings, select Connect to Azure Site Recovery without a proxy server, and then select Next.
- The Prerequisites Check page runs checks for several items. When it’s finished, select Next.
- In MySQL Configuration, provide the required passwords, and then select Next.
- In Environment Details, select No. You don’t need to protect VMware machines. Then, select Next.
- In Install Location, select Next to accept the default.
- In Network Selection, select Next to accept the default.
- In Summary, select Install. Installation Progress shows you information about the installation process. When it’s finished, select Finish. A window displays a message about a reboot. Select OK. Next, a window displays a message about the configuration server connection passphrase. Copy the passphrase to your clipboard and save it somewhere safe.
- On the VM, run cspsconfigtool.exe to create one or more management accounts on the configuration server. Make sure that the management accounts have administrator permissions on the EC2 instances that you want to migrate.
Step8: Enable Replication for an Alibaba ECS VM
- Click Replicate application > Source.
- In Source, select the configuration server.
- In Machine type, select Physical machines.
- Select the process server (the configuration server). Then click OK.
- In Target, select the subscription and the resource group in which you want to create the Azure VMs after failover. Choose the deployment model that you want to use in Azure (classic or resource management).
- Select the Azure storage account you want to use for replicating data.
- Select the Azure network and subnet to which Azure VMs will connect when they’re created after failover.
- Select Configure now for selected machines, to apply the network setting to all machines you select for protection. Select Configure later to select the Azure network per machine.
- In Physical Machines, and click +Physical machine. Specify the name and IP address. Select the operating system of the machine you want to replicate. It takes a few minutes for the servers to be discovered and listed.
- In Properties > Configure properties, select the account that will be used by the process server to install the Mobility service on the machine automatically.
- In Replication settings,> Configure replication settings, verify that the correct replication policy is selected.
- Click Enable Replication. You can track the progress of the Enable Protection job in Settings > Jobs > Site Recovery Jobs. After the Finalize Protection job runs the machine is ready for failover.
Test failover at Azure Portal
Step9: Test a Failover
- On the page for your vault, go to Protected items > Replicated Items. Select the VM, and then select Test Failover.
- Select a recovery point to use for the failover:
- Latest processed: Fails over the VM to the latest recovery point that was prepared by Site Recovery. The time stamp is shown. With this option, no time is spent preparing data, so it provides a low recovery time objective (RTO).
- Latest app-consistent: This option fails over all VMs to the latest app-consistent recovery point. The time stamp is shown.
- Custom: Select any recovery point.
- In Test Failover, select the target Azure network to which Azure VMs will be connected after failover occurs. This should be the network you created in Prepare Azure resources.
- Select OK to begin the failover. To track progress, select the VM to view its properties. Or you can select the Test Failover job on the page for your vault. To do this, select Monitoring and reports > Jobs > Site Recovery jobs.
- When the failover finishes, the replica Azure VM appears in the Azure portal. To view the VM, select Virtual Machines. Ensure that the VM is the appropriate size, that it’s connected to the right network, and that it’s running.
- You should now be able to connect to the replicated VM in Azure.
- To delete Azure VMs that were created during the test failover, select Cleanup test failover in the recovery plan. In Notes, record and save any observations associated with the test failover.
Migrate an Alibaba ECS Instance to Azure Cloud
Step10: Trigger Azure Migration
- In Protected items > Replicated items, select the AWS instances, and then select Failover.
- In Failover, select a Recovery Point to failover to. Select the latest recovery point.
- Select Shut down the machine before beginning failover if you want Site Recovery to attempt to do a shutdown of source virtual machines before triggering the failover. Failover continues even if shutdown fails. You can follow the failover progress on the Jobs
- Ensure that the VM appears in Replicated items.
- Right-click each VM, and then select Complete Migration. This finishes the migration process, stops replication for the AWS VM, and stops Site Recovery billing for the VM.