EC2 instance stuck at unreachable login after assigning Elastic IP and rebooting
How did you access it before assigning the Elastic IP? Over Private IP? You should still be able to do so, i.e. ssh [email protected]
(interesting IP address by the way ;)
To access it over the Elastic IP you need to open Security Group inbound access to port TCP/22 from your laptop public IP. Or, temporarily for testing, open it from 0.0.0.0/0
.
To do that go to EC2 screen -> Instances -> find you instance -> Security Groups -> click on the security group sg-abcdefgh and add a new rule: TCP/22 from 0.0.0.0/0. If that works restrict it from 0.0.0.0/0
to your laptop public IP.
Then you should be able to ssh [email protected]
(the elastic IP).
Note that you don't need to use the DNS name, simply use the IP address.
Update
Based on the comments below here are some other things to check:
Make sure that Security Group has open inbound access to TCP port 22 from your IP or from everywhere as described above.
Verify that the instance really has the Elastic IP assigned. In EC2->Instances->i-abcd1234... -> look for Public IP and ssh to that, e.g.
ssh -v [email protected]
. Double check you've got it right.Make sure the instance is in a subnet with IGW (Internet Gateway) and that the Subnet Route Table has entry
0.0.0.0/0
pointing to that IGW. You'll find subnet info in Service->VPC in the top-left menu.If everything else fails spin up a new EC2 instance, e.g. t2.nano with Public IP enabled in the same subnet and SSH to it. From there SSH to your Ubuntu instance using its private IP 123.456.123.456.
Don't bother with hostnames for now, simply use the IP addresses to take one thing out of the equation.
Hope that helps :)
You might have enabled UFW from inside the EC2 instance to allow/deny certain inbound requests whereas the security groups should be added from the AWS console and needs to be configured from there.
I faced this issue and had to create another instance and terminate the previous one and made sure not to enable UFW from within EC2 instance.
Here is the reference to the said problem, hope it might help. How To Stop UFW (from Unix.SE).