Restore a virtual machine using AWS Backup
You can restore a virtual machine to VMware, VMware Cloud on AWS, VMware Cloud on AWS Outposts, an Amazon EBS volume, or to an Amazon EC2 instance. Restoring (or migrating) a virtual machine to EC2 requires a license. By default, AWS will include a license (charges apply). For more information, see Licensing options in the VM Import/Export User Guide.
You can restore a VMware virtual machine using the AWS Backup console or through the AWS CLI. When a virtual machine is restored, the VMware Tools folder is not included. See VMware documentation to reinstall VMware Tools.
AWS Backup restores of virtual machines are non-destructive, meaning AWS Backup does not overwrite existing virtual machines during a restore. Instead, the restore job deploys a new virtual machine.
Tasks
Considerations when restoring a VM to an Amazon EC2 instance
-
Restoring (or migrating) a virtual machine to EC2 requires a license. By default, an AWS will include a license (charges apply). For more information, see Licensing options in the VM Import/Export User Guide.
-
There is a maximum limit of 5 TB (terabytes) for each virtual machine disk.
-
You can't specify a key pair when you restore the virtual machine to an instance. You can add a key pair to
authorized_keys
during launch (through instance user data) or after launch (as described in this troubleshooting section in the Amazon EC2 User Guide). -
Confirm your operating system is supported for import to and export from Amazon EC2 in the VM Import/Export User Guide.
-
Review limitations involved with Importing VMs to Amazon EC2 in the VM Import/Export User Guide.
-
When you restore to an Amazon EC2 instance using AWS CLI, you must specify
"RestoreTo":"EC2Instance"
. All other attributes have default values. -
Amazon EC2 offers EC2 Allowed AMIs. If this setting is enabled in your account, add the alias
aws-backup-vault
to your allowlist. Otherwise, restore operations of VM recovery points to EC2 instances will fail with an error message, such as "Source AMI not found in Region".
Use the AWS Backup console to restore virtual machine recovery points
You can restore a virtual machine from multiple locations in the left navigation pane of the AWS Backup console:
-
Choose Hypervisors to view recovery points for virtual machines managed by a hypervisor that is connected to AWS Backup.
-
Choose Virtual machines to view recovery points for virtual machines across all your hypervisors that are connected to AWS Backup.
-
Choose Backup vaults to view recovery points stored in a specific AWS Backup vault.
-
Choose Protected resources to view recovery points across all your AWS Backup protected resources.
If you need to restore a virtual machine that no longer has a connection with Backup gateway, choose Backup vaults or Protected resources to locate your recovery point.
To restore a virtual machine to VMware, VMware Cloud on AWS, and VMware Cloud on AWS Outposts
-
In the Hypervisors or Virtual machines views, choose the VM name to restore. In the Protected resources view, choose the virtual machine Resource ID to restore.
-
Choose the radial button next to the Recovery point ID to restore.
-
Choose Restore.
-
Choose the Restore type.
-
Full restore restores all the virtual machine's disks.
-
Disk-level restore restores a user-defined selection of one or more disks. Use the drop-down menu to select which disks to restore.
-
-
Choose the Restore location. The options are VMware, VMware Cloud on AWS, and VMware Cloud on AWS Outposts.
-
If you are doing a full restore, skip to the next step. If you are performing a disk-level restore, there will be a drop-down menu under VM disks. Choose one or more bootable volumes to restore.
-
Select a Hypervisor from the dropdown menu to manage the restored virtual machine
-
For the restored virtual machine, use your organization’s virtual machine best practices to specify its:
-
Name
-
Path (such as
/datacenter/vm
) -
Compute resource name (such as VMHost or Cluster)
If a host is part of a cluster then you cannot restore to the host but only to the given cluster.
-
Datastore
-
-
For Restore role, select either the Default role (recommended) or Choose an IAM role using the dropdown menu.
-
Choose Restore backup.
-
Optional: Check when your restore job has the status
Completed
. In the left navigation menu, choose Jobs.
To restore a virtual machine to an Amazon EBS volume
-
In the Hypervisors or Virtual machines views, choose the VM name to restore. In the Protected resources view, choose the virtual machine Resource ID to restore.
-
Choose the radial button next to the Recovery point ID to restore.
-
Choose Restore.
-
Choose the Restore type.
-
Disk restore restores a user-defined selection of one disk. Use the drop-down menu to select which disk to restore.
-
-
Choose the Restore location as Amazon EBS.
-
Under the VM disk dropdown menu, choose bootable volume to restore.
-
Under EBS Volume type, choose the volume type.
-
Choose your Availability Zone.
-
Encryption (optional). Check the box if you choose to encrypt the EBS volume.
-
Select your KMS key from the menu.
-
For Restore role, select either the Default role (recommended) or Choose an IAM role.
-
Choose Restore backup.
-
Optional: Check when your restore job has the status
Completed
. In the left navigation menu, choose Jobs. -
Optional: Visit How do I create an LVM logical volume on an entire Amazon EBS volume?
to learn more on how to mount managed volumes and access data on the restored Amazon EBS volume.
To restore a virtual machine to an Amazon EC2 instance
-
In the Hypervisors or Virtual machines views, choose the VM name to restore. In the Protected resources view, choose the virtual machine Resource ID to restore.
-
Choose the radial button next to the Recovery point ID to restore.
-
Choose Restore.
-
Choose the Restore type.
-
Full restore restores the file system completely, including the root-level folder and files.
-
-
Choose the Restore location as Amazon EC2.
-
For Instance type, choose the combination of compute and memory required to run your application on your new instance.
Tip
Choose an instance type that matches or exceeds the specifications of the original virtual machine. For more information, see the Amazon EC2 Instance Types Guide.
-
For Virtual Private Cloud (VPC), choose a virtual private cloud (VPC), which defines the networking environment for the instance.
-
For Subnet, choose one of the subnets in the VPC. Your instance receives a private IP address from the subnet address range.
-
For security groups, choose a security group, which acts as a firewall for traffic to your instance.
-
For Restore role, select either the Default role (recommended) or Choose an IAM role.
-
Optional: To run a script on your instance at launch, expand Advanced settings and enter the script in User data.
-
Choose Restore backup.
-
Optional: Check when your restore job has the status
Completed
. In the left navigation menu, choose Jobs.
Use AWS CLI to restore virtual machine recovery points
Use StartRestoreJob
.
You can specify the following metadata for a virtual machine restore to Amazon EC2 and Amazon EBS:
RestoreTo InstanceType VpcId SubnetId SecurityGroupIds IamInstanceProfileName InstanceInitiatedShutdownBehavior HibernationOptions DisableApiTermination Placement CreditSpecification RamdiskId KernelId UserData EbsOptimized LicenseSpecifications KmsKeyId AvailabilityZone EbsVolumeType IsEncrypted ItemsToRestore RequireIMDSv2
You can specify the following metadata for a virtual machine restore to VMware, VMware Cloud on AWS, and VMware cloud on AWS Outpost:
RestoreTo HypervisorArn VMName VMPath ComputeResourceName VMDatastore DisksToRestore ItemsToRestore
This example shows how to conduct a full restore to VMware:
'{"RestoreTo":"VMware","HypervisorArn":"arn:aws:backup-gateway:us-east-1:209870788375:hypervisor/hype-9B1AB1F1","VMName":"name","VMPath":"/Labster/vm","ComputeResourceName":"Cluster","VMDatastore":"vsanDatastore","DisksToRestore":"[{\"DiskId\":\"2000\",\"Label\":\"Hard disk 1\"}]","vmId":"vm-101"}'