-1

I'm trying to scp a project onto my EC2 instance. I have my .pem keys but the scp seems not to be able to find my keys, despite giving it the full address. Any insights?

[ec2-user@ip-172-31-19-174 ~]$ scp -i /Users/.../my_keys.pem -r /Users/.../project ec2-user@....us-west-1.compute.amazonaws.com:~/

Warning: Identity file /Users/.../my_keys.pem not accessible: No such file or directory.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
lost connection

Btw, I can ssh into the instance with

ssh -i /Users/.../my_keys.pem ec2-user@ec2-user@....us-west-1.compute.amazonaws.com

(albeit with the following warning)

The authenticity of host '[host_name]' can't be established.
ECDSA key fingerprint is [fingerprint_name].
Are you sure you want to continue connecting (yes/no)?
0

Are you trying to scp content from your local pc into an AWS instance? If you are it looks like you are running your scp from your ec2 instance and not your local:

[ec2-user@ip-172-31-19-174 ~]$ scp -i /Users/.../my_keys.pem -r /Users/.../project ec2-user@....us-west-1.compute.amazonaws.com:~/

Note the start of your line: [ec2-user@ip-172-31-19-174 ~]

You should be doing the scp from your local machine, if that's what you're trying to achieve.

In short, you're already ssh'd onto the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.