Problem: If you forgot the Windows EC2 machine Administrator password other than the default auto generated password provided by AWS after using the key pair while launching the EC2 machine, and still you can’t access the EC2 windows machine with default auto generated password then follow the below steps.
When we launch a new Windows EC2 instance, AWS recommends that we should change the password from default to a new one, as shown in the screenshot below.
But now the question arises if we forgot the new password after changing it, then how we can recover it. Simply it cannot be recovered by using Retrieve Default Windows Administrator Password as it was shown in the above screenshot. The password it provides is the same default one that we can’t use to login.
So now we have to follow the below mentioned steps to regain access to the windows server.
Step.1 Navigate to System Manager and open the Roles option.
Step.2 Creating a new role for the instance with full access to System Manager.
Step.3 Attach the AmazonSSMFullAccess policies for the role we are creating.
Step.4 Provide the name of the role of your choice and create the role.
Step.5 Select the newly created role (SSMRoleEc2)
Step.6 Navigate to System Manager and open it.
Step.7 Then click Run Command Option.
Step.8 Click again on the Run Command button now.
Step.9 Now search for this tool in the search bar AWSSupport-RunEC2RescueForWindowsTool and select the option.
Step.10 Select the parameter ResetAccess.
Step.11 Now, Select the option Choose instances manually.
Step.12 After completing the above steps it will show the status of the command executed.
Step.13 When It will show the success message as shown below
Step 14 After that you have to go to the Parameter option and click it.
Step.15 Now click the Instance name to get the new password.
Step.16 Now finally click show and that will be your new default password.
Now you can access your Windows server using a remote desktop utility.