- 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. Since you've been able to connect to this instance for months and nothing has changed on your end, there are several potential causes and steps you can take to troubleshoot:
-
Security Group: Double-check your security group settings. Ensure that SSH traffic (port 22) is still allowed from your IP address. Your IP might have changed since your last successful connection.
-
Network Configuration: Verify that the instance is still in a subnet with internet connectivity and that the route table includes a route to an internet gateway.
-
EC2 Instance Connect IP Ranges: AWS periodically updates the IP ranges used by EC2 Instance Connect. You may need to update your security group to include the latest EC2 Instance Connect IP addresses for your region.
-
SSH Key: Confirm you're using the correct SSH key pair and that the permissions on your private key file are correct (chmod 400 your-key.pem).
-
Instance Health: Check the system log and instance status checks in the EC2 console for any issues, even though your status checks are passing.
-
EC2 Instance Connect Service: Verify that the EC2 Instance Connect service is still installed and running on your instance. A system update might have affected this service.
-
Try Alternative Connection Methods: If possible, attempt to connect using AWS Systems Manager Session Manager as an alternative method to diagnose the issue.
-
Network ACLs: If you're using custom Network ACLs, ensure they're not blocking SSH access.
If these steps don't resolve the issue, you may need to contact AWS Support for further assistance, especially if you suspect there might be an account-related problem or a broader issue affecting EC2 Instance Connect.
Remember, sometimes issues like this can be resolved by stopping and starting the instance (not just rebooting), but be aware that this will change its public IP address if you're not using an Elastic IP.
Sources
EC2: Cannot connect anymore via Instance Connect or SSH command line | AWS re:Post
Can't connect to ec2 instance | AWS re:Post
Suddenly I can't connect to my ec2 server | AWS re:Post
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 5 months ago