- Newest
- Most votes
- Most comments
Hello,
The error message "Failed to connect to your instance" indicates that EC2 Instance Connect is unable to establish a connection to your EC2 instance.
Check your EC2 instance’s security group to ensure port 22 (SSH) is open. Verify it has a public IP or Elastic IP, and confirm that the VPC subnet allows internet access. You can also try connecting via Session Manager if available.
Check the instance status:
aws ec2 describe-instance-status --instance-ids <your_instance_id>
This command will provide you with the current status of your instance, which can help you identify if there are any issues with the instance itself.
Here are some possible reasons why you might be unable to connect to your EC2 instance:
- Security group issue: Ensure the security group allows inbound SSH traffic on port 22.
- Instance state: Verify if the instance is running and not stopped or terminated.
- Network interface issue: Check if the instance has a public IP address assigned.
- EC2 Instance Connect issue: Ensure the service is running and configured correctly.
Troubleshooting tips:
- Review security group rules.
- Check instance state and network interface.
- Verify EC2 Instance Connect configuration.
- Try connecting using other methods (AWS Management Console, AWS CLI).
Hello,
Unable to Connect to Your EC2 Instance Here’s What to Check
- The error message "Failed to connect to your instance" usually means EC2 Instance Connect couldn't establish a connection to your instance.
Here are some steps to troubleshoot:
-
Check Security Group: Ensure that your security group is configured to allow SSH access on port 22.
-
Public IP/Elastic IP: Make sure the instance has a public IP or Elastic IP, and verify that the VPC subnet allows internet access.
-
Use Session Manager (if enabled): Try connecting through Session Manager as an alternative.
-
Check Instance Status: Use this AWS CLI command to check the current status of your instance:
aws ec2 describe-instance-status --instance-ids <your_instance_id>
Common issues to consider:
- Security Group: Verify that SSH traffic (port 22) is allowed in the security group.
- Instance Status: Ensure the instance is running, and not in a stopped or terminated state.
- Network Configuration: Check that the instance has an assigned public IP address.
- EC2 Instance Connect Configuration: Confirm that the service is properly configured.
Troubleshooting tips:
- Review security group rules.
- Verify instance status and network settings.
- Double-check EC2 Instance Connect setup.
- Attempt other connection methods like the AWS Management Console or CLI.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html
Assuming this is a EC2 instance with public IPv4 address, ensure that the SG (security group) allow inbound SSH from the IP prefix for your Region.
Below list for reference
IpPrefix Region
43.196.20.40/29 cn-north-1
43.192.155.8/29 cn-northwest-1
18.252.4.0/30 us-gov-east-1
15.200.28.80/30 us-gov-west-1
13.244.121.196/30 af-south-1
43.198.192.104/29 ap-east-1
3.112.23.0/29 ap-northeast-1
13.209.1.56/29 ap-northeast-2
15.168.105.160/29 ap-northeast-3
13.233.177.0/29 ap-south-1
18.60.252.248/29 ap-south-2
3.0.5.32/29 ap-southeast-1
13.239.158.0/29 ap-southeast-2
43.218.193.64/29 ap-southeast-3
16.50.248.80/29 ap-southeast-4
35.183.92.176/29 ca-central-1
40.176.213.168/29 ca-west-1
3.120.181.40/29 eu-central-1
16.63.77.8/29 eu-central-2
13.48.4.200/30 eu-north-1
15.161.135.164/30 eu-south-1
18.101.90.48/29 eu-south-2
18.202.216.48/29 eu-west-1
3.8.37.24/29 eu-west-2
35.180.112.80/29 eu-west-3
51.16.183.224/29 il-central-1
3.29.147.40/29 me-central-1
16.24.46.56/29 me-south-1
18.228.70.32/29 sa-east-1
18.206.107.24/29 us-east-1
3.16.146.0/29 us-east-2
13.52.6.112/29 us-west-1
18.237.140.160/29 us-west-2
You can also try connecting using SSM session manager . Ensure that EC2 has a IAM role with AmazonSSMManagedInstanceCore
permission attached.
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated a month ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 2 months ago