How can I restore a corrupt registry on my EC2 Windows instance?
Last updated: 2022-09-21
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:
EC2Rescue can restore these previously created backups from the RegBack directory to the current registry of the EC2 instance.
To use EC2Rescue to restore to the latest registry backup, follow these steps:
- 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.
- Create an EBS-backed Amazon Machine Image (AMI). From the Amazon EC2 console, select your instance. For Actions, choose Image, Create Image.
- 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.
- Detach the boot volume of the corrupt instance.
- Attach the volume to the recovery instance as a secondary volume using the default settings in the Amazon EC2 console.
- Connect to the recovery instance using Remote Desktop Protocol (RDP).
- Download the EC2Rescue for Windows Server tool, and then extract the files.
- Run EC2Rescue on the working instance, and then choose Offline instance.
- Select the disk of the newly mounted volume, and then choose Next.
- Confirm the disk selection, and then choose Yes.
- For Choose offline instance option, choose Restore.
- Choose Restore registry from backup.
- EC2Rescue displays the date of the current and backup registries. Choose Restore, and then choose OK.
- Choose Next, and then choose Finish.
- Choose OK to exit.
- Detach the secondary volume from the recovery instance.
- Attach the volume to the corrupt instance.
For Device, enter /dev/sda1.
- 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.
- Confirm that you can connect to the instance using RDP. You can then safely terminate the recovery instance to avoid unexpected charges.