Post Date: August 26, 2020
Last Updated: November 16, 2026
Introduction
This guide explains resetting the Windows administrator password on an AWS EC2 instance when you have lost the password or the key pair. There are two ways. The fast way uses AWS Systems Manager and needs no volume changes. The manual way detaches the root volume and edits the agent configuration on a temporary instance. The original guide covered only the manual way, and only for EC2Config.
EC2Config is the old Windows agent for Windows Server 2012 R2 and earlier. Windows Server 2016 and later use EC2Launch, which has different files. This version adds the Systems Manager method, a backup step, the EC2Launch differences, a verification step and troubleshooting.
Warning: Before resetting the Windows administrator password, take a snapshot of the root volume. The manual method stops the instance, and the public IP address changes after the restart unless the instance has an Elastic IP. Never run these steps on an instance that holds unsaved data in instance store volumes, because stopping it erases that data.
Prerequisites
Before resetting the Windows administrator password, make sure you have:
- An AWS account with permission to stop, start, attach and detach EC2 volumes (and to run Systems Manager automation, for Method 1)
- The instance ID, the Region and the Availability Zone of the affected instance
- An EBS root volume, because instance-store root volumes can’t use these methods
- A recent snapshot or AMI of the instance
- The private key (
.pem) for the instance, or a plan to create a new key pair - A planned maintenance window, because the instance stops during the reset
Architecture
- The original instance is the Windows server whose administrator password you need to reset
- Its root EBS volume holds the Windows installation and the agent configuration
- A temporary instance in the same Availability Zone lets you open that volume as a secondary disk
- On Windows Server 2012 R2 and earlier, the
Ec2SetPasswordplugin inconfig.xmlcontrols whether the agent generates a new password at boot - On Windows Server 2016 and later, EC2Launch handles the same job through its own settings
- The key pair encrypts the new password, and you decrypt it in the EC2 console with the private key
The image below shows the manual workflow. For the official references, see the AWS guide on resetting the administrator password with EC2Config and the AWSSupport-ResetAccess runbook.

Steps for Resetting the Windows Administrator Password on EC2
Short answer: Resetting the Windows administrator password on EC2 is fastest with the Systems Manager runbook AWSSupport-ResetAccess. If that is not possible, stop the instance, detach its root volume, attach it to a temporary instance, set Ec2SetPassword to Enabled in config.xml, reattach the volume as /dev/sda1, start the instance and decrypt the new password in the console.
1. Check the Windows Version and the Agent
Before resetting the Windows administrator password, find out which agent the instance runs, because the manual steps differ.
- Open the Amazon EC2 console at
https://console.aws.amazon.com/ec2/. - Choose Instances and select the instance.
- Choose Actions, Monitor and troubleshoot, then Get system log.
- Look for an entry such as
EC2 Agent: Ec2Config service v3.18.1118. That means EC2Config, which applies to Windows Server 2012 R2 and earlier. AnEC2Launchentry means Windows Server 2016 or later.
If the system log is empty, use Get instance screenshot to see what the instance is doing, and try the Systems Manager method in Step 2.
2. Method 1: Reset with Systems Manager (No Volume Changes)
If the instance supports it, use the AWS runbook. It handles the stop, volume swap and restart for you.
- Open AWS Systems Manager, then Automation, then Execute automation.
- Search for
AWSSupport-ResetAccessand choose it. - Enter the instance ID, choose an Automation role with the permissions the runbook documents, and run it.
- When the run succeeds, use the new password as the runbook describes in its output.
If the instance is already managed by Systems Manager, Fleet Manager may also let you reset a local user’s password. Check the options for your instance.
Note: The runbook stops and restarts the instance, and it does not work with instance-store root volumes. If it fails or the instance is not eligible, use Method 2.
3. Method 2: Stop the Instance, Back It Up and Detach the Root Volume
The manual method of resetting the Windows administrator password needs the root volume to be attached as a secondary disk, so detach it first.
- In the EC2 console, select the instance and choose Instance state, then Stop instance. Wait for the state
stopped. - Note the ID of the root volume under Storage (the Root device name is usually
/dev/sda1). - Create a snapshot of that volume (Volumes, Actions, Create snapshot).
- If you no longer have the private key, create a new key pair now. Delete the old key pair first if you want to reuse its name. Then choose Actions, Image and templates, Create image, and launch a replacement instance from that AMI with the new key pair. Use the same instance type, VPC, subnet, security group and IAM role. Move any Elastic IP and extra volumes to the new instance, then terminate the old one. Treat the new instance as the original in the next steps.
- In Volumes, select the root volume and choose Actions, Detach volume. Wait for the state
available.
4. Attach the Volume to a Temporary Instance and Enable Password Generation
- Launch a temporary Windows instance in the same Availability Zone as the original. A different Availability Zone makes the attachment fail.
- Use a different Windows version from the original, for example Windows Server 2016 or later when the original runs 2012 R2. This avoids disk signature collisions.
- Create a new key pair for the temporary instance and save the
.pemfile. - In Volumes, select the detached volume, choose Actions, Attach volume, pick the temporary instance, and set the device to
xvdf. - Connect to the temporary instance with Remote Desktop.
- Open Disk Management, right-click the new disk, and choose Online. If the disk shows as uninitialized, do not format it, because the volume already holds your data.
You can also bring the disk online with DiskPart. Run diskpart as administrator and use the disk number shown by list disk:
select disk 1 attributes disk clear readonly online disk
Warning: Don’t run
convert mbr,create partitionorformaton this disk. The original guide’s script formats the volume, which erases a volume that already holds Windows.
Open the secondary volume in File Explorer and edit this file in Notepad, replacing D: with the drive letter assigned to the volume:
D:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml
Find the Ec2SetPassword plugin near the top and change its state from Disabled to Enabled:
<Plugin>
<Name>Ec2SetPassword</Name>
<State>Enabled</State>
</Plugin>
Save the file. For Windows Server 2016 and later with EC2Launch, the file and the setting are different. Follow the AWS guide for EC2Launch or EC2Launch v2, because the path and options depend on the agent version.
Finally, set the disk Offline in Disk Management, disconnect, and in the EC2 console choose Volumes, Actions, Detach volume. Wait for the state available.
5. Reattach the Volume, Start the Instance and Get the New Password
- In Volumes, select the volume and choose Actions, Attach volume.
- Select the original instance and set the device to
/dev/sda1. The device name must be exactly this, or the instance won’t boot. - Start the original instance and wait for the state
running. - Select the instance, choose Connect, then the RDP client tab, and choose Get password.
- Upload the private key file for the instance and choose Decrypt password.
- Copy the password, download the
.rdpfile, and connect with the user nameAdministrator. If pasting fails, type the password manually.
Note: The public IP address changes after a stop and start. Connect with the new public DNS name, or associate an Elastic IP.
6. Verify and Clean Up
After you connect, set a new administrator password you control, and confirm the server’s services and applications work. Then clean up:
- Terminate the temporary instance.
- Delete the temporary key pair if you no longer need it.
- Keep the snapshot for a few days, then delete it so you stop paying for it.
- Store the new key pair and password in a password manager.
Troubleshooting
If resetting the Windows administrator password fails, check these:
- “Password not available yet. Please wait at least 4 minutes after launching an instance before trying to retrieve the auto-generated password.”: The agent needs a few minutes after boot. Wait, then try again
- “Password Failed” at the Remote Desktop login: Type the password manually instead of pasting it. Make sure you use the
Administratoraccount and the newest decrypted password - “The disk is offline because it has a signature collision with another disk that is online.”: The temporary instance runs the same Windows version as the original. Launch the temporary instance with a different Windows version
- “The volume is in a different Availability Zone” or the volume cannot be attached: Create the temporary instance in the same Availability Zone as the volume
- The instance does not start after reattaching the volume: The device name was wrong. Detach the volume and attach it again as
/dev/sda1 - Resetting the Windows administrator password does not work on instance-store roots: These instances can’t use this method. Restore from a backup or AMI instead
- The decrypt option rejects the key file: You are using the wrong private key. Use the key pair that the instance was launched with, or create a replacement instance with a new key pair
- The
Get passwordoption is missing: The instance was launched from an AMI that doesn’t generate passwords, or the agent is not running. Check the system log from Step 1
Conclusion
Resetting the Windows administrator password on EC2 is quickest with the AWSSupport-ResetAccess runbook. The manual method also works: stop the instance, detach the root volume, enable Ec2SetPassword on a temporary instance, reattach the volume as /dev/sda1, start the instance and decrypt the new password with your key pair. Take a snapshot first, and remember that EC2Config applies only to older Windows versions.
Frequently Asked Questions
Can I avoid detaching volumes when resetting the Windows administrator password?
Yes, if the instance is eligible. Use the AWSSupport-ResetAccess runbook or Fleet Manager in AWS Systems Manager. The manual volume method is the fallback.
Does this work for Windows Server 2016 and later?
The workflow is the same, but the agent is EC2Launch, which uses different files and settings from EC2Config. Follow the AWS guide for EC2Launch or EC2Launch v2 for the exact steps.
What if I lost the key pair as well?
Create a new key pair, make an AMI of the instance, and launch a replacement instance from it with the new key pair. Then reset the password on the replacement.
Will I lose data or the public IP address?
Your data on EBS volumes stays, but a stop and start changes the public IP unless the instance has an Elastic IP. Data on instance-store volumes is lost when the instance stops.
Related Articles
AWS EC2 Troubleshooting Guide: Common Issues and Solutions
How to Troubleshoot SSH Connection Issues in AWS EC2
Talk to Our Technology Experts
Want to keep your cloud servers protected and avoid being locked out of them? Our team can set up secure access, key management, and credential policies for your AWS instances through our Security Services.
Connect with our technology experts.
