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.
Provide your ec2 instance user login details and click on the Login button and you could be landed into WinSCP home page.
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.
On the above screen, I am trying to copy parse_csv.py 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 ./my-ec2.pem /home/chandra/data.py ec2-user@ec2-32-174-195-130.compute-1.amazonaws.com:/tmp
Now you can see your files in ec2 instance.
References:
How to connect AWS EC2 using PuTTY
Happy Learning 🙂