Menu
Amazon Elastic Compute Cloud
User Guide for Linux Instances

Step 4: Importing Your VM into Amazon EC2

After exporting your VM from your virtualization environment, you can import it into Amazon EC2. The import process is the same regardless of the origin of the VM.

Here are some important things to know about your VM instance, as well as some security and storage recommendations:

  • Amazon EC2 automatically assigns a private DHCP IP address to your instance. The DNS name and IP address are available through the ec2-describe-instances command when the instance starts running. If the instance is imported into a VPC, it will not get a public IP address, though the subnet has auto-assign public IP enabled, for security reasons. However, you may create an Elastic IP address (EIP) and attach it to the imported instance.

  • Your instance will have only one Ethernet network interface.

  • We recommend that your Windows instances contain strong passwords for all user accounts. We recommend that your Linux instances use public keys for SSH.

  • For Windows instances, we recommend that you install the latest version of the Amazon Windows EC2Config Service after you import your virtual machine into Amazon EC2.

To import a VM in OVA format into Amazon EC2

You can upload your VMs in OVA format to your Amazon S3 bucket using the upload tool of your choice. After you upload your VM to Amazon S3, you can use the AWS CLI to import your OVA image. These tools accept either a URL (public Amazon S3 file, a signed GET URL for private Amazon S3 files) or the Amazon S3 bucket and path to the disk file.

Use aws ec2 import-image to create a new import image task.

The syntax of the command is as follows:

$ aws ec2 import-image --description "Windows 2008 OVA" --disk-containers file://containers.json

The file containers.json is a JSON document that contains information about the image. The S3Key is the name of the image file you want to upload to the S3Bucket.

[{
    "Description": "First CLI task",
    "Format": "ova",
    "UserBucket": {
        "S3Bucket": "my-import-bucket",
        "S3Key": "my-windows-2008-vm.ova"
    }
}]

Example response

<ImportImageResponse xmlns="http://ec2.amazonaws.com/doc/2015-03-01/">
    <progress>2</progress>
    <importTaskId>import-ami-fgxn195v</importTaskId>
    <status>active</status>
    <description>Windows 2008 OVA</description>
    <snapshotTaskDetailSet>
        <item>
            <diskImageSize>0.0</diskImageSize>
            <userBucket>
                <s3Bucket>my-import-bucket</s3Bucket>
                <s3Key>my-windows-2008-vm.ova</s3Key>
            </userBucket>
        </item>
    </snapshotTaskDetailSet>
    <licenseType>AWS</licenseType>
    <statusMessage>pending</statusMessage>
    <requestId>1571e127-d6d8-4984-b4f1-3a21e9dbdcb5</requestId>
</ImportImageResponse>
            

To import a VM with multiple explicit disks into Amazon EC2

After you upload your VM disk images to Amazon S3, you can use the AWS CLI to import your disk images or snapshots. These tools accept either a URL (public Amazon S3 file, a signed GET URL for private Amazon S3 files) or the Amazon S3 bucket and path to the disk file. You can also use Amazon EBS snapshots as input to the ImportImage API.

Example using the aws ec2 import-image command with multiple explicit disks

Use aws ec2 import-image command to create a new import image task.

$ aws ec2 import-image --description "Windows 2008 VMDKs" --disk-containers file://containers.json

The file containers.json is a JSON document that contains information about the images. The S3Key is the name of the image files you want to upload to the S3Bucket. You can upload your volume by specifying the URL to the Amazon S3 bucket, by providing the Amazon S3 bucket name and key, or by providing the EBS snapshot ID. For more information, see import-image.

[{
    "Description": "First CLI task",
    "Format": "vmdk",
    "UserBucket": {
        "S3Bucket": "my-import-bucket",
        "S3Key": "my-windows-2008-vm-disk1.vmdk"
    }
},
            
 {
    "Description": "Second CLI task",
    "Format": "vmdk",
    "UserBucket": {
        "S3Bucket": "my-import-bucket",
        "S3Key": "my-windows-2008-vm-disk2.vmdk"
    }
}]

Example response

<ImportImageResponse xmlns="http://ec2.amazonaws.com/doc/2015-03-01/">
    <progress>2</progress>
    <importTaskId>import-ami-fgxn591c</importTaskId>
    <status>active</status>
    <description>Windows 2008 VMDKs</description>
    <snapshotTaskDetailSet>
        <item>
            <diskImageSize>0.0</diskImageSize>
            <userBucket>
                <s3Bucket>my-import-bucket</s3Bucket>
                <s3Key>my-windows-2008-vm-disk1.vmdk</s3Key>
            </userBucket>
        </item>
        <item>
            <diskImageSize>0.0</diskImageSize>
            <userBucket>
                <s3Bucket>my-import-bucket</s3Bucket>
                <s3Key>my-windows-2008-vm-disk2.vmdk</s3Key>
            </userBucket>
        </item>
    </snapshotTaskDetailSet>
    <licenseType>AWS</licenseType>
    <statusMessage>pending</statusMessage>
    <requestId>1571e127-d6d8-4984-b4f1-3a21e9dbdcb5</requestId>
</ImportImageResponse>