Replace the pem file for an EC2 instance running Windows


I'm looking for some guidance on replacing the pem file associated with an EC2 instance running Windows.

The AWS documentation on key pairs for Windows doesn't seem to mention this, and the general advice seems more geared towards Linux.

I have the old pem file and just want to replace it for security reasons. Any help would be appreciated!

Resources I've read through so far are below:

asked 3 years ago2537 views
1 Answer

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.

Use EC2Launch for Windows Server 2016 and later


answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions