Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to connect to aws machine : operation timed out

I am new to AWS and created key pair correctly

@air~/.ec2 - 14:25:10$ ec2-add-keypair mykey > mykey.pem  

and run the instance with same key

@air~/.ec2 - 14:25:15$ec2-run-instances ami-a29243cb -k mykey -t t1.micro  

when try to connect to machine I see

@air~/.ec2 - 14:25:22$ ssh  -v -i mykey.pem [email protected]
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to [email protected] [21.20.42.185] port 22.
ssh: connect to host [email protected] port 22: Operation timed out

I have even tried [email protected] but no luck

How can I fix this?

like image 876
daydreamer Avatar asked May 10 '12 21:05

daydreamer


1 Answers

This has been resolved.

Reasons

  • The security group was default instead of what I created. fixed with command

ec2-run-instances ami-a29243cb -k mykey -t t1.micro -g worker

  • login as ubuntu instead of ec2-user

ssh -v -i ~/.ec2/mykey.pem [email protected]

and it worked like a charm :)

like image 193
daydreamer Avatar answered Sep 22 '22 06:09

daydreamer