Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

After creating a new instance, I am trying to access my instance like below:

ssh -i private_key.pem root@my_instance_public_domain

but the operation is timing out. I have updated the private key file permission using

chmod 400

and also edited default security group by adding a new in bound rule, selecting SSH and source Ip as 1.12.34.0/32

but getting port 22: Operation timed out.

What I am missing.

share|improve this question
    
Is the ip you are connecting from 1.23.34.0/32? If not you have to modify the security group. You must also ensure that the instance is part of your security group –  Ulrich Dangel Jun 6 '12 at 18:40
    
my ip is 1.23.34.0.what doest it mean "You must also ensure that the instance is part of your security group "? –  arnold Jun 6 '12 at 18:42
    
this just means you have to make sure that the instance must be assigned to your security group. Just to be sure 1.23.34.0 must be your external ip address. Another problem (but unlikely problem if you use a provided AMI) may be that your instace has no ssh server running / has customized firewall rules. –  Ulrich Dangel Jun 6 '12 at 18:48
    
I have already added the instance under the security group it is default and in that security group I have set ssh using my ip –  arnold Jun 6 '12 at 18:53

1 Answer 1

Did you manage to resolve your ssh issue to your ec2 instance?

I also encountered ssh login issues while setting up my first ec2 instance.

Here was how I resolved my ssh login issue:

  • with your instance's security group, set your inbound SSH rule's Source IP to 0.0.0.0/0 first, and make sure you can get a working connection with this setting. Once you have your ssh connection working, you can then tighten access by changing Source IP to the IP range of the machine you are logging in from. Note that if this machine has a non-static public IP, then you will frequently have to change the Source IP setting for your SSH rule.

  • I have noticed from my own experience that if I try to ssh to my new instance without waiting for its status checks to complete, I would encounter a ssh timeout issue. This was especially true for a newly created instances. In your AWS console, there should be a 'State' and 'Status Checks' column for each of your instance. Make sure the 'State' entry for your instance shows 'running' (with a green circle next to it), and the 'Status Checks' entry shows '2/2 checks passed' (with a green circle and white tick). This could take awhile at times - so go get some snacks, then come back and try logging in again.

  • I have found enabling ssh verbosity when helpful for debugging ssh issues too. Try this command to enable verbosity:

    ssh -vvv -i private_key.pem root@my_instance_public_domain

  • pinging your instance's public FQDN may also help, but make sure your instance's Security Group rules are set to allow ICMP traffic.

  • trying to telnet to port 22 of your instance's public FQDN may also help with troubleshooting. e.g.

    telnet my_instance_public_domain 22

Hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.