I'm trying to SCP a file from my Amazon EC2 instance into my Linux machine. I've done quite a bit of reading and nothing seems to work.
I can SSH from my Linux machine into my instance (that's how I connect to it), and can even SCP into it by doingscp -i my-key-pair.pem SampleFile.txt [email protected]:~
. According to Amazon's instructions at this link, in order to SCP from the instance to my machine I need only to "simply reverse the order of the host parameters." In other words, this:
scp -i my-key-pair.pem
[email protected]:~/SampleFile.txt
~/SampleFile2.txt
I've googled around, and have even read some similar questions on here including this one, but I've had no luck. I'm not sure what the problem is. The other day I managed to SCP across instances (i.e., from one EC2 instance to another) without a problem -- which at least supposedly requires a bit more tinkering.
Another bit that is troubling me as well, is the fact that the command to SCP from the instance to the local machine includes the private key (my-key-pair.pem on the code block above), and I've looked for a .pem file on the instance and have not found one. Am I missing something? Thanks in advance.
By the way, I'm seeing the generic "Permission denied (public key)" error.
chmod 600 my-key-pair.pem
. By username/password login, I am referring to the fact that you can use username and password for logging in instead of the .pem file. Regarding IPs - If you are ssh-ing FROM ec2 to your local machine how would you expect your machine to be uniquely identified? – TJ-