Exporting Amazon EC2 Instances
If you have previously imported an instance into Amazon EC2, you can use the command line tools to export that instance to Citrix Xen, Microsoft Hyper-V, or VMware vSphere. Exporting an instance that you previously imported is useful when you want to deploy a copy of your EC2 instance in your on-site virtualization environment.
If you're using VMware vSphere, you can also use the AWS Connector for vCenter to export a VM from Amazon EC2. For more information, see Exporting a Migrated Amazon EC2 Instance in the AWS Management Portal for vCenter User Guide.
Export an Instance
You can use the Amazon EC2 CLI to export an instance. If you haven't installed the CLI already, see Setting Up the Amazon EC2 Tools.
The ec2-create-instance-export-task command gathers all of the information necessary (e.g., instance ID; name of the Amazon S3 bucket that will hold the exported image; name of the exported image; VMDK, OVA, or VHD format) to properly export the instance to the selected virtualization format. The exported file is saved in the Amazon S3 bucket that you designate. VM Export supports the export of Dynamic Virtual Hard Disks (VHDs). Fixed VHDs are not supported.
Note
When you export an instance, you are charged the standard Amazon S3 rates for the bucket where the exported VM is stored. In addition, a small charge reflecting temporary use of an Amazon EBS snapshot might appear on your bill. For more information about Amazon S3 pricing, see Amazon Simple Storage Service (S3) Pricing.
To export an instance
Create an Amazon S3 bucket for storing the exported instances. The Amazon S3 bucket must grant Upload/Delete and View Permissions access to the [email protected] account. For more information, see Creating a Bucket and Editing Bucket Permissions in the Amazon Simple Storage Service Console User Guide.
Note
Instead of the [email protected] account, you can use region-specific canonical IDs. The Amazon S3 bucket for the destination image must exist and must have WRITE and READ_ACP permissions granted to the following region-specific accounts using their canonical ID:
China (Beijing): 834bafd86b15b6ca71074df0fd1f93d234b9d5e848a2cb31f880c149003ce36f
AWS GovCloud (US) : af913ca13efe7a94b88392711f6cfc8aa07c9d1454d4f190a624b126733a5602
For more information, see Amazon Elastic Compute Cloud (Amazon EC2) in the AWS GovCloud (US) User Guide.
All other regions: c4d8eabf8db69dbe46bfe0e517100c554f01200b104d59cd408e777ba442a322
At a command prompt, type the following command:
ec2-create-instance-export-taskinstance_id-etarget_environment-fdisk_image_format-ccontainer_format-bs3_bucketinstance_idThe ID of the instance you want to export.
target_environmentVMware, Citrix, or Microsoft.
disk_image_formatVMDK for VMware or VHD for Microsoft Hyper-V and Citrix Xen.
Note
VM Export only supports Dynamic Virtual Hard Disks (VHDs). Fixed VHDs are not supported.
container_formatOptionally set to OVA when exporting to VMware.
s3_bucketThe name of the Amazon S3 bucket to which you want to export the instance.
To monitor the export of your instance, at the command prompt, type the following command, where
task_idis the ID of the export task:ec2-describe-export-taskstask_id
Cancel or Stop the Export of an Instance
You can use the Amazon EC2 CLI to cancel or stop the export of an instance up to the point of completion. The ec2-cancel-export-task command removes all artifacts of the export, including any partially created Amazon S3 objects. If the export task is complete or is in the process of transferring the final disk image, the command fails and returns an error.
To cancel or stop the export of an instance
At the command prompt, type the following command, where
task_id is the ID of the export task:
ec2-cancel-export-task task_id
