Vinchin Backup & Recovery
  • ● Easily backup popular VMs like VMware, Hyper-V, XenServer, XCP-ng, etc.
  • ● Effortlessly migrate VM between different virtualization platforms (V2V)
  • ● Comprehensive protection to databases like MySQL, SQL Server, OracleDB, etc.
  • ● Integrated enterprise backup solutions for Windows/Linux, NAS, etc.
DOWNLOAD FREE TRIAL
Home VM Backup How to Export EC2 Instance and Import On-Premise VM to AWS?

How to Export EC2 Instance and Import On-Premise VM to AWS?

2024-06-03 | Nick Zhao

Table of contents
  • Why learn exporting Amazon EC2 instance and importing VM?
  • How to export Amazon EC2 instance via AWS CLI command?
  • How to import AMI to AWS?
  • How to import on-premise VM to AWS?
  • How to backup and migrate VM with Vinchin Backup & Recovery?
  • EC2 instance export FAQs
  • Sum Up
Are you looking for a robust VM backup and migration solution? Try Vinchin Backup & Recovery!↘ Download Free Trial

Cloud computing greatly reduces the burden of deployment of production systems and improves their work efficiency. Both the public cloud and private cloud can help companies easily create virtual machines to easily deploy production systems.

To ensure data security and business continuity of production systems, it is necessary to learn the ways to manage VMs in the production environments. AWS EC2 instance and VMware VM are the popular VMs used by companies so this post will teach you the ways to export and import VM in AWS and VMware.

Why learn exporting Amazon EC2 instance and importing VM?

Disaster Recovery: Data backup is the golden rule in data center to ensure data security. For the full instance or VM, it is recommended to backup the full machine rather than copying certain files as data backup. Although all the VM data is often stored in the same folder, it is still not recommended to backup the VM by copying and pasting because it might cause data validity issue when you restore the VM. By exporting and importing VMs with methods provided by the vendors it will improve the success rate of VM recovery.

Data Migration: Except for using professional data migration solutions, users often manually migrate VM data by exporting and importing full machine. AWS allows you to export the instant to AMI (Amazon Machine Image) which can be used to deploy a new instance in new environment. For importing full machine to other virtual environments, AWS also allows you to export the EC2 instance to OVA (Open Virtual Appliance), vhd file (Virtual Hard Disk), and vmdk file (Virtual Machine Disk) which can be used to import the machine to VMware vSphere, Hyper-V, and XenServer (Citrix Hypervisor).

How to export Amazon EC2 instance via AWS CLI command?

As is mentioned before, you can export EC2 instance to different formats for different purposes. You need to use the AWS CLI command line to export the instance to S3. If you need to store the VM export in another location, you need to download it and then save it to another location.

Export to AMI:

1. Get the instance ID

aws ec2 describe-instances

2. Create the AMI image

aws ec2 create-image `
--instance-id i-0d4c797cb0360ef32 `
--name "MyBackup-1" `
--description "Backup of my EC2 instance created on $(Get-Date -Format yyyyMMdd_HHmmss)"

Export to vmdk:

1. Write a script for detailed job description:

    "ContainerFormat": "ova",
    "DiskImageFormat": "VMDK",
    "S3Bucket": "my-export-bucket",
    "S3Prefix": "vms/"

2. Export the EC2 instance to OVA/vmdk

aws ec2 create-instance-export-task --instance-id instance-id --target-environment vmware --export-to-s3-task file://C:\file.jsonVmdk file is included in the OVA template and both of them can be used to

Export to vhd:

To use the instance export in Hyper-V or Citrix Hypervisor, you just need to change the parameters in the command:

For Hyper-V:

1. Write a script for detailed job description:

    "ContainerFormat": "ova",
    "DiskImageFormat": "vhd",
    "S3Bucket": "my-export-bucket",
    "S3Prefix": "vms/"

2. Export the EC2 instance to OVA/vhd

aws ec2 create-instance-export-task --instance-id instance-id --target-environment vmware --export-to-s3-task file://C:\file.json

 For Citrix Hypervisor:

1. Write a script for detailed job description:

    "ContainerFormat": "ova",
    "DiskImageFormat": "vhd",
    "S3Bucket": "my-export-bucket",
    "S3Prefix": "vms/"

2 Export the EC2 instance to OVA/vhd

aws ec2 create-instance-export-task --instance-id instance-id --target-environment citrix --export-to-s3-task file://C:\file.json

How to import AMI to AWS?

With the AMI as VM export, you can restore data from it. Just use the following command line:

aws ec2 create-restore-image-task \
    --object-key ami-1234567890abcdef0.bin \
    --bucket myamibucket \
    --name "New AMI Name"

How to import on-premise VM to AWS?

As AWS allows you to export EC2 instance to VM export compatible with VMware, Hyper-V, Citrix Hypervisor, it also allows you to import such kinds of VMs to AWS.

Prerequisites:

● You need to upload the VM export to an S3 bucket.

● You need to create an IAM role named vmimport

1. Write a script for detailed job description:

    "Description": "My Server OVA",
    "Format": "ova",
    "UserBucket": {
        "S3Bucket": "my-import-bucket",
        "S3Key": "vms/my-server-vm.ova"

 2. Import the VM to AWS

aws ec2 import-image --description "My server VM" --disk-containers "file://C:\import\containers.json"

How to backup and migrate VM with Vinchin Backup & Recovery?

To easily backup EC2 instance and migrate VM between different platforms, you can use a professional solution like Vinchin Backup & Recovery which supports backing up and migrating VM like AWS EC2, VMware, Hyper-V, Proxmox, Citrix Hypervisor, XCP-ng, OLVM, oVirt, OpenStack, etc.

You don’t have to use complicated command lines to export and import VM for data backup and full machine migration but simply create jobs within a few steps in a user-friendly web console.

Vinchin Backup & Recovery will allow you to add all the AWS instances in all regions under account with the access key and you can add many useful backup strategies to it like incremental backup, data compression and deduplication, data encryption, etc. You can also choose to store the data backup in the cloud or on-premise datastore.

It is very simple to backup the EC2 instance.

1. Select the EC2 instancesSelect EC2 instance

2. Select the backup storageSelect Backup Storage

3. Select backup strategiesSelect Backup Strategies

4. Submit the jobSubmit the job

If you need to migrate VM between AWS and another platform, just select a VM backup and restore it on the target plaform.

Vinchin Backup & Recovery has been selected by thousands of companies to protect virtual machines and other facilities and you can also start a 60-day full-featured free trial here to protect your EC2 instances. For any questions, you can contact our sales for support.

EC2 instance export FAQs

1. Can all types of EC2 instances be exported?

You can export most EC2 instances but not all of them. For example, you can’t export an instance containing a third-party software like SQL Server provided by AWS. You can uninstall it or try a new backup and migration solution like Vinchin Backup & Recovery.

2. Are there any limitations on the size of the instance to be exported?

According to AWS, you can’t export an EC2 instance with volumes larger than 1 TiB.

3. How often should you export EC2 instance?

If you want to use it as data backup, try exporting it once a week. It is recommended to use an automatic backup solution like Vinchin Backup & Recovery to simplify the job.

Sum Up

AWS allows you to create EC2 instances to run business systems and you can export the instances for disaster recovery and data migration. In this post, you have learned the ways to export EC2 instances to AMI, OVA, VMDK, and VHD for different purposes and import different VM and export to AWS for data migration.

To facilitate easy disaster recovery and data migration, you can use a powerful professional solution like Vinchin Backup & Recovery. Don’t miss the free trial.

Share on:

Categories: VM Backup
You May Also Like...