Cannot connect to running ec2 instance via ssh nor the ec2 instance connect after instance stop&start

0

I have a running instance t3a.large, which has an elastic IP set. In security, I have inbound and unbound rules set accordingly. Monitoring shows that I have a credit balance left, this state that I cannot connect persists for more than a day so it should not be some short-term outage. The instance is linux ubuntu.

When I try to connect thru ssh it tells me ssh: connect to host ec2-x-x-x-x.zone.compute.amazonaws.com port 22: Resource temporarily unavailable EC2 connect is the same problem: EC2 Instance Connect is unable to connect to your instance.

I tried the automation workflow https://repost.aws/knowledge-center/ec2-ssh-errors-automation-workflow, but it is stuck on step troubleshootSSHOfflineWithSubnetId

It gave me a warning that the instance is not managed, so maybe this rescue automation should not work in my case?

I am stuck because I don't see any more options I could try, would you please give me a hint?

Petr N
질문됨 6달 전309회 조회
1개 답변
0

Hello.

To use "AWSSupport-TroubleshootSSH", you need to set up an IAM role in EC2 to make it a Systems Manager management instance.
You need to configure it according to the setup documentation below.
https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started.html

This document may be easier to understand for troubleshooting.
https://repost.aws/knowledge-center/ec2-linux-resolve-ssh-connection-errors

profile picture
전문가
답변함 6달 전
  • thank you for your advice, I tried to set it up, now it shows the instance as managed, so I ran the AWSSupport-TroubleshootSSH again and now in succeeded on 1. step (assertInstanceIsManagedInstance), but failed on step 3. (troubleshootSSH), where it throws this error at me:

    ================================================================================The EC2Rescue execution did not complete successfully.
    
    ----------ERROR-------
    failed to run commands: exit status 1
    

    Might this mean that it still does not have correct permission or something like that?

  • I don't know the cause of this error, but the execution is failing. If Systems Manager is available, why not connect with Session Manager and check the SSH logs or restart SSH? https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html#start-ec2-console

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠