AWS, Cloud Computing, Google Cloud (GCP)

5 Mins Read

Overview of Migrating an Instance from GCP or On-Premises to AWS using Command Line Interface


1. Overview
2. Prerequisites
3. Guide to Configure GCP
4. Step to Configure CMD
5. Steps to Configure AWS
6. Conclusion
7. About CloudThat
8. FAQs



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.

Migrating the applications on the cloud successfully could be a daunting task unless there is a structured migration plan. Learn more about the 5 Key Cloud Migration Challenges and their Proven Solutions here. 

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.


Guide to Configure GCP

  1. 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
    AWS Migration
  2. 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
    AWS Migration
  3. Next, download that image to your local machine and follow the below steps:
    AWS Migration

Steps to Configure CMD

  1. Install or update the latest version of AWS CLI into your local machine
  2. 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:
    AWS Migration

  3. 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
    AWS Migration

  4. 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
    AWS Migration

Steps to Configure AWS

  1. 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
  2. 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.
    AWS Migration
  3. 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
    AWS Migration
  4. 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.

While adopting new cloud technologies is a challenge, adhering to the budget without compromising the security posture can prove to be next to impossible without an expert. Here is a guide for Strategizing Effective Cloud Migrations with an Example Case Study

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.

About CloudThat

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.


  1. 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.

  1. 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.

  1. 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.

WRITTEN BY Mayank Bharawa



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!