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 email@example.com:~/
This will upload the file to the user’s home directory which is actually “home/ubuntu”