remote side unexpectedly closed network connection

+1 vote

Hi Guys,

I have launched an EC2 instance and able to ping from the command line. But when I am trying to access from putty it's giving an error as shown below.

remote side unexpectedly closed network connection

Even the mapping URL is refused to connect and am not able to access the site.

Aug 27, 2020 in AWS by akhtar
• 38,230 points

1 answer to this question.

0 votes


A PuTTY session left idle will disconnect at a time determined by the host server. Try enabling keep-alive in PuTTY. This causes PuTTY to send null SSH packets to the remote host periodically, preventing the session from timing out.

The PuTTY client can be configured to always establish a connection that will not time out due to inactivity. To create and save a new keep-alive connection, follow these steps.

  1. Open the PuTTY application, and go to the Options panel (labeled "Category") on the left of the window.

  2. Select (click) the "Connection" item.

  3. In the ​​"Sending of null packets to keep the session active" area on the right, change the default value of "Seconds between keepalives" from 0 (turn off) to 1800 (30 minutes).

  4. Select the "Enable TCP keepalives (SO_KEEPALIVE option)" checkbox. Note: This option may not be available in older versions of the PuTTY client.

  5. On the topmost left side of the Options panel, select (click) "Session".

  6. In the "Host Name (or IP Address)" field, enter the destination hostname or IP address (e.g., "" or "").

  7. In the "Saved Sessions" text-entry box, provide a name for the session (e.g., "saved session").

  8. Select "Save".

Hope this helps!
Enrol in AWS SysOps Course today to learn more.
answered Aug 27, 2020 by MD
• 95,440 points

edited Jul 10, 2023 by Khan Sarfaraz

Related Questions In AWS

0 votes
1 answer

AWS Network ELB take 4 minutes to recognise target as healthy

We hit this issue with NLBs and ...READ MORE

answered Sep 5, 2018 in AWS by Priyaj
• 58,090 points
0 votes
1 answer

Unable to initiate ssh connection to Amazon EC2 instance

The keypair which you are using must ...READ MORE

answered Sep 5, 2018 in AWS by Archana
• 4,170 points
0 votes
1 answer
0 votes
1 answer

Server unexpectedly closed the connection.

Hi@akhtar, There are many reason to cause this scenario. ...READ MORE

answered Apr 2, 2020 in AWS by MD
• 95,440 points
0 votes
1 answer

Network error: Connection timed out or Error connecting to [instance] in AWS.

Hi@akhtar, Check your security group rules. You need ...READ MORE

answered Apr 28, 2020 in AWS by MD
• 95,440 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP