Prerequisites
-
Install Amazon EC2 CLI (refer to official documentation)
-
Create an Amazon S3 bucket for storing exported VM images
Step 1: Create S3 Bucket
-
Open Amazon S3 Console
-
Select Create Bucket
-
In the dialog window:
-
Enter a unique bucket name (must be globally unique across all S3 buckets)
-
Select your AWS Region
-
-
Confirm bucket creation
Step 2: Export Virtual Machine
Use the following command syntax:
ec2-create-instance-export-task instance_id -e target_environment -f disk_image_format -c container_format -b s3_bucket
Parameters:
-
instance_id
: Your EC2 instance ID (e.g., i-78e485d8) -
target_environment
: Destination platform (vmware
) -
disk_image_format
: Disk format (vmdk
for VMware,vhd
for Hyper-V/Xen) -
container_format
: Output file format (ova
for VMware) -
s3_bucket
: Your target bucket name
Example:
ec2-create-instance-export-task i-78e485d8 -e vmware -f vmdk -c ova -b mybucket
Troubleshooting
If encountering "server not found" errors:
Linux/MacOS:
export EC2_URL=https://<service_endpoint>
Example
export EC2_URL=https://ec2.us-west-2.amazonaws.com
Windows:
-
Right-click Computer → Properties
-
Navigate to:
Advanced system settings → Environment Variables
3. Under User variables, click New
4. Set:
-
Variable name:
EC2_URL
-
Variable value:
https://<service_endpoint>