title: Getting connection refused while connecting to EC2 instance, even if I am able to get the response for ping
body: <p>I am getting Network error: Connection refused while connecting to AWS instance via putty.</p>
  
  <p>However I can ping this instance and port 22 in configured under security group as well. Earlier I could access this instance, I tried reboot and attached and removed another volume. Post that I am getting this issue.</p>
  
  <p>PFB my system log:</p>
  
  <pre><code>Welcome to [1mUbuntu 16.04.3 LTS[0m!
  
  [    3.898926] systemd[1]: Set hostname to &lt;ip-172-31-18-16&gt;.
  [    3.927671] systemd-fstab-generator[340]: Failed to create mount unit file /run/systemd/generator/newone.mount, as it already exists. Duplicate entry in /etc/fstab?
  [    3.936143] systemd-fstab-generator[340]: Failed to create mount unit file /run/systemd/generator/newone.mount, as it already exists. Duplicate entry in /etc/fstab?
  [    3.943499] systemd[328]: /lib/systemd/system-generators/systemd-fstab-generator failed with error code 1.
  </code></pre>