- Newest
- Most votes
- Most comments
When facing the "Error establishing SSH connection to your instance" issue with EC2 Instance Connect, there are several potential causes to investigate.
First, let's check the security group configuration. Even though you've set up security groups to allow traffic between the EC2 Instance Connect Endpoint (EICE) and your instance, you need to specifically ensure that:
-
The security group attached to your EC2 instance allows inbound SSH traffic (port 22) from the security group associated with the EICE.
-
The instance must have the EC2 Instance Connect package installed. For Amazon Linux 2023, this should be pre-installed, but it's worth verifying.
-
Confirm that your EC2 instance is in the "running" state and has passed all status checks. You mentioned that one status check might be failing, which could indicate an OS-level issue preventing connections.
-
Verify that the SSH service is running on the instance. Sometimes the SSH daemon might not be started or could be misconfigured.
-
Check that the IAM user or role you're using has the necessary permissions to use EC2 Instance Connect.
-
Ensure that your VPC and subnet configurations allow proper connectivity between the EICE and your instance.
-
The fact that you're using an ed25519 SSH key shouldn't be an issue, but you might want to try with an RSA key to rule out any compatibility issues.
For troubleshooting:
-
Try rebooting your instance if the problem persists.
-
Consider using AWS Systems Manager Session Manager as an alternative connection method if SSH continues to fail.
-
Check that the EC2 Instance Connect prerequisites are met for your specific instance type and AMI.
-
Verify that there are no network ACLs or other network configurations blocking the connection.
Having the EICE in the same subnet as your EC2 instance should be fine and is a common configuration. The issue is more likely related to security group configurations, instance status, or SSH service availability.
Sources
Failed to connect to your instance Error establishing SSH connection to your instance. Try again later. | AWS re:Post
EC2 instance failed to connet | AWS re:Post
Unable to connect to EC2 using EC2 instance connect | AWS re:Post
EC2 Instance Connect cannot connect to my instance ! | AWS re:Post
Please consider consulting the following documentation about EC2 Instance Connect Endpoint: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connect-with-ec2-instance-connect-endpoint.html
The "Security groups" page might offer helpful information for troubleshooting your configuration.

I was checking the AMI for Amazon Linux 2023 ECS Optimized, and it does not come with ec2-instance-connect preinstalled, gonna force install and check if that's the problem.
EDIT: It was indeed the problem. I believe is an error that AWS do not include ec2-instance-connect preinstalled on AL2023 ECS Optimized.