Search
  • Jayant Kumar

Connect AWS EC2 instance with WINSCP and PUTTY

Updated: Jun 6


An article that helps you to connect your AWS EC2 instance with WinSCP and upload your files.

Pre-requisite

  1. AWS Account

  2. EC2 basic knowledge

  3. Linux commands knowledge

  4. WinSCP software

Now, let's start.


Go to AWS Account and log in. You will see a dashboard and select EC2 service.


From EC2 Dashboard, click on the Instance (running) link and you will be redirected to the EC2 Instance listing dashboard.



Click on the Launch Instances button from the top right corner. Now, select any LINUX instance provided by AWS.

Step 2: Select t2.micro (free tier eligible), although you can select of your choice. Click on Next: Configure Instance Details.


Step 3: if you want to make any changes in configuration details, else click on Next: Add Storage.


Any extra storage you want to add to your server, click on Next: Add Tags.


Step 5: Tags are optional, but I have added some information. Click on Next: Configure Security Group.


Step6: Security Groups are virtual firewalls. They will allow you to configure what type of request you allowing to your server. Incoming/outgoing both. I will SSH to ec2 server, HTTPS/HTTP for browser/HTTP requests. Click on Next: Review and Launch.

Last Step: In this step, you have to create one public key. select Create a new key pair, type your key pair name and click on Download Key Pair. In your downloads folder, .pem will be downloaded. Click on Launch Instances.


The success page will appear in the below message. Click on View Instances.

Select your instance through the checkbox button. Details related to your Instance will appear in the below section. Copy and paste your Public IPv4 DNS details in your notepad, it will be required when we're connecting our server with putty.


Now our instance has been configured and running successfully. Now we need to connect it with the PUTTY server and will ssh into our EC2 server.


Open Puttygen server if you have installed it in your system. Click on the Load button and find your .pem file from the downloads folder which you have created in the last step.

Once you have loaded your key, your public key content will be shown like the below image.

Click on Save Private Key. This will help us to connect to our EC2 server. Please keep it on the desktop or in any other folder.


Now, we have created our .ppk (private key) file. Open Putty and go to SSH -> Auth. Browse your .ppk file.


After that click on Session and paste your Public IPV4 DNS details in the Host Name (or IP address) field. Click on Open.


Below screen will appear and type ec2-user. ec2-user username for LINUX and ubuntu username for UBUNTU server. You will get more information in AWS documentation.

Press enter.

Now you are connected to the ec2 server. Now we have to install any updates and apache server in the server. Type below command


sudo su
yum update -y
yum install httpd -y

These commands will give root privileges, will update your server, and install apache.

Type,

sudo chmod 7777 /var/www/html
cd /var/www/html

Now all your development files will be stored in the Html folder.


Now if you have many project files like LARAVEL/LUMEN, and want to upload your files in ec2 without a GIT repository, WinSCP can help you. You need to install WinSCP and open it in your system. Once open, click on New Site,

  1. Paste Public IPv4 DNS details in Host Name

  2. type ec2-user in the username field

  3. Click on Advanced...


Go to SSH -> Authentication. Browse your .ppk file from your system. Click Ok and then Login button.


The below screen will appear once you connected successfully. Select / <root> from the mentioned drop-down image below. Because / <root> directory contains all your configuration files.


Below listing will appears. Select var -> www -> html.


Upload all your web development files in the HTML folder. It is the same as FILEZILLA software, just need to drag and drop your files in the HTML folder section.


To check if your files have uploaded or not, you can ssh and login to your server through putty.


Hope it helps :)

12 views0 comments

Recent Posts

See All