Home News WebDev Links About Garden Notes LAMP Stack Using Git Using SSH/SFTP Linux Commands

Using SSH and SFTP with an AWS EC2 Instance

This describes simple methods to connect to an AWS EC2 with SSH and SFTP. You will need the following to accomplish this:


ec2-53-5-222-168.compute-1.amazonaws.com ## dont use this -- it was made up

Setting up an SSH Session

Using the examples above in a terminal window:


cd /myProjectDirectory  ## change to your project directory
## run ssh using your parameters inserted into the following
## ssh -i "full/path/to/pemfile.pem" user@server
##
ssh -i "/path/to/my_keyfile.pem" ubuntu@ec2-53-5-222-168.compute-1.amazonaws.com
  

This should set up a remote terminal session with the specified aws server, logged in as username "ubuntu" on that server.

Setting up an SFTP Session

Transferring files using SFTP is simply done as well:


cd /my/project/directory  ## cd to your local project directory
## run sftp using your parameters inserted into the following
## sftp -i "full/path/to/pemfile.pem" user@server
sftp -i "/path/to/my_keyfile.pem" ubuntu@ec2-53-5-222-168.compute-1.amazonaws.com
  

Once running, you can transfer files in either direction using simple sftp commands:

Visual SFTP Client - FileZilla

The FileZilla client is available for most operating systems, and offers a very nice visual SFTP session.

Download it here: https://filezilla-project.org