I really messed up this time: I accidentally changed my xxxxx.pem permissions in ~/.ssh/authorized_keys so now I can't login in the SSH anymore ("Permission denied (publickey)"). Obviously I can't either access as root because it is forbidden by default, how can I do to not lost my instance? Changing the permission of the .pem file on my computer won't be useful because the other key to access can't be found (with the right permissions) in ~/.ssh/authorized_keys.
I can't really login in any way, don't know what to do.
Also create an AMI's image to correct the mistake is useless because when I create the AMI from the bad-instance, it replicate the wrong permission of the folder, so I can't login in the new one as well.
Any idea? Thanks
I messed up an instance once and I was able to recover it by mounting its EBS volume from a separate working instance. Follow these steps:
Once mounted as a directory, you should be able to access the filesystem of the problematic volume from the new instance and fix the permission issue. Then simply unmount and detach the volume and reattach it to the other instance.