- Newest
- Most votes
- Most comments
I understand you're having trouble connecting to your EC2 instance. This is a common issue that can have several causes. Let's go through some troubleshooting steps:
-
Check your instance status: Ensure your EC2 instance is in the "running" state and has passed all status checks in the EC2 console.
-
Security Group configuration: Verify that your security group allows inbound traffic on port 22 (SSH) from the appropriate sources. For EC2 Instance Connect, you need to allow connections from the EC2 Instance Connect IP ranges for your region, not just your personal IP.
-
Network ACLs: Check both inbound and outbound rules in your Network ACLs to ensure they allow traffic on port 22.
-
VPC and subnet configuration: Confirm that your instance is in a public subnet with a route to an Internet Gateway. The subnet's route table should have a route for 0.0.0.0/0 pointing to the Internet Gateway.
-
Public IP: If you've stopped and started the instance, make sure you're using the current public IP address, as it may have changed.
-
SSH service: The SSH service on the instance itself might be having issues. If possible, check the instance's system logs through the EC2 console for any SSH-related error messages.
-
EC2 Instance Connect prerequisites: If you're using EC2 Instance Connect, ensure that the necessary package is installed on your instance and that you have the correct IAM permissions.
-
Try alternative connection methods: If EC2 Instance Connect isn't working, attempt to use traditional SSH with your key pair or AWS Systems Manager Session Manager if your instance is configured for it.
-
Firewall settings: Check if there's any firewall on your local machine blocking outbound connections to port 22.
If none of these steps resolve the issue, you might want to consider launching a new instance in the same or a different subnet to determine if the problem is specific to your current instance or a broader network configuration issue.
If the problem persists after trying these steps, it may be necessary to contact AWS support for further assistance, as there could be account-specific or regional issues that are not immediately apparent.
Sources
Can't connect to ec2 instance | AWS re:Post
connect to my aws ubuntu from my desktop | AWS re:Post
Can't SSH into EC2 instance anymore | AWS re:Post
answered 2 years ago
Relevant content
asked 7 years ago
asked 4 years ago
asked 2 years ago
