Just start to learn AWS. And couldn’t figuring out why I can’t connect to my new created instance. I’m using amazon 2023 linux, and allow http and https to connect. Also I created IAM roles for it.
Here is the error:
Failed to connect to your instance
EC2 Instance Connect is unable to connect to your instance. Ensure your instance network settings are configured correctly for EC2 Instance Connect. For more information, see Set up EC2 Instance Connect at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html.
2
Answers
You need to allow SSH traffic in order to connect to your instance. For security concerns, instead of allowing for all, you can allow only your IP address.
It appears that you are wanting to connect to the instance by using EC2 Instance Connect.
EC2 Instance Connects works as follows:
Therefore, the Security Group Inbound Rule needs to allow inbound SSH access from the EC2 Instance Connect service.
The easiest way to test things is to add a rule to the Security Group associated with the instance. The rule can permit Inbound access on port 22 (SSH) from
0.0.0.0/0
. Note that this is not great for security because it permits all SSH traffic, but it is useful for testing.Then, test whether EC2 Instance Connect is working. Once it is working, you can further restrict the Security Group.
From Prerequisites – Amazon Elastic Compute Cloud: