When you lose your Amazon Web Services EC2 key pair
Posted:
Ummm... So, a friend of mine, hypothetically speaking that is, might have, maybe, lost his or her Amazon Web Services Ec2 key pair. Okay, in reality I lost my key pair.
Like all of the other key pairs / passwords I use I figured that the next time I needed to access my instance I would visit the AWS Management Console and download a new key pair. No!
How to regenerate an AWS EC2 key pair for an EBS backed instance
- Shut down your instance
- Select Instance Actions for the instance and generate an AMI from the instance
- Launch a new instance and select the AMI you just created
- Select and download the new key pair
- Start your new instance and confirm that the new key pair works (on my Ubuntu instance the key is set to work with user ubuntu)
- Terminate your original instance
It didn't take to long and now my new instance is up and running with all of the old data. I now have backed up my private key somewhere that I hopefully will not lose it again.