I am trying to copy local files to my ec2 instance.
When I run this command:
scp -i keypair.pem process.py ubuntu@ip-xx-xxx-xx-xxx.compute-1.amazonaws.com:~/.
I get this error:
ssh: Could not resolve hostname ip-xx-xxx-xx-xxx.compute-1.amazonaws.com: nodename nor servname provided, or not known
lost connection
When I run this code:
scp -i keypair.pem process.py ubuntu@ip-xx-xxx-xx-xxx:~/.
It stalls for ~ 1 minute then I get this error:
ssh: connect to host ip-xx-xxx-xx-xxx port 22: Operation timed out
lost connection
Any ideas how to resolve?
The easiest way to use scp
is to start with an SSH command that already works:
ssh -i keypair.pem ec2-user@1.2.3.4
Then, modify it to use scp
:
scp -i keypair.pem foo.txt ec2-user@1.2.3.4:/tmp/
The only things changed were:
ssh
becomes scp
:/target/