Step-by-Step Guide to Transfer Files from Local Machine to AWS EC2 Using PuTTYgen & WinSCP

This guide will help you:

  1. Convert your AWS .pem key to .ppk using PuTTYgen.

  2. Securely transfer files from your local machine to an EC2 instance using WinSCP.

Prerequisites

  1. AWS EC2 instance running (Linux/Windows)

Don't have one yet? Don't have one yet? Follow my guide on launching an AWS EC2 instance and getting a private key (.pem) https://nucloud.hashnode.dev/ec2

  1. Private key (.pem file) downloaded from AWS

  2. PuTTYgen installed (Download here)

  3. WinSCP installed (Download here)

Step 1: Convert .pem Key to .ppk Using PuTTYgen

Since AWS provides a .pem key but WinSCP requires a .ppk key, we need to convert it.

  1. Open PuTTYgen

    • Launch PuTTYgen (search for it in Windows).

  1. Load the AWS .pem Key
  • Click "Load"

Select All Files in the file dialog, on your Download folder browse and select your .pem key (e.g. MYFIRSTKEY).

  1. A dialog box will appear and say you have successfully imported your key, click the ok button and also click the save private key button

  1. Save as .ppk Key

    • Rename file and Save private key".

    • Confirm saving without a passphrase (or set one for extra security).

Step 2: Connect to EC2 Instance Using WinSCP

WinSCP allows secure file transfer (SFTP/SCP) between your local machine and EC2.

  1. Open WinSCP

    Launch WinSCP and click "New Session.

    1. Configure Connection Settings
    • File Protocol: SFTP (default for Linux EC2)

      • Host Name: ec2 instance public IP address

      • Port Number: 22 (default for SSH/SFTP)

      • User Name:

        • For Amazon Linux/Ubuntu: ec2-user/ubuntu

        • For CentOS/RHEL: centos

        • For Debian: admin

        • For Windows: Administrator

  1. Load Private Key .ppk
  • Click "Advanced" → Go to "SSH""Authentication".

  • Under Private key file, browse and select your .ppk file MYFIRSTKEY.PPK

  • Click OK to save setting

  • Click on Save to save login credentials.

  1. A dialog box will appear that says save session as site click Ok

  1. Login

    • Click "Login".

    • If prompted, confirm the host key (click accept)

Step 3: Transfer Files Between Local & EC2

Once connected, WinSCP will show two panels:

  • Left panel: Your local files c:\user\Admin\Desktop

  • Right panel: EC2 instance files home/ubuntu/

Uploading Files (Local → EC2)

  1. Navigate to the desired folder on the EC2 instance (e.g., home/ubuntu/).

  2. Drag & drop files from the left (local) to the right (EC2).

Downloading Files (EC2 → Local)

  1. Select files/folders on the EC2 side (right panel).

  2. Drag & drop them to your local machine (left panel).

Folder transfer succesful (local → EC2)

Our rental folder has been transferred successfully to our Amazon EC2 instance.

Step 4: Verify File Transfer on EC2 instance

After transferring, you can verify by connecting to your instance via ec2 instance connect and type the command ls to verify that the rental folder is on our home directory.

Conclusion

With PuTTYgen and WinSCP, transferring files between your local machine and an AWS EC2 instance is quick and secure. By converting your .pem key to .ppk and using WinSCP’s intuitive interface, you can easily upload, download, and manage files on your cloud server.

0
Subscribe to my newsletter

Read articles from SUBAIR NURUDEEN ADEWALE directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

SUBAIR NURUDEEN ADEWALE
SUBAIR NURUDEEN ADEWALE

Hello! I'm Subair Nurudeen Adewale, a cloud computing enthusiast and the founder of Nucloud Blog. I'm passionate about sharing knowledge and insights on cloud infrastructure, security, innovation, and the intersection of technology and design. As a cloud expert with a keen eye for user experience, I explore the latest trends and best practices in UI/UX, and how they can be applied to create intuitive, user-friendly, and seamless experiences for cloud-based applications and services. Follow Nucloud Blog for the latest updates and insights from the world of cloud computing and UI/UX design.