Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I lost the pem file and deleted the key-pair under which an instance in currently running. I want to still use that server though. I created a new key pair but I don't know how to assign it to that instance.

share|improve this question

3 Answers 3

You can go to your instance and say " launch instance like this". This time it will create clone of your EC2 instance. You can specify new key for this instance. Make sure you select the same security group.

This way, you will not loose your data and you will gain access to your ec2 instance with new key.

Note: If your old instance had EIP then you need to re-assign that EIP to new instance.

If your instance does not have EIP then you need to make sure you update your other instances with new private IP address or URL so that connectivity will not be broken.

If there are any EBS volumes attached to your previous instance then you need to attach to new instance.

Termination of old EC2 can be done as last step!!!.

share|improve this answer

Unless you have another way to log into the instance, you're not going to be able to access it. Amazon does not have your private key and cannot log in to your instance.

If you still need your data, disconnect the EBS-volume and attach it to a new EC2-instance.

share|improve this answer
There's no way at all to assign a new key pair then? –  Jorge Guzman May 25 '11 at 15:55
Nope, AWS can't acces the instance after creation. –  Bart De Vos May 25 '11 at 17:23

There is no option to detach/attach a new security key (pem) from/to your instance till now in AWS. Once you lost your pem key you can't login again. So the only way to regain the access is creating an AMI of the instance and launch it with a new key.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.