Article ID: kb00230Last Modified: 16-Oct-2026

How to import your image to AWS EC2 manually


Use case

Sometimes, due to various limitations, it might be necessary to know how to use the VM import image option for restoring/migrating your server to AWS EC2 manually.

Before you begin

As usual, before starting the process, you have to follow the list of prerequisites and make sure that your image is compatible and ready for importing.

To make sure that your system is on the list of supported systems, refer to the AWS Documentation and find if it's on it. Besides that, you can check what formats can be used for initiating the import process.

Below is an example of importing a VHD file exported from Hyper-V. In fact, this VHD file was restored from an image-based backup made by CloudBerry Lab.

The OS that was aimed for export is Windows Server 2008 Standard, 64-bit


Steps to perform

  1. Upload your VHD (VHDX, OVA, VMDK) to an AWS S3 bucket. It is better to use a bucket in the same region where you are going to spin up your EC2 instance.
  2. The upload process will take some time, so meanwhile you can do other things.
  3. Install AWS CLI on your device: Install the AWS CLI on Windows Install the AWS CLI on Linux Install the AWS CLI on macOS
  4. Configure it by issuing the aws configure command. You'll be prompted to enter your security credentials (Access Key ID, Secret Access Key), default region and default output format. Replace all fields with yours.

Example:


$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
  1. Prepare the JSON document that will be needed later. This document should contain the information about the disk format, the bucket where the virtual disk is located and the folder (prefix) where this disk was uploaded. Name the file containers.json and save it somewhere on your computer. For easier use, it is better to save it in the same directory as your AWS CLI/bin, because you'll be running commands from there.

containers.json file example (replace all fields with yours)

[
  {
    "Description": "Windows 2008 VHD",
    "Format": "vhd",
    "UserBucket": {
        "S3Bucket": "my-import-bucket",
        "S3Key": "vms/my-windows-2008-vm.vhd"
    }
}]
  1. Once the virtual disk is uploaded to the bucket and the JSON file is created, you can start the import job.
  2. Run the command (fill in all needed fields with your values):
aws ec2 import-image --description "Windows 2008 VHD" --license-type <value> --disk-containers "file://containers.json"

Available licensing options:

Auto (default) Detects the source-system operating system (OS) and applies the appropriate license to the migrated virtual machine (VM). AWS Replaces the source-system license with an AWS license, if appropriate, on the migrated VM. BYOL Retains the source-system license, if appropriate, on the migrated VM.

  1. Once you start the import, you'll receive output with the status and import task ID.

  2. To check the status, issue another command (replace the task ID with yours):

aws ec2 describe-import-image-tasks --import-task-ids import-ami-050c284124612f49d

  1. There are different statuses (from the beginning to the end): converting -> booting.
  2. You need to receive output with the status "completed" and with the snapshot ID.
  3. Once you get it, you can go to the AWS console, find the AMI there and launch an instance from it.

For more commands you can refer to the AWS VM Import/Export User Guide


Contact Us