Monday 9 July 2012

SSH into EC2 server

Here's how to mount a remote filesystem and use it as if it were local, using sshfs in bash to an EC2 server using a pem file (note: replaceable options in CAPS_AND_UNDERSCORES):

mkdir <MY_PATH>

sshfs -o IdentityFile=<PATH_TO_PEM_FILE>  EC2_USERNAME@<EC2_IP_OR_DOMAIN_NAME>:/<OPTIONAL_FOLDER_PATH>  <MY_PATH>



This will mount the remote filesystem to <MY_PATH> and allow you to do your file transfers. Of course permissions still matter, so keep those in mind if you start having write-protect errors.


To unmount from the remote filesystem:

umount <MY_PATH>