6 Answers
I get it done only using SSH in VSCode, then not creating key on EC2 with Nano( copy-paste) but straightly copping (scp) key to the Webserver, chmoding it and then it worked fine for me to connect to DB-EC2
Although what you mentioned makes sense. Can you provide some more details on how to copy the key to the web server? Thanks!
sometime the copy through doesn;t work. I would rather you ssh from your laptop from web server to Db server, but this way coping the key over works.
I can confirm that scp does solve this issue, you can execute the following command from your own pc: scp -i mykeypair.pem mykeypair.pem ec2-user@
pasting the key with nano didn’t work very well for my and i had the same problem.
paste it with vim, and before pressing I for insert, first write the following: :set paste, and then press enter and insert the key. it worked when i did that.
Solved it by creating the key file with vim editor.
First I opened the original key file with VS Code, copied the content and paste into Vim editor.
Copying from notepad and pasting into Nano did not worked as expected.
I had this same issue.
For me, when i pasted the contents of the downloaded .pem file from notepad to the vim file in the console, it cut off a couple of the dashes at the beginning and i didnt think anything of it. It kept asking me for a passphrase when i tried to ssh, until i went back in and added those missing dashes back to the copied .pem file.
After that i was able to ssh fine without it asking for a passphrase.
~
~
"mycustom.pem" [New] 26L, 1703C written
[root@ip-10-0-1-24 ec2-user]# chmod 400 mycustom.pem
[root@ip-10-0-1-24 ec2-user]# ssh ec2-user@10.0.2.231 -i mycustom.pem
Enter passphrase for key ‘mycustom.pem’:
I tried what you guys suggested but still getting the same
Did you tried to copy the key via vim instead of nano?
the same thing!
The explanation regarding security group inbound rules for connecting both servers is super confusing! He initially says "we need to add SSH" and then he says not to do it! ICMP? What is that? Never talked about it