AWS Certified Solutions Architect - Associate (SAA-C02)

Sign Up Free or Log In to participate!

Asked for passphrase when accessing DB server from web server.

Accessing the DB server from the web server when using instance connect runs into an issue. I am asked for a passphrase for the key "Enter passphrase for key ‘mycustomerkp.pem’: " This was an issue in the other version of this course as well and ACG did not address it there either.

How are we supposed to do this using instance connect?


the same thing!

Agustin Tettamanti

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

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

Sudarshan Salunkhe

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.

Lior Derei

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@/home/ec2-user (change the WebServer01-public-ip and key name of course))

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@ -i mycustom.pem

Enter passphrase for key ‘mycustom.pem’:

I tried what you guys suggested but still getting the same

Michal Nyga

Did you tried to copy the key via vim instead of nano?

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?