Cloud migration is the process of moving data, applications or other business elements from an organization’s onsite computers to the cloud, or moving them from one cloud environment to another.
Fig.1 Key Points in Cloud Migration
Steps for Migrating VM from On-premises to AWS cloud
Data Flow for this process would be,
Fig.2 Data Flow
1. Basic AWS environment
One basic thing to remember while migrating from on-premises to the cloud is an “Existing infrastructure” of that particular virtual machine. User has to create an exact same environment in AWS cloud which they had on their On-premises.
Here in blog, we have taken an example of “Migration of Artifactory VM to the AWS cloud”. To ease out manual process of creating an AWS infrastructure, we used one CloudFormation template which will create a full AWS stack required by an Artifactory VM.
Here’s a sample of CloudFormation template,
2. AWS Cli
- Prerequisite for AWS cli
Pip: – To install refer this link, https://packaging.python.org/installing/
For installing AWS cli use this command,
- To use AWS cli, User needs to configure it with AWS Access key and secret key which generated when a user created an IAM user.
For AWS cli configuration use,
3. AWS Role and policy
- Create a role named vmimport with a trust relationship policy document that allows VM import to assume the role, and user must attach an IAM policy to the role.
Create a file named trust-policy.json with the following policy:
- Use the create-role command to create a role named vmimport and give VM Import/Export access to it. Ensure that you specify the full path to the location of the trust-policy.json file.
- Create a file named role-policy.json with the following policy, where <bucket name> is the bucket where the disk images are stored:
- Use the following put-role-policy command to attach the policy to the role created above. Ensure that user specify the full path to the location of the role-policy.json file.
4. Creating .VHD file of On-premises virtual machine (XEN environment)
- Open the Export wizard: select the pool or server containing the VM(s) that user want to export, then click on VM menu, Export.
- On the first page of the wizard, enter the name of the export file, specify the folder
Where user want file(s) to be saved, and select OVF/OVA Package (*.ovf, *.ova) from the Format list, and click Next.
- Select the VMs that user want to export and then click Next.
- On the EULAs page, user can add previously prepared End User Licensing Agreement (EULA) documents in the package.
- On the Transfer VM Settings page, configure networking options for the temporary VM used to perform the export process (“Transfer VM”). Click Next to continue.
- On the final page of the wizard, review the settings that user have configured on the previous pages.
- Click Finish to begin exporting selected VMs and close the wizard.
5. Upload an Image to Amazon S3
- To upload file from local to s3
6. Import Image
- After user uploaded their VM image file to Amazon S3, user can use the AWS CLI to import the image.
Use the import-image command,
The following is an example containers.json file.
- Use the describe-import-image-tasks command to return the status of an import task.
Wait until status says “Completed”.
7. Create an instance using ami
- To create an instance from ami, run a following command:
Cloud migration has some risks associated with it. So while implementing it be well prepared. To avoid potential disaster, map out your strategy and plan for the unexpected. A solid migration strategy acts as a guide or checklist to ensure a successful journey to the cloud. Enterprises need to plan for expenses, especially the unexpected ones as well as the migration’s effect on an organization, its systems and users.