Uploading files on Amazon EC2

If you're using a Mac (or other *nix system), simply copy-paste this to terminal to upload a file via SSH

scp -i MyKeyFile.pem FileToUpload.pdf [email protected]:FileToUpload.pdf

replace "ec2-123-123-123-123.compute-1.amazonaws.com" with your instance's public DNS name


You can try kitten utility which is a wrapper around boto3. You can easily upload/download files and run commands on EC2 server or on multiple servers at once for that matter.

kitten put -i ~/.ssh/key.pem cat.jpg /tmp [SERVER NAME][SERVER IP]

Where server name is e.g ubuntu or ec2-user etc.

This will upload cat.jpg file to /tmp directory of server


You actually shouldn't use FTP to access Amazon EC2 instances at all (or any other server for that matter, but that's a different issue, see the slightly exaggerated, but nonetheless appropriate rant FTP Must Die).

Rather, you should use the SSH File Transfer Protocol (SFTP), which usually works just fine on EC2 instances out of the box without requiring additional security settings outside of SSH access in place anyway, i.e. since you already have access via your SSH keys you can use these as well for SFTP with your favorite (S)FTP client.

(S)FTP security

Even more important than this out of the box support without additional security/firewall settings is that SFTP is secure, while FTP is exactly the opposite, see e.g. What's Your Password? xyzzy? Great!:

As stated earlier, FTP predates the age when Internet activity was expected to be malicious. As such, it has no provisions for security against password sniffing, man in the middle attacks, and so on.

Your username and password are transmitted in the clear from the FTP client to the FTP server. Anyone with control over any of the routers along the path from client to server can read the entire session, including your password. [emphasis mine]

Please note that this can be remedied to some extend by using FTP over SSL or FTP over SSH, but both requires additional work and provide no benefits over SFTP for regular use cases like yours.

(S)FTP clients

Nowadays most FTP clients should support SFTP as well one way or another, ideally facilitating an SSH authentication agent like ssh-agent (Unix/Linux/Mac OS X) or Pageant (Putty) (Windows) to avoid the need to explicitly specify the SSH key to use (though that's possible as well of course).

There are likely plenty of SFTP clients for Mac OS X, a free one is Cyberduck, which is a Libre FTP, SFTP, WebDAV & cloud storage browser for Mac & Windows (see their SFTP Howto).