Sometimes the first cloud Service provider company is not the best long-term suitable. Selecting a cloud provider is usually based on several options, such as cost, reliability, security, compatibility, and more. Cloud migrations can be complicated, time-consuming, and costly. To take advantage of different cloud providers, you must complete the navigation process.
Before the workload moves to production after migration, it should be tested and optimized to provide acceptable performance. This blog will help you to migrate the servers from one cloud to another cloud provider.
GCP Account with running instance
Guide to Configure GCP
Log in to your GCP account, go to the GCP console and create an image of an instance. And then copy that image to GCP Cloud Storage by clicking on the export button under the newly created image
Now, you have the option to export in VMDK, VHDX, VPC, QCOW2, etc. Note: Bucket location type in GCP should be multi reg multi-region support VMDK, VHDX, OVA, and VHD image type
Next, download that image to your local machine and follow the below steps:
Steps to Configure CMD
Install or update the latest version of AWS CLI into your local machine
In your local machine in cmd run “#aws configure” command and pass the target accounts AWS credentials and check its working by “aws s3 ls” command will print all s3 buckets in your target AWS account and after that follow the below steps:
Save the above JSON code using the name “trust-policy.json” and execute the below command in cmd to create an IAM role.#aws iam create-role –role-name vmimport –assume-role-policy-document file://trust-policy.json
We will create a policy to give “vmimport” role created in previous step to access EC2 and S3. For that save above json code with name “role-policy.json” and replace imagemayanks3 with your S3 bucket name from json code and execute below command:#aws iam put-role-policy –role-name vmimport –policy-name vmimport –policy-document “file://role-policy.json
Steps to Configure AWS
to upload your image to S3 execute below command #aws s3 cp image1.vhd s3://imagemayanks3 Note: -In case to migrate from On-premises you can directly pass the local path of .vhdx or .vhd file in place of image1.vhd
Now to import an image from S3 to AMI save the above JSON code with the “containers.json” name and execute the below command# aws ec2 import-image –description “My server VM” –disk-containers file://containers.jsonNote: The above steps are for a single disk.
To check the status of the import task, execute the below command and replace the image id with your that you will get after executing the import command in the above step #aws ec2 describe-import-image-tasks –import-task-ids import-ami-0bcd5574baf142f2b
Now go to the AWS console and vising the AMI tab under the EC2 dashboard and launch the instance using that image.
This blog covered how to migrate an instance from GCP to AWS using the CLI method and this blog also gives an overview to do migration from on-premises or other cloud service providers. We demonstrated setting up the CLI Migration environment using the Import/Export service.
There are many reasons why you want to migrate from one public cloud service provider to another or from on-premises. Another cloud service provider might be better in terms of the services, service-level agreements (SLAs), performance, and cost.
Thanks for reading this blog on migrating Instances from GCP and on-premises to AWS using the CLI method. If you have any comments or questions, do not hesitate to leave a reply in the comments section.
CloudThat is the official AWS (Amazon Web Services) Advanced Consulting Partner, Microsoft Gold Partner, Google Cloud Partner, and Training Partner helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space.Explore our consulting here.
If you have any queries regarding Migration, AWS Command Line Instance, or any other AWS service, drop a line below the comments section. I will get back to you at the earliest.
What is AWS Import/Export?
It is a service that moves a large amount of data in/out of AWS. Also, it is used to move back up, migrating data into the cloud.
What is AWS Configure?
AWS Configure is used to set up AWS CLI to interact with AWS. After running “aws configure,’ you will be prompted to provide Access Key Id, Secret Access key, default AWS region, and output format.
What are IAM roles and IAM policies?
IAM Roles manage who has access to your AWS account resources, whereas IAM policies control their permissions. An IAM role with no policies will not have access to any AWS resources.