To export virtual machines for deployment to virtualized environments, AWS supports exporting from an Amazon Machine Image (AMI) using the AWS CLI.
Access the EC2 Management Console to retrieve the AMI ID for exporting.
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:
import-bucket-2021
)export/
)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>
After downloading the VHD hard disk file to your on-premises system, you can proceed to deploy the virtual machine using the VHD file.