How to recover Windows password from launched Windows EC2?

Viewed 3179

I have a Windows EC2 launched from an AMI for which I no longer have the password. I tried running:

aws ec2 get-password-data --instance-id i-instanceId

and also:

aws ec2 get-password-data --instance-id i-instanceId --priv-launch-key C:\key.pem

But the output is this:

{
    "InstanceId": "i-instanceId",
    "Timestamp": "2017-11-03T18:05:35.000Z",
    "PasswordData": ""
}

Trying to get the password by doing this well after 1h of launching the instance:

enter image description here

Returns this:

enter image description here

Is there any way of recovering the password?

3 Answers

Recovering a Windows password is not too difficult.

Summary of the steps involved:

  1. Spin up a new Windows instance with the same OS version.
  2. Detach the disk drive from the Windows instance that you forgot the password.
  3. Attach the disk drive to the new Windows instance.
  4. Modify config.xml to reset the password.
  5. Reverse the above steps.

Here is a document that details everything step by step.

Source: Resetting the Windows Administrator Password Using EC2Config.

AWS guidance for this situation:

To reset an Administrator password for an EC2 instance, modify a configuration file on the instance boot volume. However, you can't modify this file if the volume is attached to the instance as a root volume. You must detach the volume and attach it to a temporary instance. After you modify the configuration file on the temporary instance, you reattach it to your original instance as the root volume.

AWS has provided a step-by-step instructions for this situation in their official documentation that is too long for this answer, and differs somewhat depending on your server version because of changes to their EC2Config/EC2Launch configuration utilities over time:

Related