Search code examples
amazon-web-servicesamazon-ec2

Failed to ssh connect to EC2 - Although SSH inbound rule is configured


A bit odd but I didn't find any discussion or documentation about it yet. I've tried connecting using SSH to a EC2 instance with the following config: t3.micro, security group that allows only SSH, ubuntu and has an IAM role 'AmazonEC2RoleforAWSCodeDeploy'

It returns:

EC2 Instance Connect is unable to connect to your instance. Ensure your instance network settings are configured correctly for EC2 Instance Connect.

Previously the same instance worked just fine and in a connection I've configured a GitHub runner. Now when I'm trying to reproduce it, it happens all the time, even with Amazon linux, without IAM role and with different security groups that also allow HTTP, HTTPS.

0.0.0.0/0 is configured to all of the inbound rules. Any help would be appreciated


Solution

  • I went through the troubleshooting, documentation etc and nothing helped. tried modifying the inbound rules, trying different vpcs, tried creating different instances. As a final resort, I tried to create the instance in a different region, which for some reason worked.