Innovate anywhere, anytime withruncode.io Your cloud-based dev studio.
Amazon Web Services

How to Access EC2 Instance even if PEM File is Lost

2022-07-19
aws-mp-banner
# 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.