SSH Unable to Connect to Mac Terminal

0

Dear Community,

I did the following instruction:

We weren't able to connect to your instance. Common reasons for this include:

  1. SSM Agent isn't installed on the instance. You can install the agent on both Windows instances and Linux instances. --> But I’m using Mac. Please advise.

  2. The required IAM instance profile isn't attached to the instance. You can attach a profile using AWS Systems Manager Quick Setup. --> Done

  3. Session Manager setup is incomplete. For more information, see Session Manager Prerequisites. --> Have verified IAM service role permissions

I’m unable to get EC2 AWS to connect with my Mac Terminal even though in the Instance, I have added, attached, and updated the “Modify IAM Role” from the IAM Instance profile and I did verify IAM service role permissions.

All left is the SSM Agent? Please advise as I find it very hard to work with EC2 AWS (again I’m not Tech Savvy).

Thanks.

1 Answer
0

If you mean SSM rather than SSH, and you're running a macos image, according to this page, https://docs.aws.amazon.com/systems-manager/latest/userguide/install-ssm-agent-macos.html, ssm-agent is pre-installed.

If you're running in a public subnet, you'll need a public ip associated with the EC2 instance. If you're in a private subnet, you'll need either a NAT gateway accessible from the subnet, or the appropriate VPC endpoints (if I remember, you'll need the 4 following: ec2, ssm, ec2-messages, ssm-messages).

profile picture
answered a year ago
  • Hi @Simon, sorry for the delay but thanks for your reply.

    I'm using MacBook Big Sur.

    I did this by trying to install manually under this link --> Manually installing SSM Agent on EC2 instances for macOS - for the purpose to see if my macOS have this SSM Agent (which is installed by default):

    Experiment:

    sudo wget https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/latest/darwin_amd64/amazon-ssm-agent.pkg

    Result:

    jsjs77@Sims-MacBook-Pro ~ % sudo wget https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/latest/darwin_amd64/amazon-ssm-agent.pkg Password: --2023-05-01 15:18:01--  https://s3.us-east-1.amazonaws.com/amazon-ssm-us-east-1/latest/darwin_amd64/amazon-ssm-agent.pkg Resolving s3.us-east-1.amazonaws.com (s3.us-east-1.amazonaws.com)... 52.217.124.40, 52.216.239.133, 52.217.174.224, ... Connecting to s3.us-east-1.amazonaws.com (s3.us-east-1.amazonaws.com)|52.217.124.40|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 30099366 (29M) [binary/octet-stream] Saving to: ‘amazon-ssm-agent.pkg’

    amazon-ssm-agent.pkg                  100%[======================================================================>]  28.70M   242KB/s    in 46s     

    2023-05-01 15:18:53 (645 KB/s) - ‘amazon-ssm-agent.pkg’ saved [30099366/30099366]

  • Hi @Simon,

    jsjs77@Sims-MacBook-Pro ~ % sudo installer -pkg amazon-ssm-agent.pkg -target / installer: Package name is amazon-ssm-agent installer: Installing at base path / installer: The install was successful. jsjs77@Sims-MacBook-Pro ~ % sudo launchctl load -w /Library/LaunchDaemons/com.amazon.aws.ssm.plist && sudo launchctl start com.amazon.aws.ssm /Library/LaunchDaemons/com.amazon.aws.ssm.plist: service already loaded Load failed: 37: Operation already in progress

    Then, when I try to connect SSH Client to my Mac Terminal:

    Result:

    jsjs77@Sims-MacBook-Pro ~ % cd downloads jsjs77@Sims-MacBook-Pro downloads % chmod 400 teajngubun.pem jsjs77@Sims-MacBook-Pro downloads % ssh -i "teajngubun.pem" ubuntu@ec2-54-90-174-17.compute-1.amazonaws.com ssh: connect to host ec2-54-90-174-17.compute-1.amazonaws.com port 22: Operation timed out

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

Relevant content