EC2 instance ssh: connect to host ipaddr port 22: Operation timed out on MacOS

0

Hi there, new developer here!

I just signed up for my EC2 Windows2022 instance and would like to connect it from my Mac (M2, Sonoma14.5) terminal using SSH, but all trials failed with the error: "ssh: connect to host ipaddr port 22: Operation timed out".

Based on the previows posts regarding the same issue, I've tried a couple of things:

  1. Add SSH Port22 into the security group rules, as well as ICMP protocols Edited Security Group Rules

  2. Add SSH into ACL rules ACL Inbound Rules ACL Outbound Rules

  3. Reboot and check the status of the instance (numerous times)

  4. Ensure my IP is not a public one and tried different IPs to connect

  5. Ensure I've turned on the remote login option

  6. Turn off the firewall on my Mac

However, after tried these, I still fail to connect via SSH and been stuck here for several days. Would you have any more ideas. I'll appreciate though. Thank you!

1 Answer
1
Accepted Answer
  1. Ensure my IP is not a public one and tried different IPs to connect

This is going to be the source of at least one of your problems, your EC2 instance needs to have a public IP address and it is that public IP address that you need to connect to.

Just as importantly, Windows won't normally accept SSH connections (without some severe customisations). The normal way would be to use RDP over port 3389, which you already have opened.

profile picture
EXPERT
Steve_M
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile picture
EXPERT
reviewed 2 months ago
  • Thank you for pointing that out and for these suggestions! I've checked my IP and it starts from "76", so it's a public addr now. I just tried again on my Mac Terminal using the command "ssh -i [key].pem ec2-user@[ec2 public DNS]", but it failed (same error). Any other things I need to check?

  • In your question you said:

    I just signed up for my EC2 Windows2022 instance

    This is your problem, you cannot SSH to a Windows instance.

  • Thank you all. That's exactly where the problem comes from. I can easily use RDP to connect. Appreciate!

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions