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
gefragt vor 6 Monaten309 Aufrufe
1 Antwort
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
EXPERTE
beantwortet vor 6 Monaten
  • 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

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen