Amazon Web Services

How to Access EC2 Instance even if PEM File is Lost

# mount /dev/xvdf1 /mnt
# cp /root/.ssh/authorized_keys /mnt/root/.ssh/
# umount /mnt
  1. Detach the secondary volume from helper instance. 
  2. Again attach the volume back to our recovery instance. Start the instance. Terminate the helper instance.

Use helper instance pem file to log into recovery instance.

Share this Blog post