This tutorial will show you how you can transfer files from your local machine running Windows to an AWS EC2 or Lightsail instance using SFTP and the WinSCP client.
- You have created the instance using EC2 using the Amazon Linux AMI or AWS Lightsail
- You are using a Windows computer
- You have a .ppk private key – see How to Create a PPK file from a PEM file – Windows 10
- You have downloaded and installed the free WinSCP SFTP, SCP and FTP client for Windows
Transferring files to the EC2 Instance
Step 1 – Open WinSCP
Step 2 – Click on Session, New Session or press Ctrl+N
Step 3 – Click on ‘New Site’
Step 4 – Enter the public IP address for your instance in the Host name field
Step 5 – Enter the User name – if connecting to a standard EC2 instance using the Amazon Linux AMI the user name will be ec2-user, if it is a Bitnami WordPress instance it will be bitnami
Step 6 – Click on Advanced to add the private key file for authentication
Step 7 – Click on Authentication
Step 8 – In the Private key file field click to browse for the .ppk private key file for the instance you created from the .pem file provided by AWS and click ‘OK’.
Step 9 – Save the session by clicking on ‘Save’ under the User Name – at this point you can name the session so you don’t have to upload the key next time you want to connect to the instance.
Step 10 – Click on ‘Login’ on the Login dialog, and the program will connect to the instance. You should see the directory tree.
If you have any problems, check:
- The host name is correct
- The user is correct
- The private key file (.ppk) is correct for the instance – check the AWS key pair used