ssh timeout issue connecting to an EC2 instance on OS X

Posted by mamusr on Server Fault See other posts from Server Fault or by mamusr
Published on 2014-08-23T02:30:12Z Indexed on 2014/08/23 4:21 UTC
Read the original article Hit count: 474

I am new to AWS and not a networking expert but curious to know more about it.

I created a VPC with a public subnet only. Then i created an EC2 instance using an Ubuntu 14.04 64-bit pv AMI image (ami-e84d8480) as well generating the key pair needed to connect to it through ssh.

I followed amazon's instructions to connect to an EC2 instance via ssh which did not work.

Here is my attempted input and debug log:

Running on OS X 10.9.4

user$ ssh -vvv -i key.pem [email protected]
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: /etc/ssh_config line 102: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
debug1: connect to address xxx.xxx.xxx.xxx port 22: Operation timed out
ssh: connect to host xxx.xxx.xxx.xxx port 22: Operation timed out

To attempt to resolve the issue:

  1. I enabled the SSH port.
  2. Tried different usernames other than ubuntu, like ec2-user and root.
  3. Initially set an inbound ssh rule in the security group to connect to only my ip address. When that did not work, i changed it to allow any ip to connect.

But those actions did not fix the problem.

Here are my guesses as to what i am missing in getting the EC2 instance connection to work.

  1. My etc/ssh_config file may be preventing the connection from taking place.
  2. I may have missed an important networking detail when setting up the VPC.
  3. I do not have a public ip address specified for the instance. I am connecting through the private ip address.

My questions for the community:

  1. Am i going about it the wrong way connecting to the instance through the private ip address? if so, do i need to specify a public ip address for it to connect or some other method?

© Server Fault or respective owner

Related posts about ssh

Related posts about amazon-ec2