3

When I check the logs of my EC2 instance after assigning an elastic IP (e.g., new elastic ip is = ip-111-111-111-111) and rebooting, I get the following at the end of my EC2 logs (Found by going to "Actions"->"Instance Settings"->"Get System Logs")

Ubuntu 16.04.5 LTS ip-123-456-123-456 ttyS0: 

ip-123-456-123-456 login: 

Where ip-123-456-123-456 is the private IP and ip-111-111-111-111 is the new elastic IP.

My EC2 instance is just sitting there and I am unable to ssh into the box and I'm unable to interact with the machine to enter the password for the private IP login it is asking for. Is this a common occurrence? What can I do to get my EC2 instance past this state?

UPDATE: I also modified some DNS settings in an attempt to point a domain name from GoDaddy to this EC2 instance's elastic IP. Is it possible this screwed something up and has caused the login to fail?

UPDATE 02: I am loath to include a screenshot but this is where it is at after taking a screenshot of the machine, where the machine is stuck, asking for the private IP login. All of my ssh requests timeout, I think due to this.

enter image description here

  • 2
    Can you actually show the output of what happens when SSHing into the server: ssh user@<ip> -vvv – ryekayo Oct 16 '18 at 20:07
  • The ssh command eventually times out. – Scott Skiles Oct 17 '18 at 12:37
2

How did you access it before assigning the Elastic IP? Over Private IP? You should still be able to do so, i.e. ssh ubuntu@123.456.123.456 (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 ubuntu@111.111.111.111 (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 ubuntu@111.111.111.111. 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 :)

|improve this answer|||||
  • Thank you. The Security Group for TCP on Port 22 with 0.0.0.0/0 was setup by the launch wizard already, and I did manage to ssh into the machine using the Elastic IP once already. However, after messing around with some DNS stuff, I restarted the machine and now it is hung at the login screen with the private IP. – Scott Skiles Oct 17 '18 at 9:36
  • The login screen will always show the private IP. The public IP is handled / translated outside of the instance in the AWS network infrastructure. Also DNS can’t break access to the instance if you ssh to it using the IP address and not using the host name. Do sah -v ec2-user@IP.AD.DR.ES - what do you get? – MLu Oct 17 '18 at 9:44
  • ssh: connect to host ec2-ip-ad-dr-es.us-east-2.compute.amazonaws.com port 22: Operation timed out – Scott Skiles Oct 17 '18 at 9:47
  • I'm not concerned the logs show the private IP, I am concerned the private IP login is not finishing. Is that normal to be the last line after rebooting an EC2 instance? ip-123-456-123-456 login: – Scott Skiles Oct 17 '18 at 9:48
  • Yes that's normal. It's the virtual console waiting for a login name. However on AWS you can't login through the virtual console so this login prompt just sits there forever. That's normal. – MLu Oct 17 '18 at 10:15
2

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).

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.