VM Import / Export Prerequisites

Operating Systems

  • Microsoft Windows Server 2003 SP1, 2003 R2, 2008, 2008 R2, 2012, 2012 R2 (Standard, Datacentre, Enterprise)
  • Microsoft Windows 7 US English (Professional, Enterprise, Ultimate)
    You must have existing licenses with rights to use these licenses in a third-party, multi-tenant cloud like AWS (using BYOL flag with the LicenseType parameter).
Licenses

In general, when you import your Microsoft Windows VM images into Amazon EC2, AWS will provide the appropriate Microsoft Windows Server license key for your imported instance.

To use your own Windows license, when importing the VM image, you must use the BYOL flag with the LicenseType parameter. Your BYOL instances will be priced at the prevailing Amazon EC2 Linux instance pricing.

Image Formats

  • RAW disk image
  • VHD (compatible with Microsoft Hyper-V and Citrix Xen)
  • VMDK (compatible with VMware EXS and vSphere)
  • OVA (supports importing images with multiple hard disks)
Instance Types

AWS supports importing Windows instances into any instance type (no free tier).

Volume Type and File Systems

AWS supports importing Windows (32-bit and 64-bit) instance using the NTFS file systems.

VM Import Service Role

Default, VM Import uses a role in your AWS account with the name vmimport.

To create the role using AWS CLI, simply do the following:

  • Create a file named trust-policy.json as:

{

   “Version”:”2012-10-17″,

   “Statement”:[

      {

         “Sid”:””,

         “Effect”:”Allow”,

         “Principal”:{

            “Service”:”vmie.amazonaws.com”

         },

         “Action”:”sts:AssumeRole”,

         “Condition”:{

            “StringEquals”:{

               “sts:ExternalId”:”vmimport”

            }

         }

      }

   ]

}

  • Use AWS CLI, run the aws iam create-role command to create the role

aws iam create-role –role-name vmimport –assume-role-policy-document file://C://temp//trust-policy.json –no-verify-ssl

  • Crete a file named role-policy.json as:

{

   “Version”:”2012-10-17″,

   “Statement”:[

      {

         “Effect”:”Allow”,

         “Action”:[

            “s3:ListBucket”,

            “s3:GetBucketLocation”

         ],

         “Resource”:[

            “arn:aws:s3:::<disk-image-file-bucket>”

         ]

      },

      {

         “Effect”:”Allow”,

         “Action”:[

            “s3:GetObject”

         ],

         “Resource”:[

            “arn:aws:s3:::<disk-image-file-bucket>/*”

         ]

      },

      {

         “Effect”:”Allow”,

         “Action”:[

            “ec2:ModifySnapshotAttribute”,

            “ec2:CopySnapshot”,

            “ec2:RegisterImage”,

            “ec2:Describe*”

         ],

         “Resource”:”*”

      }

   ]

}

  • Use AWS CLI, run the aws iam put-role-policy command to attach the policy to the role created:

aws iam put-role-policy –role-name vmimport –policy-name vmimport –policy-document file://C://temp//trust-policy.json  –no-verify-ssl

 Requirements and Limitations

  • Disk image cannot exceed 1 TB.
  • Make sure that you have at least 250 MB of available disk space for installing drivers and other software.
  • Multiple network interfaces are not currently supported.
  • IPv6 are not supported.
  • VM Import does not install the single root I/O virtualization (SR-IOV) drivers except for imports of Microsoft Windows Server 2012 R2 VMs.
  • To use your own Microsoft licenses through set LicenseType as BYOL, your BYOL instances will be priced at the prevailing AWS EC2 Linux instance pricing, provided that you run on a Dedicated Instance.

VM Import Process

  • Export VM to .VHD,.VMDK,.OVA
  • Import the Disks to S3 Bucket
  • Create a disk containers file (Containers.json) like below.

[

      {

    “Description”: “Solarwinds Disk”,

    “Format”: “VHD/VMDK/OVA”,

    “UserBucket”: {

        “S3Bucket”: “Bucketname”,

        “S3Key”: “Disk Path”

    }

  }

]

  • Execute below command by modifying according to your environment.

aws ec2 import-image –description “Test” –platform Linux/Windows –role-name vmimport –license-type BYOL/AWS –no-verify-ssl –disk-containers file://C://temp//containers.json

  •  Execute below command to view the status of your import process.

AWS ec2 describe-import-image-tasks

Import VM to AWS EC2