Troubleshooting 'Network error : Connection refused' to AWS ec2 instance
In this video, we are going to troubleshoot an issue where the AWS ec2 Linux machine is
reporting 'network error: connection refused' error.
The common reasons for the issue could be either
1. ppk (putty private key) file is incorrect
2. SSH is not allowed in the network security group
3. ssh service is in stopped state and needs to be restarted
Resolution Steps:
For this demonstration purpose, we are going to use the aws service named 'Systems Manager'
, create a custom IAM role, attach it to the ec2 Instance , access the ec2 instance via sessions manager and then restart the SSH service before we can access it via putty.
Please follow the steps given in this tutorial. I have tried to make it as simple as i can.
The JSON file used for creating custom IAM role -
==============================================
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Action": [
"ssm:UpdateInstanceInformation",
"ssmmessages:CreateControlChannel",
"ssmmessages:CreateDataChannel",
"ssmmessages:OpenControlChannel",
"ssmmessages:OpenDataChannel"
],
"Resource": "*"
}]
}
================================================
Please let me know if you have any queries.
Please like,share,comments and subscribe to my YouTube channel.
Thank you and enjoy the learning. Take Care.
![](https://i.ytimg.com/vi/y27CTLCbuuk/maxresdefault.jpg)