- Newest
- Most votes
- Most comments
Hi,
I'd strongly recommend you to read https://repost.aws/knowledge-center/ec2-instance-connect-troubleshooting in full details and follow it to fix your issue.
When you get it working for IC, you can extend to ssh from your laptop.
Best,
Didier
I understand you're having trouble connecting to your EC2 instance using EC2 Instance Connect due to Port 22 (SSH) not being authorized. Let's go through some steps to resolve this issue:
-
First, ensure that your security group has the correct inbound rule for SSH. The rule should allow traffic on port 22 from the EC2 Instance Connect IP range for your specific AWS region. Simply setting it to "Anywhere" (0.0.0.0/0) or your own IP address is not sufficient for EC2 Instance Connect to work properly.
-
To find the correct IP range for EC2 Instance Connect in your region, you'll need to check the AWS documentation or use the AWS CLI to get the information.
-
Once you have the correct IP range, modify your security group's inbound rule for SSH (port 22) to allow traffic from this specific IP range.
-
After updating the security group, wait a few minutes for the changes to propagate.
-
If you're still unable to connect, try rebooting your instance as you did before.
-
Ensure that you're using the correct AWS region when attempting to connect. EC2 Instance Connect is region-specific, so make sure you're in the same region as your instance.
-
Verify that your IAM user has the necessary permissions to use EC2 Instance Connect. The user should have the "ec2-instance-connect:SendSSHPublicKey" permission for the specific instance.
-
If you're still experiencing issues, check if there are any VPC settings or Network ACLs that might be blocking the connection.
Remember, EC2 Instance Connect is a relatively new feature and may not be available in all regions. If you continue to have problems, you might want to consider using traditional SSH methods with a key pair as an alternative.
If none of these steps resolve your issue, it would be advisable to contact AWS Support for further assistance, as there might be account-specific or region-specific factors at play.
Sources
Amazon EC2 Instance Connect now available in additional AWS Regions
Security Groups and Classic Ports | AWS re:Post
Detecting EC2 Instances Exposed to Unrestricted SSH Access | AWS re:Post
Relevant content
- Accepted Answerasked 2 years ago
- asked a year ago
- Accepted Answerasked 17 days ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 months ago