3

Unable to access AWS machine since no key-pair is available. Would it be possible to create a snapshot of the volume attached with this instance and atleast get access what is there in the machine?

klee
  • 1,554
  • 2
  • 19
  • 31

1 Answers1

2

Connecting to your Linux instance if you lose your private key - Amazon Elastic Compute Cloud is the AWS documentation on what to do to connect to a Linux instance when the private key is lost. Nothing beats the AWS documentation, so I am leaving the details to the AWS documentation.

It shows the steps as:

  • Step 1: Create a new key pair
  • Step 2: Get information about the original instance and its root volume
  • Step 3: Stop the original instance
  • Step 4: Launch a temporary instance
  • Step 5: Detach the root volume from the original instance and attach it to the temporary instance
  • Step 6: Add the new public key to authorized_keys on the original volume mounted to the temporary instance
  • Step 7: Unmount and detach the original volume from the temporary instance, and reattach it to the original instance
  • Step 8: Connect to the original instance using the new key pair
  • Step 9: Clean up
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Praveen Sripati
  • 32,799
  • 16
  • 80
  • 117
  • I added some information to avoid a link-only answer. I think another method is to create an AMI of the instance and launch a new instance from that AMI, which then provides the opportunity to specify a new Keypair that will be installed. However, it is often better to fix the 'original' instance since that way it retains network settings, etc. – John Rotenstein Oct 29 '20 at 07:45