- Newest
- Most votes
- Most comments
Please check this article https://repost.aws/knowledge-center/ec2-linux-resolve-ssh-connection-errors
Hello.
Is it possible to connect via Systems Manager Session Manager or EC2 Instance Connect instead of SSH?
If you can connect to EC2 using these methods, please check the sshd log and whether sshd is running.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-methods.html
- Security Group: Double-check the Security Group associated with your EC2 instances. Ensure that:
- Inbound rules allow SSH (port 22) from your office's IP range or 0.0.0.0/0 (if you're using a VPN).
- Outbound rules allow SSH (port 22) to your office's IP range or 0.0.0.0/0.
- Network ACLs: Verify that Network ACLs (Access Control Lists) are not blocking SSH traffic. Check:
- Inbound and outbound rules for the subnet where your EC2 instances reside.
- EC2 Instance Configuration: Ensure that:
- The EC2 instances are running and have a public IP or Elastic IP (EIP) associated.
- The SSH server is running and configured correctly on both instances.
- SSH Key Pair: Verify that:
- You're using the correct SSH key pair for authentication.
- The key pair is properly configured and associated with your EC2 instances.
- Office Network Configuration: Check your office network configuration:
- Ensure that there are no firewall rules or network restrictions blocking SSH traffic to your EC2 instances.
- AWS Region: Confirm that you're trying to access the correct AWS region where your EC2 instances are located.
- SSH Client: Try using a different SSH client or version to rule out any client-specific issues.
- AWS Console: Check the AWS Console for any error messages or warnings related to your EC2 instances or Security Groups.
Have the instances been stopped and started (this is different to being rebooted)? Stopping and starting will cause the public IP address to change.
You also specify that it's your office computer that you can't access from, so could its IP address have changed (or could the connection be going through a proxy whose IP address has changed)? If an address (or range) is hard coded into the security group then any change to the source IP could fall outside this. Consider opening the source to 0.0.0.0/0 just to see if you can get it working. You can always tighten it up again later.
Relevant content
- asked 6 months ago
- asked 4 months ago
