ishan Vadwala
ishan Vadwala

Reputation: 359

Cannot ssh into EC2 instance. Operation timed out

1The security group allows SSH at port 22 Inbound Rule

This is the first time I've had this problem. I logged in from a friend's AWS account to one of his instances and it connects. so the problem isn't at my end.

Here's the debug log:

OpenSSH_7.2p2, LibreSSL 2.4.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug2: resolving "ec2-54-215-233-245.us-west-1.compute.amazonaws.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ec2-54-215-233-245.us-west-1.compute.amazonaws.com [54.215.233.245] port 22.

I followed AWS's troubleshooting guide and even that didn't work. Any idea what's wrong?

NACL

Upvotes: 2

Views: 1703

Answers (2)

John Rotenstein
John Rotenstein

Reputation: 269091

The standard things to check when you can't SSH into an instance:

  • Confirm that the Security Group is permitting access on port 22 (SSH)
  • Confirm that the instance is in a Public Subnet (which has a Route Table for the Subnet that sends traffic for 0.0.0.0/0 to the Internet Gateway)
  • Confirm that the instance is running Linux or has an SSH service installed
  • Confirm the Public IP address (if you're not using a static Elastic IP address, it can change when the instance is Stopped and Started)
  • Confirm that the Network Access Control Lists (NACLs) in VPC permit all inbound and outbound traffic (this is the default setting)

Upvotes: 3

Leo C
Leo C

Reputation: 22439

It's probably due to your key.pem's permission not securely set. You might want to try set it to 0400 or 0600 (e.g. sudo chmod 400 key.pem).

Upvotes: 0

Related Questions