How to Migrate VMware VMs to AWS with AMI Conversion?

Discover the process of migrating VMware virtual machines to AWS, leveraging AMI as a powerful tool for launching EC2 instances.

download-icon
Free Download
for VM, OS, DB, File, NAS, etc.
iris-lee

Updated by Iris Lee on 2024/12/24

Table of contents
  • What is AWS AMI?

  • Why Migrate VMware VM to AWS?

  • How to Convert VMware to AMI?

  • Backup EC2 instance with Vinchin Backup & Recovery

  • Convert VMware to AMI FAQs

  • Conclusion

As organizations increasingly migrate workloads to the cloud, converting VMware virtual machines to AWS becomes a critical task. This process enables seamless integration of existing on-premises workloads into AWS, facilitating scalability, cost optimization, and enhanced flexibility.

What is AWS AMI?

AWS AMI refers to Amazon Machine Image, a virtual machine image that includes an operating system, applications, and any other related configurations. AMI can be used as a template to launch EC2 instances. There are two main types of AMIs: public AMIs and private AMIs. Public AMIs are created and shared by the AWS community or third parties, and anyone can use them. Private AMIs are created by you or other AWS accounts authorized by you. When selecting an AMI to launch an EC2 instance, you can choose different operating systems and pre-installed applications to meet your specific needs. You can also customize an AMI based on your requirements, including configurations and security settings. AMIs also support snapshots, which can save snapshots of instance storage volumes for later recovery. By using AMIs, you can easily create backups, deploy multiple instances with the same configuration, and scale your computing resources.

Why Migrate VMware VM to AWS?

1. AWS provides virtually unlimited resources, allowing you to scale your infrastructure up or down based on demand. Its pay-as-you-go model allows you to pay only for the resources you use, reducing operational expenses.

2. Migrating to AWS enables integration with cloud-native services like machine learning, and analytics. VMware Cloud on AWS supports hybrid environments, making it easier to modernize applications while maintaining compatibility with VMware tools.

3. AWS's extensive global infrastructure allows you to deploy workloads closer to end-users, improving performance and meeting regional compliance requirements.

How to Convert VMware to AMI?

Many times, we have to migrate VMware virtualized servers from a data center to AWS. In such cases, we first need to export the VMware virtual machines and then convert them.

Regarding VMware virtual export backups, there are generally two formats: OVA and OVF.

Here are the steps to convert a VMware virtual machine’s OVA/OVF to an AMI image on AWS:

1. Export OVA/OVF Backup

2. Upload OVA/OVF to S3

3. Convert the OVA/OVF on S3 to an AMI

The specific operations are as follows (using the OVF format as an example):

1. Preparation: First, create an S3 bucket: “s3://dcvmbackup”, and then create a subfolder under it, for example, “DC-VM-HGTAA02V”.

2. Sync the exported OVF backup directory to S3 (using “cp” upload may cause interruptions, so “sync” is recommended):

 [qq_5201351@localhost DC-VM-HGTAA02V]# aws s3 sync ./ s3://dcvmbackup/DC-VM-HGTAA02V

3. After the upload is complete, convert the backup on S3 to an AMI. First, write the OVF to AMI conversion JSON file (e.g., write it to “/tmp/vm.json”):

[
     {
       "Description": "First disk",
       "Format": "vmdk",
       "UserBucket": {
           "S3Bucket": "dcvmbackup",
           "S3Key": "DC-VM-HGTAA02V/HGTAA02V-1.vmdk"
       }
     },
     {
       "Description": "Second disk",
       "Format": "vmdk",
       "UserBucket": {
           "S3Bucket": "dcvmbackup",
           "S3Key": "DC-VM-HGTAA02V/HGTAA02V-2.vmdk"
       }
     }
   ]

4. Execute the conversion command (after successful execution, it will run in the AWS backend):

aws ec2 import-image --description "DC-VM-HGTAA02V" --disk-containers "file:///tmp/vm.json"

5. After execution, the terminal will output an “import-task-ids” value, which will default as the AMI Name in the AWS/AMIs interface once the conversion is successful.

You will also need to use this value to query the status of the conversion (it will run in several stages, and once fully converted, as shown below, the first line will show “completed”):

[qq_5201351@localhost ~]# aws ec2 describe-import-image-tasks --import-task-ids import-ami-0b31bf4357b880a82
   IMPORTIMAGETASKS x86_64 DC-VM-HGTAA02V ami-0fa0c86c6cf316c83 import-ami-0b31bf4357b880a82 AWS Windows completed
   SNAPSHOTDETAILS First disk /dev/sda1 25364550656.0 VMDK snap-0e46853558beb56dd completed
   USERBUCKET dcvmbackup DC-VM-HGTAA02V/HGTAA02V-1.vmdk
   SNAPSHOTDETAILS Second disk /dev/sdg 27609645568.0 VMDK snap-075b0c2042a3e6a88 completed
   USERBUCKET dcvmbackup DC-VM-HGTAA02V/HGTAA02V-2.vmdk
   [qq_5201351@localhost ~]#

Note: The AMI-ID (like “ami-0fa0c86c6cf316c83”) will only be visible after the conversion is completed.

Additional note: For the OVA format, the JSON file is a bit different because it’s a single file, so the syntax will be simpler, as shown below:

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

However, it seems that most new versions of vCenter/ESXi only support OVA format exports by default.

The conversion process for OVA is the same as for OVF. In some cases, when converting certain hosts, the “--license-type BYOL” option may also be added, but technically, it is not necessary.

If you want to cancel an active import task, you can use the “cancel-import-task” command as follows:

aws ec2 cancel-import-task --import-task-id import-ami-1234567890abcdef0

Backup EC2 instance with Vinchin Backup & Recovery

Vinchin Backup & Recovery supports AWS EC2 backups, allowing users to add instances with their AWS access key ID and configure full, incremental, or differential backups. It offers flexible recovery options, including entire instances, individual volumes, and specific files, with direct recovery to other virtualization platforms. Integrating with Amazon S3 for secure archiving, it also enables V2V migrations to platforms like VMware, Hyper-V, and Proxmox. The user-friendly interface simplifies backup management and configuration.

To backup EC2 instance with Vinchin Backup & Recovery, follow these steps:

1. Select the EC2 instance to be backed up.

Backup EC2 instance

2. Select the backup destination.

Backup EC2 instance

3. Configure the backup strategies.

Backup EC2 instance

4. Review and submit the job.

Backup EC2 instance

Start your 60-day free trial of Vinchin Backup & Recovery to experience its secure, resource-efficient backup solutions. Or, contact us for a customized plan tailored to your IT needs.

Convert VMware to AMI FAQs

1. Q: How does storage differ between VMware and AWS?

VMware uses local datastores or SANs for VM storage, while AWS uses EBS for EC2 instances. Ensure your disk configurations (e.g., boot volume, additional disks) are mapped to the appropriate EBS volumes during the migration.

2. Q: What is the best instance type for running imported VMware VMs?

Choose an EC2 instance type that closely matches the resources of your VMware VM. AWS provides instance families optimized for general use (e.g., t2/t3), compute (c5), memory (r5), and storage (i3).

Conclusion

Converting VMware VMs to AMIs is a powerful way to migrate on-premises workloads to AWS, unlocking the full potential of cloud computing. By following this comprehensive guide, IT professionals can ensure a smooth and efficient migration process, paving the way for operational excellence and cost efficiency in the cloud.

Share on:

Categories: VM Migration
Free Trial Now close-icon