- Newest
- Most votes
- Most comments
Good day Jamielaird
According to my understanding you are trying to replace a .pem key file that is associated with an existing EC2 instance running Windows for security reasons.
Based on my investigation and replication to your question, these are the steps I followed:
Note: To give the new key pair the same name as the old key pair, you must first delete the old key pair
1.Create a new key pair, and then save the private key file in a safe place. You can create a key pair using the console, the AWS CLI, or AWS Tools for Windows PowerShell.
2. From the Amazon EC2 console, choose Instances from the navigation pane.
3. Select your instance
4. Stop your instance
5. Select your instance. For Actions, choose Image, Create Image. For Image name, enter a name.
6. Create Image, and then choose Close.
7. Launch an AMI - Launch an instance.
8. Complete the wizard. Be sure to select the same Instance type, VPC ID, Subnet ID, Security groups, and IAM role as the instance that you are replacing For Select a key pair, choose the new key pair.
9. Now that the private key file is replaced, you can reset the administrator password.
To reset your administrator password:
Use EC2Config for Windows Server 2012 R2 and earlier. https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Launch.html
Use EC2Launch for Windows Server 2016 and later https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Config.html
References
[1] https://aws.amazon.com/premiumsupport/knowledge-center/ec2-windows-replace-lost-key-pair/
Relevant content
- asked 6 months ago
- asked a year ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 4 months ago