简体   繁体   中英

AWS EC2 - Ubuntu instance, SSH connect to host operation timed out

I am new to setting up virtual machines. I created my first Ubuntu instance using AWS EC2. Everything seemed to check out until I tried connecting to it with ssh, as per instructions.

To provide some context, my app is called "smpapp". My computer is macOS High Sierra. Naturally, my smpapp.pem file saved to ~/Downloads . First, I opened up the Terminal and set my working directory to Downloads with cd ~/Downloads . Then I entered chmod 400 smpapp.pem , which didn't return any error, so I assume it was a success. Then, I entered ssh -i "smpapp.pem" ubuntu@ec2-XX-XX-XXX-XXX.us-east-2.compute.amazonaws.com (omitting public DNS numbers with Xs). It took awhile to process before spitting out, ssh: connect to host ec2-XX-XX-XXX-XXX.us-east-2.compute.amazonaws.com port 22: Operation timed out .

Can someone explain the general problem to me and how I can fix it (methodically and in layman's terms)?

Could be a few things:

Does your ec2 instance have a public ip? (if not, you might have to attach an elastic ip or put it in a public subnet)

Is the security group attached to the ec2 instance allowing connections to port 22?

Is the ACL on the subnet allowing public connections to the subnet?

Is your VPC configured to routetraffic through your IGW?

Amazon offers step by step instructions on determining the issue, it could be for any reason of the above not being configured properly. You can find step by step instructions on what do in the official amazon docs here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM