Common causes for connection issues We recommend that you begin
troubleshooting by checking some common causes for issues connecting
to your instance.
Verify the user name for your instance You can connect to your
instance using the user name for your user account or the default user
name for the AMI that you used to launch your instance.
Get the user name for your user account.
For more information about how to create a user account, see Manage
user accounts on your Amazon Linux instance.
Get 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 or ec2-user.
For a Debian AMI, the user name is admin.
For a Fedora AMI, the user name is fedora or ec2-user.
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.
For an Oracle AMI, the user name is ec2-user.
For a Bitnami AMI, the user name is bitnami.
Otherwise, check with the AMI provider.
Verify that your security group rules allow traffic Make sure your
security group rules allow inbound traffic from your public IPv4
address on the proper port. For steps to verify, see Error connecting
to your instance: Connection timed out
Verify that your instance is ready After you launch an instance, it
can take a few minutes for the instance to be ready so that you can
connect to it. Check your instance to make sure it is running and has
passed its status checks.
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
In the navigation pane, choose Instances, and then select your
instance.
Verify the following:
In the Instance state column, verify that your instance is in the
running state.
In the Status check column, verify that your instance has passed the
two status checks.
Verify the general prerequisites for connecting to your instance For
more information, see General prerequisites for connecting to your
instance.
So earlier it was working and I am using an Elastic IP, so the IP should be the same. I checked the ssh key and it wasn't changed. The last thing I did was sudo service varnish restart and I think I got an error saying something along the line of "varnish doesn't belong to sudoer group", and then I lost connection and I keep getting "Connection closed." when I try to log in. I rebooted the instance and it's still giving me that error. The website passed all checks, and I tried everything, but I am not sure what caused this to happen. The last things I did was try to import some SSL files into the nginx folder from another website, because something wasn't running properly at all.