Learn how to transfer files between desktop and EC2 using winSCP. Using key based authentication, winSCP can be connected to EC2 to download/upload files from/to server.
While working on EC2 server hosted on AWS, one of the basic requirement you come across is to transfer data between your desktop/laptop and EC2 instance. Since EC2 uses key based authentication, for beginners its hard to understand how to transfer data from desktop to EC2 cloud.
Normally, programs like winSCP are used to transfer data between Linux server and windows machine. In this article we will walk you through how to add key based authentication in winSCP. Later how to download file from EC2 to local machine.
Other EC2 related posts which might interest you :
- EC2 basics flashcards
- Data transfer between two EC2 instances
- Assign Elastic IP to EC2 instance
- Rsync to EC2 server
Step 1: Know your DNS name
Make sure your EC2 instance is spinned up. You have Public DNS name of your EC2 instance. You can see it under instance description in your AWS EC2 console.
Take our AWS CSA exam quiz! Check your knowledge.
Refer screenshot below :
Step 2 : Set private key for authentication
Open WinSCP tool. Click on Advanced to open settings of tool.
Under settings, click on Authentication under SSH in left panel. This will open up authentication settings on right panel.
Under, Authentication parameters tick ‘Allow agent forwarding‘ and browse your private key file in it. This private key file is key the same file you use to authenticate to EC2 when connecting via PuTTY
Click OK and close settings.
Step 3 : Connect
Copy paste public DNS of your EC2 instance, username as ec2-user for redhat (different Linux distro has diff default logins in AWS. List of all is here) and hit connect. It will pop up to accept key if you are connecting for first time via winSCP. Accept it and you will be connected to EC2 server!
I have created small GIF which shows whole above process. Have a look .
Now you can download or upload files from EC2 to local like you normally do!