How can I replace corrupt or missing network drivers on my EC2 Windows instance?

Last updated: 2019-04-26

I can't connect to my Amazon Elastic Compute Cloud (Amazon EC2) instance because of corrupt or missing network drivers. An upgrade to my paravirtual (PV) drivers failed, or I uninstalled my PV drivers, and now I can’t connect to my instance. How can I fix this?  

Short Description

You can replace PV drivers automatically using AWS Systems Manager. Follow the steps below for Replace corrupt or missing PV drivers using automation.
Note: This process requires a greater number of user permissions, and creates temporary resources in the account.

If you don't have user permissions to run the automation, or if automation doesn't resolve the issue, then reinstall the drivers using the Enhanced Networking method.

If neither of the above options works, attach the boot volume of the inaccessible instance to a recovery instance. Then, set up automatic login with an administrator account, and silently run the PV driver installation at next boot. Follow the steps below for Reinstall PV drivers manually.

Resolution

Replace corrupt or missing PV drivers using automation

You can automatically replace the currently installed PV drivers with the latest versions using AWS Systems Manager. For instructions, see Upgrading the AWS PV, ENA, and NVMe Drivers Using AWS Systems Manager, and then make the following selections for Input Parameters:
For AllowOffline, choose True.
For ForceUpgrade, choose True.

Note: The automation document creates temporary resources in the account. If you choose to create a new VPC, the automation document creates persistent resources.

Reinstall PV drivers manually

If the issue isn't resolved after trying automation and the Enhanced Networking method, follow these steps:

1.    Stop the inaccessible instance.

2.    Create an Amazon EBS-backed Amazon Machine Image (AMI) .

3.    Important: You must repair the disk signature collision if your recovery instance is based on the same AMI as the original instance. To avoid disk signature collision, select a different Windows AMI for the recovery instance.

Launch a Windows Server 2008 R2 instance in the same AWS Region and Availability Zone as the inaccessible instance. You'll use this new instance as the recovery instance. You can terminate the recovery instance after you complete all the following steps and your original instance is healthy again.

4.    Detach the boot volume of the inaccessible instance.

5.    Attach the volume to the recovery instance using the default device mapping suggested by the Amazon EC2 console.

6.    Connect to the recovery instance using Remote Desktop Protocol (RDP).

7.    On the recovery instance, download and extract the latest version of the AWS PV Drivers.

8.    Copy AWSPVDriverSetup.msi to the root of the newly attached volume. Usually, this is the D: drive. If it isn't, be sure to substitute the correct drive letter for the D: in the first command in the next step.

9.    Open a command prompt and run the following commands, replacing these three text segments with your own values:
Administrator_Account_Name
Administrator_Password
Domain_or_Computer_Name

Tip: If you are using a local Administrator account and you don't remember the computer name, you can use .\ instead of the computer name. This automatically points to the Windows OS hostname when incorporating the local credentials to run the AWS PV Drivers msi installer.
Note: To perform these commands, you must have administrator permissions, and you must use either a local account or a domain account with cached credentials.

reg load HKLM\AWSTempSoftware D:\Windows\System32\config\SOFTWARE
reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /v 1 /d "reg delete \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" /v AutoAdminLogon /f"
reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /v 2 /d "reg delete \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" /v DefaultDomainName /f
reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /v 3 /d "reg delete \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" /v DefaultPassword /f
reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /v 4 /d "reg delete \"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\" /v DefaultUserName /f
reg add HKLM\AWSTempSoftware\Microsoft\Windows\CurrentVersion\RunOnce /t REG_SZ /v 5 /d "msiexec /i C:\AWSPVDriverSetup.msi /passive /forcerestart"
reg add "HKLM\AWSTempSoftware\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultUserName /t REG_SZ /d "Administrator_Account_Name"
reg add "HKLM\AWSTempSoftware\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultPassword /t REG_SZ /d "Administrator_Password"
reg add "HKLM\AWSTempSoftware\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DefaultDomainName /t REG_SZ /d "Domain_Or_Computer_Name"
reg add "HKLM\AWSTempSoftware\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoAdminLogon /t REG_SZ /d 1
reg unload HKLM\AWSTempSoftware

10.    Detach the secondary volume from the recovery instance.

11.    Attach the volume to the inaccessible instance by using the device mapping /dev/sda1.

12.    Start the inaccessible instance.

13.    Wait for the instance to boot, perform the automatic login and installation, reboot, and then wait several minutes for the instance to pass status checks. You can monitor the process more closely by using instance console screenshots. Confirm that Windows booted successfully on your instance. Check the instance’s console output for the message Windows is ready to use.

14.    Verify that your selected PV driver is installed correctly. Check the instance’s console output for the line that begins with Driver: AWS PV Storage Host Adapter. Confirm that the version shown matches the version you installed.