It is a very frequent scenario to copy local files to AWS EC2 instance while you are developing an application on your local machine.

How to copy Local Files to AWS EC2 instance:

One of the possible solutions to do – you can push the code into your GIT repository and pull them from your EC2 instance, but to do it, we have to install GIT on EC2 instance.

In this tutorial, we are going to see how can we manually copy the local files to AWS EC2 instance without using GIT or any other remote repositories.

1. Windows User:

WinSCP is a very good tool for Windows users to move files locally to remote machines. Download the WinSCP and install it, the installation process is pretty straightforward.

After installation, open the WinSCP, then you could see the below the login window.

copy Local Files to AWS EC2 1

Provide your ec2 instance user login details and click on the Login button and you could be landed into WinSCP home page.

copy Local Files to AWS EC2 2

On the left-hand side you can see your local file and right-hand side it is the remote machine. You can simply drag and drop the files, from local to remote like below.

copy Local Files to AWS EC2 3

On the above screen, I am trying to copy to remote ec2 /opt/dotw/ folder.

2. For Linux/Mac users:

Linux or Mac users can directly copy local files to ec2 instance using scp command, without installing any new software.

Open the terminal and locate to your ec2 .pem file give the below command.

scp -i ec2.pem –file path to be copied e2-user@your_ec2_public_ip:/location tobe copy
$scp -i ./my-ec2.pem /home/chandra/

Now you can see your files in ec2 instance.


How to connect AWS EC2 using PuTTY


Happy Learning 🙂