To transfer files to AWS EC2 instance, one can use secure copy. The format can be seen below.
$scp -i <xxxxx.pem> <location of file> <AWS public DNS>: <folder>
Here is an example:
$scp -i ~/Desktop/amazon.pem ~/Desktop/text.txt ubuntu@ec2-54-166-128-20.compute-1.amazonaws.com:~/
This will upload the file to the user’s home directory which is actually “home/ubuntu”