I created a new instance of Amazon EC2 in Amazon Web Services (AWS) by referring to the documentation. I even added a SSH rule like this:
Port: 22
Type: SSH
Source: <My IP address>/32
I downloaded the .pem
file, converted it into .ppk
file by using PuTTYGEN
. Then I added host name in PuTTY like this:
ec2-user@<public_DNS>
I selected default settings
, added that .ppk file to PuTTY, logged in and I got this error:
Even trouble shooting link didn't help me.
I'm also getting this error in system logs:
How can I connect to my Amazon EC2 instance via PuTTY?
Things to check when trying to connect to an Amazon EC2 instance:
0.0.0.0/0
). This solves the majority of problems.If you are able to launch and connect to another instance in the same subnet, then the VPC configuration would appear to be correct.
The other thing to check would be the actual configuration of the operating system on the instance itself. Some software may be affecting the configuration so that the web server / ssh daemon is not working correctly. Of course, that is hard to determine without connecting to the instance.
If you are launching from a standard Amazon Linux AMI,
ssh
would work correctly anytime. The web server (port 80) would require installation and configuration of software on the instance, which is your responsibility to maintain.Go to vpc attached to instance and then add entry to route table with 0.0.0.0/0 - Destination Internet Gateway of your VPC - As Target Save It and try to connect it.
Ajay,
Try this. Go to your VPC dashboard. Click on Network ACLs - on the associated acl, update your Inbound Rules to allow SSH access on port22.