How can I restore a corrupt registry on my EC2 Windows instance?

Last updated: 2019-05-16

There is a corrupt registry on my Amazon Elastic Compute Cloud (Amazon EC2) Windows instance. How can I restore my registry Hive? 

Short Description

A corrupt Windows registry can cause an EC2 Windows instance to freeze, slow down, restart randomly, or become unusable.

Even without performing other backup utilities or configurations beforehand, Windows regularly and automatically makes its own backup of the registry in the following location:

C:\Windows\System32\config\RegBack

EC2Rescue can restore these previously created backups from the RegBack directory to the current registry of the EC2 instance.

Resolution

To use EC2Rescue to restore to the latest registry backup, follow these steps:

  1. Warning: If this instance has an instance store volume, you'll lose any data on it when the instance is stopped. Be sure to back up the contents of the volume before stopping it.
    Stop the inaccessible instance.
    Note: If you aren't using an Elastic IP Address, the public IP address will be released when you stop the instance.
  2. Create an EBS-backed Amazon Machine Image (AMI). From the Amazon EC2 console, select your instance. For Actions, choose Image, Create Image.
  3. Launch a new instance (Windows Server 2012 or later) in the same AWS Region and Availability Zone as the inaccessible instance. You will use this new instance as the recovery instance.
    Note: You can terminate the recovery instance after the corrupted registry is restored.
  4. Detach the boot volume of the corrupt instance.
  5. Attach the volume to the recovery instance as a secondary volume using the default settings in the Amazon EC2 console.
  6. Connect to the recovery instance using Remote Desktop Protocol (RDP).
  7. Download the EC2Rescue for Windows Server tool, and then extract the files.
  8. Run EC2Rescue on the working instance, and then choose Offline instance.
  9. Select the disk of the newly mounted volume, and then choose Next.
  10. Confirm the disk selection, and then choose Yes.
  11. For Choose offline instance option, choose Restore.
  12. Choose Restore registry from backup.
  13. EC2Rescue displays the date of the current and backup registries. Choose Restore, and then choose OK.
  14. Choose Next, and then choose Finish.
  15. Choose OK to exit.
  16. Detach the secondary volume from the recovery instance.
  17. Attach the volume to the corrupt instance.
    For Device, enter /dev/sda1.
  18. Start the corrupt instance, and then wait for the instance to boot and pass status checks. You can monitor the progress using the Get Instance Screenshot feature.
  19. Confirm that you can connect to the instance using RDP. You can then safely terminate the recovery instance to avoid unexpected charges.