AWS EC2 Connection closed by when trying ssh into instance

前端 未结 8 1079
猫巷女王i
猫巷女王i 2020-12-14 05:26

Recently I set up a new EC2 instance. The next day I was not able to connect to my instance via ssh. I could connect and disconnect the day before, I am sure I did nothing.

相关标签:
8条回答
  • 2020-12-14 06:14

    Often times, you should use the default user name for the AMI that you used to launch your instance:

    • For Amazon Linux 2 or the Amazon Linux AMI, the user name is
      ec2-user.

    • For a CentOS AMI, the user name is centos.

    • For a Debian AMI, the user name is admin or root.

    • For a Fedora AMI, the user name is ec2-user or fedora.

    • For a RHEL AMI, the user name is ec2-user or root.

    • For a SUSE AMI, the user name is ec2-user or root.

    • For an Ubuntu AMI, the user name is ubuntu.

      Otherwise, if ec2-user and root don't work, check with the AMI provider.

    https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-get-info-about-instance

    0 讨论(0)
  • 2020-12-14 06:14

    I have the same issue but i fixed it by "restarting" the EC2. Note that restarting EC2 does not change its IP address but stopping and starting it again does change it.

    It was an easy fix but make sure you can bear the small downtime. In my case website stopped working suddenly.

    0 讨论(0)
提交回复
热议问题