How to Reset Password to an Amazon EC2 Windows Instance by using Automation Document
At times, system professionals may need to reset their AWS EC2 instance passwords. Whilst we walk you through the steps to reset using Automation Document, we have also covered an article on resetting EC2 instance password using System Manager which can be read here.
Once you execute automation document AWSSupport-ResetAccess, it will do the following steps to reset your Windows password:
- Creates and configures VPC
- Creates subnet
- Launches Windows Server helper instance
- Stops the target instance, and creates a backup
- Attaches the target’s root volume to the helper instance
- Uses Run Command to run EC2Rescue on the helper instance
- Reattaches the root volume and restarts the target instance
- Clean up temporary resources, except for the backup AMI
This procedure consists of two steps. The first one is to collect instance ID and the second one is to execute an automation document.
Step 1: Collect instance ID
In the first step, we will collect the instance ID from the Amazon EC2 instance which can not be accessible due to the issue with a forgotten password.
- Login into AWS Management Tools
- Click on Services and then click on EC2
- Click on Running instances
- Select the instance and then click on the Description tab
- Copy the instance ID to the clipboard. In our case, it is i-07df312d5e15670a5. We will need to type this instance ID to the automation document in step 2.
Step 2: Execute automation document AWSSupport-ResetAccess
In the second step, we will create an automation document that will trigger the AWSSupport-ResetAccess command to reset the Windows password.
- Click on Services and search for AWS System Manager. Once it is found, please open it.
- On the left side of the window, click on Automation under Action & Change
- Click on Execute automation
- Type AWSSupport-ResetAccess under Automation document
- Click on the automation document AWSSupport-ResetAccess and then click on Next
- Select Simple execution
- Type the instance id under Input Parameters > InstanceId as shown in the screenshot below
- Click on Execute. The progress will be shown under Execution status.
- Click on Automation under Action & Change to see access the execution ID
- Once the execution is successfully finished, it will be visible under Status. As you can see, execution ID f079e28c-ffb3-4de2-83e4-fb2c5974f431 is successfully executed.
- Click on Execution ID to access your password
- Expand Outputs to see more information about the new password.