0

I'm running Ubuntu instance on EC2 and I can't ssh to it. I get the following:

Connection timed out

I don't know how to access it. I used the following:

ssh -i <key>.pem ubuntu@<instance address>

Any ideas?

OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to ec2-54-235-7-137.compute-1.amazonaws.com [54.235.7.137] port 22. debug1: connect to address 54.235.7.137 port 22: Connection timed out ssh: connect to host ec2-54-235-7-137.compute-1.amazonaws.com port 22: Connection timed out
Dan Ciborowski - MSFT's user avatar
Dan Ciborowski - MSFT
7,31710 gold badges61 silver badges90 bronze badges
askedJul 21, 2013 at 10:16
Ahmed Elmorsy's user avatar
2
  • Does the security group associated with the instance have port 22 open?CommentedJul 21, 2013 at 10:17
  • Yes, It's open and I get the ssh command by right-click on the instance and choose connect which in case it is not open it gives an error but It doesn't give an error which means it's open and ready.CommentedJul 21, 2013 at 10:24

1 Answer1

2

Double check that your instace_address if your public dns, it can change when you rebot.

Check that you have the correct permission set for .pem

Are you behind a proxy? Like a work network? This might require a corkscrew configuration.

Are you able to launch a Amazon Linux, and ssh using

ssh -i <key>.pem ec2-user@<instance_address>

Double check that ubuntu is the correct username for your instance(but to be honest I do think it is), but also try user, and ec2-user

Set your security group to allow 0.0.0.0/0, are you able to get in now? Security group issue if so.

answeredJul 21, 2013 at 14:28
Dan Ciborowski - MSFT's user avatar
Sign up to request clarification or add additional context in comments.

5 Comments

I changed my network, I'm using my home network and it is not working yet!
please provide your verbose SSH error log. What you have provided isn't really useful.
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug1: Connecting to ec2-54-235-7-137.compute-1.amazonaws.com [54.235.7.137] port 22. debug1: connect to address 54.235.7.137 port 22: Connection timed out ssh: connect to host ec2-54-235-7-137.compute-1.amazonaws.com port 22: Connection timed out
confirm that your security group allows 0.0.0.0/0 for ssh, post what security group settings you have enabled in your first post.
I used the GettingStartedSecurity group and it worked with me before but when I changed it to another custom security group that allows 0.0.0.0/0 for ssh it worked! Thanks

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.