Export virtual machine from AMI

Export virtual machine from Amazon EC2 AMI

To export virtual machines for deployment to on-premises virtualization environments, AWS supports export from AMI through the use of AWS CLI.

  1. Access the EC2 Management Console to get the AMI ID information needed for export.

EC2 Management Console

  1. Run the aws ec2 export-image command to initiate the process of exporting AMI to the desired format for your virtualization environment.
  • --image-id: AMI ID obtained from the EC2 instance list.
  • --disk-image-format: Virtual machine/virtual disk file format (e.g., vmdk or vhdx)
  • --s3-export-location: Specify the location where the exported file will be stored:
    • Storage S3 bucket (e.g., export-bucket-2026-1a)
    • Storage path in bucket (e.g., exports/)
  • Run the aws ec2 export-image command to initiate the process of exporting AMI to the desired format for your virtualization environment.
aws ec2 export-image --image-id ami-xxxxxxxx --disk-image-format VMDK --s3-export-location S3Bucket=export-bucket-2026-1a,S3Prefix=exports/

To ensure the execution process does not encounter errors, you need to adjust the configuration parameters. Specifically, replace the ami-xxxxxxxxxxx code with your actual backup ID and ensure the target S3 bucket name is correctly specified as export-bucket-2026-1a.

AWS CLI Export Image

  1. The process of exporting AMI to VHD file (for deployment on Hyper-V) or VMDK (for VMware) will take some time (approximately 60 minutes). You can use the aws ec2 describe-export-image-tasks command to check export progress:
aws ec2 describe-export-image-tasks --export-image-task-ids export-ami-xxxxxxxxx

AWS CLI Export Image AWS CLI Export Image

  1. After completion, you will have the virtual machine’s virtual disk file stored in the S3 bucket (approximately 60 minutes).

Check Export Progress

Testing deployment of exported virtual machine

After downloading the VHD virtual disk file to the on-premises system, you can try deploying the virtual machine using this VHD file on the corresponding virtualization platform.