Amazon EC2 Lost Key Pair Fix

Okay, so say you lose your Amazon cloud server’s key pair. uh oh, yes, you are in trouble, but not to worry to much, there is a solution. The solution is pretty complex if you try to learn it from Amazon docs, so here is an easy explanation that worked for me.


  • know the instance name
  • write down the availability zone:
    Zone: us-east-1b
  • Write down the instance id

High level steps:

Follow these high level steps if you know your way around Amazon’s management console fairly well, otherwise, read on for more specific instructions for replacing an Amazon EC2 instance’s key pair and regain access to your server.

  1. Shut down instance.
  2. Make a new AMI from the instance.
  3. Launch new instance using the AMI you created.
  4. Create and download a new key pair.
  5. Start the new instance and check that the key pair works then delete the old instance if you wish.


  1. Go to and login to your account. Select EC2/instances and place a check-mark beside the running instance you need a new key pair for and then select “stop” from the actions drop down. Finally click yes to stop the instance.
  2. With the same instance still checked, select “Create Image” from the “Actions” drop down. Give the image a name and a description and leave rest of defaults for most cases, then click “yes create”. Take note of the id that looks similar to ami-5d623734 in the next window.
  3. Click on “AMIs” in the left nav and click “Launch” to launch a new Instance with the AMI”. Click to continue. Make selections similar to your previous instance you are replacing the key pair for. Be sure to select the same availability zone.
  4. When you get to the third step of creating a new instance, where it says create a key pair, be sure you select “Create a new key pair” and create and download the file. Also be sure to select the same security group you had on the original server. When you are done creating the new instance, write down the instance id like: i-f9ead583 or i-11438868
  5. Wait for the instance to be created, it can take a few minutes. Go back to your Instances page and place a check beside the newly created Instance. Then you will see it’s information pop up at the bottom of the page. copy the URL that looks like You can get the IP from that URL by taking the numbers after the ec2- so in my case, the ip was as you can see those numbers in the above URL.

Now that you have your new server, if you need help connecting to it, follow my next tutorial on how to connect to an Amazon ec2 instance and convert a .pem to a .ppk file here:

then after that, follow the link at the bottom of that tutorial to learn now to gain FTP access to your Amazon ec2 web server.


One Reply to “Amazon EC2 Lost Key Pair Fix”

  1. Thank you for this posting, helped me fix my problem. I was about to start up the AWS support, that would have been a $40 charge, this helped me avoid that.

Leave a Reply

Your email address will not be published. Required fields are marked *