- Newest
- Most votes
- Most comments
This is a common issue that can occur with EC2 instances, even after they've been running successfully for some time. There are several steps you can take to troubleshoot and resolve this problem:
-
Double-check your security group settings. Ensure that SSH traffic (port 22) is allowed from your IP address or the appropriate range.
-
Verify that your instance is in a subnet with internet connectivity. If it's in a private subnet without proper routing, you won't be able to connect.
-
Add the EC2 Instance Connect IP ranges to your security group. This is a crucial step that's often overlooked. You need to allow inbound traffic from the EC2 Instance Connect service IP range for your specific region. You can find these IP ranges in the AWS-provided JSON file, filtering for "EC2_INSTANCE_CONNECT" as the service value.
-
Try rebooting your instance. Sometimes, a simple reboot can resolve connectivity issues.
-
Check your instance's status and network settings in the EC2 console to ensure everything is configured correctly.
-
If you're still unable to connect, consider using alternative connection methods like AWS Systems Manager Session Manager, which can sometimes work when SSH fails.
-
Review the system logs for any error messages that might provide clues about the connection issue.
If none of these steps resolve the issue, it may be worth reaching out to AWS support for more in-depth troubleshooting. Provide them with details about your instance configuration and the steps you've already taken to address the problem.
Remember, it's important to ensure that your instance's network settings, including VPC configuration and routing tables, are set up correctly for EC2 Instance Connect to function properly.
Sources
Unable to connect to EC2 Instance | AWS re:Post
Failed to connect to your instance EC2 Instance Connect is unable to connect to your instance. | AWS re:Post
EC2 Instance Connect is unable to connect to my instance | AWS re:Post
Can't connect to my EC2 instance | AWS re:Post
Relevant content
- AWS OFFICIALUpdated 2 months ago
