Hi thanks for reading,

I usually connect to my instance no problem. For example:

mymac:~ ssh i- path/to/my/key.pem ubuntu@ec2-really-long-public-dns

This worked yesterday, however today the same command does not work. I always update IPv4 in my security group to allow SSH on port 22 with my public IPv4 .

mymac:~ curl ifconfig.me

I also update my CNAME and A record file so that the website is accessible online.

However despite the instance domain is online on the internet. When i open my security group to accept traffic on ports 80 and 443 with my IPv4 I can access the website.

I just so not know what is going on.

When I run terminal to connect

mymac:~ ssh -vvv i- path/to/my/key.pem ubuntu@ec2-really-long-public-dns

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to ubuntu@ec2-really-long-public-dns port 22.
ssh: connect to host ec2-really-long-public-dns port 22: Operation timed out

Any ideas? I've followed https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.html#TroubleshootingInstancesConnectionTimeout as best as I can but no success.

Also I had another ec2 instance which i cannot set up on ssh either but did work yesterday, i am not sure what may have happened? I check my router and my network is not stopping port 22 TCP connections, no network firewall.

  • I understand updating your security group with your current public IP given your IP can be dynamic. What CAME / A record are you changing? Your EC2 instance should be using an elastic IP address, which never changes. The problem is most likely security group is blocking you. I just go to whatismyipaddress.com or similar to find out my IP. – Tim Jan 6 at 7:46
  • I think you're right let my see what the static IPv4 is. – Nelson Canino Jan 6 at 8:09
  • I am actually hosting the domain on GoDaddy but using the Amazon Web server. GoDaddy does not have a DNS, I only use the Amazon name servers to keep the domain associated with a dynamic IP that is my EC2 instance. I don't use an elastic IP with EC2 so each time a start an instance it changes the DNS. I'm thinking this might be a VPC or network issue because I just have not been able to successfully connect to the EC2. I've looked in the etc/ssh/sshd_config also etc/ssh/ssh_config files which both have the correct port 22. – Nelson Canino Jan 6 at 8:14
  • I don't know what you mean "using the Amazon Web server". GoDaddy does have DNS. This really isn't making sense. You should get an elastic IP, they're free when you're instance is running, they only cost if you don't have them associated with a running instance. – Tim Jan 6 at 8:44
  • Let me clear this up. I made an elastic IPv4 for my ec2 instance. I associated it correctly with my instance. I type in the IPv4 in my browser bar and my webpage shows up. My problem is connecting to the instance on terminal. A few days ago I was able to make files, and perform maintenance on my website. I connect using terminal ssh. Recently the same command does not let me connect, the response times out which is my question and problem right now, why can't i connect? I purchased the domain from godaddy and updated it with amazon name servers so that the IPv4 is handled on AWS end. – Nelson Canino Jan 9 at 2:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.