Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon EC2 keypair recovery

Tags:

amazon-ec2

I need to know of any way to access a running instance in Amazon EC2.

  • I DON'T have the original keypair ".pem" file
  • I DO have access to the aws management console
  • Terminating/rebooting is not feasible

the closest to my question I have found was this but I hope things have changed since.

is there any way to download that pem file or assign a new keypair?

like image 580
Joaquin Brenner Avatar asked Oct 06 '10 17:10

Joaquin Brenner


People also ask

Can I download a Keypair from AWS?

You can view, copy, and download the public key from an asymmetric KMS key pair by using the AWS Management Console or the AWS KMS API. You must have kms:GetPublicKey permission on the asymmetric KMS key.

Can terminated EC2 instances be recovered?

It's not possible to recover either the original Amazon EC2 instance or any volumes that were deleted as part of the termination process.


1 Answers

The keypairs can only be downloaded once from Amazon, presumably for security reasons. What you could do, is assign one of your Elastic IP's to the instance and route traffic through that normally. Snapshot the instance and bring up a duplicate with a new Keypair. Switch the Elastic IP over to the new instance. This is not particularly elegant, but is much less downtime than a full shutdown.

Note: If you assign the Elastic IP to the instance, it will override the current public IP, so you will have to make sure to update DNS as well.

like image 165
agross Avatar answered Sep 17 '22 08:09

agross