Using scp to copy a file to Amazon EC2 instance?

I am trying to use my Mac Terminal to scp a file from Downloads (phpMyAdmin I downloaded online) to my Amazon EC2 instance.

The command I used was:

scp -i myAmazonKey.pem phpMyAdmin-3.4.5-all-languages.tar.gz  hk22@mec2-50-17-16-67.compute-1.amazonaws.com:~/.

The error I got:
Warning: Identity file myAmazonKey.pem not accessible: No such file or directory.
Permission denied (publickey).
lost connection

Both my myAmazonkey.pem and phpMyAdmin-3.4.5-all-languages.tar.gz are in Downloads, so then I tried

scp -i /Users/Hello_Kitty22/Downloads/myAmazonKey.pem /Users/Hello_Kitty22/Downloads/phpMyAdmin-3.4.5-all-languages.tar.gz  hk22@mec2-50-17-16-67.compute-1.amazonaws.com:~/.

and the error I got:
Warning: Identity file /User/Hello_Kitty22/Downloads/myAmazonkey.pem not accessible: No such file or directory.
Permission denied (publickey).
lost connection

Can anyone please tell me how to fix my problem?

p.s. there is a similar post: scp (secure copy) to ec2 instance without password
but it doesn’t answer my question.

17 Answers
17

Leave a Comment