Reputation: 103
I reformatted my macbook and completely forgot to copy my ~/.ssh
directory.
I tried ssh'ing into my EC2 instance
$ ssh [email protected] -i xxx.pem -v
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to xx.xxx.xxx.xx [xx.xxx.xxx.xx] port 22.
debug1: connect to address xx.xxx.xxx.xx port 22: Operation timed out
ssh: connect to host xx.xxx.xxx.xx port 22: Operation timed out
But I presume it's not working because my PEM file is linked to the id_rsa file on my old laptop?
I had the PEM file in my google drive.
I've tried
sudo chmod 400 xxx.pem
Any ideas how I can regain access to my EC2 insance?
I would generate a new key pair as explain here, but it requires me to have access to the instance
Upvotes: 0
Views: 362
Reputation: 20176
Update: check @jordanm comment. You have no connection to the instance, maybe there is no need to create a new one.
As far as I know there is only way to create a new one. You can keep data if you make an image of your existing instance. You may have changed external IP if your instance has no elastic IP attached.
Actions -> Image and templates -> Create image
. Fill the form to create an image.Upvotes: 1