There may be few reasons
- The security group or network ACL doesn't allow access.
- There's a firewall on the instance's operating system.
- There's a firewall between the client and the server.
- The host doesn't exist.
Please find following resources for troubleshooting
I am not able to ssh to EC2 instancesasked 8 months ago
Not able to connect ssh which i have created vm from the existing AMIAccepted Answerasked 19 days ago
Unable to connect to EC2 instance in private Subnetasked a year ago
Unable to Connect to Instanceasked 7 months ago
Unable to ssh into aws ec2 instances.asked 4 months ago
Unable to Connect to AWS EC2asked 21 days ago
Unable to SSH Windows Ec2 instanceasked 2 years ago
Unable to connect instance using RDPasked a month ago
Unable to connect to EC2 instance using Public IP address with sshasked 3 years ago
can't connect to any new ec2 instances or rds databasesasked 2 years ago