While using cloud services like AWS it sometimes occurs to transfer files from a local machine to a remote server which is only accessible via SSH keys. Linux utilities like rsync and scp come to rescue in this case. Here is an example of how to transfer files via rsync.
First, make sure that the destination folder on the remote server is writeable. If not, log into the remote server and change the permissions, e.g.:
sudo chmod 777 /home/ec2-user/destination_folder
Then go back to the local machine and transfer the file to the remote machine:
rsync -a --progress -e "ssh -i your_ssh_key.pem" file.zip ec2-user@52.1.234.567:/home/ec2-user/destination_folder
where your_ssh_key.pem is the SSH private key to access the remote server, file.zip is the file to transfer, ec2-user is the user on the remote server, 52.1.234.567 is the IP address of the remote server, and /home/ec2-user/destination_folder is the folder on the remote server where you want to transfer the file to.
rsync is a truly file synchronization tool and comes with lots of options, look at its man page for more examples.