To upload files from your local Windows machine to an Amazon EC2 instance, you can use SSH/SFTP clients like WinSCP or PuTTY’s pscp
, or use the scp
command from Windows Subsystem for Linux.
Let’s go with the WinSCP option since it has a graphical interface and is easy to use.
Here is a step-by-step guide:
Step 1: Install WinSCP
You can download it from its official website. After downloading, follow the steps to install it on your machine.
Step 2: Connect to your EC2 instance
Open WinSCP. In the “Session” screen, fill in the details as follows:
- File protocol: SFTP
- Host name: Your EC2 instance’s Public DNS or IP. You can find this in your AWS EC2 console.
- Port number: 22
- User name: Depending on the AMI you are using, it might be “ec2-user”, “ubuntu”, “root”, etc.
- Password: EC2 instances are usually accessed using key pairs, not passwords. Leave it blank.
In the same “Session” screen, click on “Advanced…” button.
Under “SSH”, select “Authentication”.
Here, you can browse and select your private key file (.ppk
) you got when you created your EC2 instance. If your key is not in the .ppk
format (for example, it’s in .pem
format), you need to convert it using PuTTYgen.
Step 3: Upload files
Once you’re logged in, you can see two panes. The left pane is your local machine, and the right pane is your EC2 instance. You can simply drag and drop files or directories between these two panes to upload/download files.
If you want to use scp
command in Windows Subsystem for Linux (WSL) or PuTTY’s pscp
, the process is slightly different, and you would need to be comfortable with command-line tools. Also, note that you should adjust the permissions of the key file and the uploaded files if necessary, to avoid any permission-related issues.