Export virtual machine from AMI

Exporting a Virtual Machine from EC2 AMI

To export virtual machines for deployment to virtualized environments, AWS supports exporting from an Amazon Machine Image (AMI) using the AWS CLI.

  1. Access the EC2 Management Console to retrieve the AMI ID for exporting.

    VMWare Workstation

  2. Use the following command aws ec2 export-image to initiate the AMI export process to the desired format for your virtualized environment.

    • --image-id: The AMI ID obtained from the list of EC2 instances.
    • --disk-image-format: Format for the virtual machine hard disk or file (e.g., vmdk or vhdx).
    • --s3-export-location: Specify the export file’s location:
      • S3 bucket storage (e.g., import-bucket-2021)
      • Storage path within the bucket (e.g., export/)

    VMWare Workstation

  3. The export process may take some time, depending on the selected format, such as VHD for Hyper-V virtualized environments or VMDK for VMWare Workstation. You can monitor the export progress using the command:

aws ec2 describe-export-image-tasks --export-image-task-ids <YourExportImageTaskID>

VMWare Workstation

  1. Once the export is complete, the virtual machine’s disk file will be stored in the specified S3 bucket.

VMWare Workstation

Deploying the Exported Virtual Machine

After downloading the VHD hard disk file to your on-premises system, you can proceed to deploy the virtual machine using the VHD file.