Amazon AWS – Importing Linux VM into Amazon EC2 cloud
Articles,  Blog

Amazon AWS – Importing Linux VM into Amazon EC2 cloud


Importing your VM into Amazon EC2 cloud – Proposal – This video will show you how to export a linux virtual machine from VMware ESXi and import it into the Amazon cloud known as AWS – Steps – Step 01 – Download AWS CLI, Step 02 – Install AWS CLI, Step 03 – Get your access keys, Step 04 – Test your access, Step 05 – Export the virtual machine, Step 06 – Import the virtual machine, Step 07 – Access the virtual machine Importing your VM into Amazon EC2 cloud – Proposal – This video will show you how to export a linux virtual machine from VMware ESXi and import it into the Amazon cloud known as AWS – Steps – Step 01 – Download AWS CLI, Step 02 – Install AWS CLI, Step 03 – Get your access keys, Step 04 – Test your access, Step 05 – Export the virtual machine, Step 06 – Import the virtual machine, Step 07 – Access the virtual machine Download AWS CLI as shown. Install AWS CLI as shown Use the command below to configure AWS CLI. You will need a AWS security credentials to proceed. Login to your Amazon account and select the AWS EC2 option. Click on your name and select the Security Credentials option. Select the Access Keys option and create a new access key. Download the file containing the access information. Enter the access credential information in AWS CLI application as shown. Finally, enter AWS region that you wants to be connected by default. Link to the Amazon cloud regions list in the video description. Run the following command to test installation and create a security group called FKIT in the selected region AWS CLI was successfully configured. Now we will prepare your virtual machine to be sent to the amazon cloud. In our example, we will export a Linux virtual machine running ubuntu from a VMWare ESXi server to Amazon. First, if you have Vmware-tools installed just remove it from the virtual machine. Create a user that will be used for remote access. Install the applications required for remote access using the command below. Set root permission for the user you created earlier through sudo. Configure your compute to use dynamic IP addressing (DHCP) for the EHT0 interface as shown. Turn off your Linux virtual machine properly. Export your virtual machine in OVA format as shown. Sign in to your Amazon account and select the AWS S3 option Create a repository (bucket) where the image export from VMWare as demonstrated will be stored. In our example, we will create a repository called my-images. Import the OVA image of your virtual machine to the repository created as shown. Sign in to your Amazon account and select the AWS IAM option. Create a new rule called vmimport and assign administrative permission as shown. Edit the trust relationship, change the service named to vmie.amazonaws.com and add the following condition as shown. Open a command prompt and run the following command to import the image of your repository for the Amazon cloud. Remember to change the red fields to reflect your environment. Check the status of importing your image by running the following command. Remember to change the import ID to reflect your environment. Wait for the end of your import process. Access the administrative interface AWS and create a new virtual machine using the image created in VMWare and imported into the cloud amazon. Access your new virtual machine remotely as shown.

20 Comments

  • sydney botchway

    Master piece! only thing I noticed whiles editing the trust relationship is "sts:Externalld": "vmimport" its suppose to be "id" NOT "ld" else you will get this error "A client error (InvalidParameter) occurred when calling the ImportImage operation: The service role <vmimport> does not exist or does not have sufficient permissions for the service to continue"  
    Good Video. thank you .

  • Magdiel Sanchez

    Hi Buddy,

    I'm facing trouble making this process, mainly because python is rejecting the syntaxis due to unicode issue , can´t even try the: aws configure command as there´s always the same error (also with import image command):

    Traceback (most recent call last):
    File "aws", line 27, in <module>
    File "aws", line 23, in main
    File "awscliclidriver.pyc", line 49, in main
    :param args: List of arguments, with the 'aws' removed. For example,
    File "awscliclidriver.pyc", line 57, in create_clidriver
    N(↓
    File "botocoresession.pyc", line 368, in full_config
    :param api_version: The API version to use. By default, botocore will
    File "botocoreconfigloader.pyc", line 105, in load_config
    [preview]
    File "botocoreconfigloader.pyc", line 126, in raw_config_parse
    {"profiles": {"test": {"aws_…": "foo", "aws…": "bar"},
    File "botocoreexceptions.pyc", line 27, in _init_
    :ivar path: The data path that the user attempted to load.
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 18: ordinal
    not in range(128)

    Do you know any workaround?'?
    Thanks

  • Sreeraj M S

    I am following this tutorial, but getting the following error after I try to convert the uploaded .ova file to image:

    An error occurred (InternalError) when calling the ImportImage operation (reached max retries: 4): None

    Any idea what it could be guy? I am running the 'aws ec2…' command from a Windows machine commandline.

  • Michael Curtis

    Excellent video. I thought it might help if the commands were easy to copy and paste

    Trust policy

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Sid": "",
    "Effect": "Allow",
    "Principal": {
    "Service": "vmie.amazonaws.com"
    },
    "Action": "sts:AssumeRole",
    "Condition": {
    "StringEquals": {
    "sts:Externalid": "vmimport"
    }
    }
    }
    ]
    }

    Import OVA

    # aws ec2 import-image –cli-input-json "{ "Description": ”Imported-Name", "DiskContainers": [ { "Description": "Imported-Name", "UserBucket": {"S3Bucket": ”bucketname", "S3Key" : ”image-name.ova" } }] }"

    Check progress

    # aws ec2 describe-import-image-tasks –import-task-ids “number"

  • Vivek Parmar

    I am facing issue with the DHCP configuration

    Do we need to type the code in the interfaces file ? because my /etc/network/interfaces file is blank

  • Hung Trinh

    I got the following error: "when calling the ImportImage operation: S3 key does not exist: AWS_ImportAMI/CentOS7MySql.ova"
    The AWS IAM role menu has changed.

  • Mike Ellertson

    Great tutorial, thanks for posting it! One quick question, I did exactly as presented, but after executing the command to check status of the image I get the following:

    $ aws ec2 describe-import-image-tasks –import-task-ids "import-ami-fgo1l6yl"
    {
    "ImportImageTasks": [
    {
    "Status": "active",
    "Description": "Dovecot Email Image on Debian 9",
    "SnapshotDetails": [
    {
    "UserBucket": {
    "S3Bucket": "images.binarycapital.io",
    "S3Key": "email.ova"
    },
    "DiskImageSize": 1673192960.0,
    "Format": "VMDK"
    }
    ],
    "Progress": "28",
    "StatusMessage": "converting",
    "ImportTaskId": "import-ami-fgo1l6yl"
    }
    ]
    }

    I presume I need to wait for it to finish converting. But, where can I check the progress of it in Amazon's AWS console?

  • Jose Silva

    Thank you it works for me:

    aws ec2 import-image –cli-input-json "{"Description":"yourdescription", "DiskContainers":[{"Description":"yourdescription","UserBucket":{"S3Bucket":"yourbucketname","S3Key":"yourfilename"}}]}"

  • Santosh Mallik

    Hi
    I would like to know if you offer classes for all type of AWS migration ?. if yes i would like to join.

    Thanks and Regards

  • Abhishek Raj Heer

    The Video is very good but there's no AUDIO It would be better is you can explain things, more people will view it like it share, Please get the audio on or working.

  • vnnaidu

    aws iam create-role –role-name vmimport2 –assume-role-policy-document file://trust-policy.json

    aws iam put-role-policy –role-name vmimport –policy-name vmimport –policy-document file://role-policy.json

    aws ec2 import-image –description "MyOVF" –disk-containers file://image.json

    aws ec2 describe-import-image-tasks –import-task-ids import-ami-XXXXXXXXXXX

    https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html

Leave a Reply

Your email address will not be published. Required fields are marked *